CXuesong / BotBuilder

For an unofficial CoreCLR proted version of BotBuilder, see CXuesong/BotBuilder.Standard.
MIT License
0 stars 0 forks source link

Make solution compiles on both .NET Framework and .NET Standard (.NET Core) #1

Open CXuesong opened 6 years ago

CXuesong commented 6 years ago

I'm going to create Microsoft.Bot.Builder.2017.sln, Microsoft.Bot.Builder.2017.csproj, etc. to facilitates the multi-targeting feature of the new csproj format. The original solution files shall be kept as-is.

CXuesong commented 6 years ago

I will try to merge Bot.Connector.* files into one project. To avoid large changes on file structure, I will try keep the files in their original directories.

CXuesong commented 6 years ago

Blocker: The library compiles on net45/netstandard1.6 or net46/netstandard2.0, but when I tried to compile Microsoft.Bot.Sample.SimpleEchoBot.2017.csproj (net46), there is an error

2>MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project.json doesn't have a runtimes section. You should add '"runtimes": { "win": { } }' to your project.json and then re-run NuGet restore.

It prevents the project from building.

I cannot use the newer csproj format (<Project Sdk="Microsoft.NET.Sdk"> blah blah blah) for Microsoft.Bot.Sample.SimpleEchoBot, which is a ASP.NET (not Core) project. Though it can compile, I cannot execute it.

CXuesong commented 6 years ago

By setting the output logging level to "verbose", the related output is as follows

3>来自项目“\BotBuilder\CSharp\Samples\SimpleEchoBot\Microsoft.Bot.Sample.SimpleEchoBot.2017.csproj”的文件“MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets”中的目标“ResolveNuGetPackageAssets”(目标“ResolveAssemblyReferences”依赖于它):
3>正在使用程序集“MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.Build.Tasks.dll”中的“ResolveNuGetPackageAssets”任务。
3>任务“ResolveNuGetPackageAssets”
3>MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(178,5): error : Your project is not referencing the ".NETFramework,Version=v4.6.1" framework. Add a reference to ".NETFramework,Version=v4.6.1" in the "frameworks" section of your project.json, and then re-run NuGet restore.
3>已完成执行任务“ResolveNuGetPackageAssets”的操作 - 失败。
3>已完成在项目“Microsoft.Bot.Sample.SimpleEchoBot.2017.csproj”中生成目标“ResolveNuGetPackageAssets”的操作 - 失败。

Later I created a blank ASP.NET application, built it, and got the following output

1>由于条件的计算结果为 false,已跳过目标“ResolveNuGetPackageAssets”;('$(ResolveNuGetPackages)' == 'true' and exists('$(ProjectLockFile)'))的计算结果为('true' == 'true' and exists('obj\project.assets.json'))。

The problem here is the file obj\project.assets.json shouldn't exist, if the project.json doesn't exist.

Removed Samples/Microsoft.Bot.Sample.SimpleEchoBot/obj folder. Problem solved.