尝试 VSTS 构建我们从 2.0 升级到 2.1 的 .NET 核心应用程序。
当我使用 SDK 版本 2.1.301 在本地构建时,一切都很好。但是 VSTS 构建失败了。
所以我在项目的根目录中添加了一个global.json失败,但这并没有解决问题:
{
"sdk": {
"version": "2.1.301"
}
}
我们得到的错误是这样的:
2018-06-29T10:40:44.2112663Z 2018-06-29T10:40:44.2112824Z
“D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj”(恢复目标)(1)-> 2018-06-29T10:40:44.2113005Z(恢复目标)-> 2018-06-29T10 :40:44.2113230ZD:\a\1\s\FooApp\FooApp.csproj:错误 NU1107:检测到 Microsoft.AspNetCore.Razor.Language 的版本冲突。直接从项目中引用包来解决这个问题。[D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj] 2018-06-29T10:40:44.2113815ZD:\a\1\s\FooApp\FooApp.csproj:错误 NU1107:FooApp -> Microsoft.VisualStudio.Web.CodeGeneration.Design 2.1.1 -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 2.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration 2.1.1 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 2.1 .1 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 2.1.1 -> 微软。VisualStudio.Web.CodeGeneration.Templating 2.1.1 -> Microsoft.AspNetCore.Razor.Language (>= 2.1.1) [D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj] 2018-06- 29T10:40:44.2114327ZD:\a\1\s\FooApp\FooApp.csproj:错误 NU1107:FooApp -> Microsoft.AspNetCore.App 2.1.0 -> Microsoft.AspNetCore.Razor.Language (= 2.1.0)。[D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj] 2018-06-29T10:40:44.2114518Z
这是 MyOwnApp.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Models\**" />
<Content Remove="Models\**" />
<EmbeddedResource Remove="Models\**" />
<None Remove="Models\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="2.6.0" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Azure.ServiceBus" Version="3.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="2.6.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.MSSqlServerCore" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyOwnApp\MyOwnApp.csproj" />
</ItemGroup>
</Project>