Reputation: 645
Trying to VSTS build our .NET core application that we upgraded from 2.0 to 2.1.
When I build locally with SDK version 2.1.301 everything is fine. But the VSTS build is failing.
So I have a global.json to the root of the project failing added but this did not solve the issue:
{
"sdk": {
"version": "2.1.301"
}
}
The error we are getting is this:
2018-06-29T10:40:44.2112663Z 2018-06-29T10:40:44.2112824Z
"D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj" (Restore target) (1) -> 2018-06-29T10:40:44.2113005Z (Restore target) -> 2018-06-29T10:40:44.2113230Z D:\a\1\s\FooApp\FooApp.csproj : error NU1107: Version conflict detected for Microsoft.AspNetCore.Razor.Language. Reference the package directly from the project to resolve this issue. [D:\a\1\s\FooApp.Tests\FooApp.Tests.csproj] 2018-06-29T10:40:44.2113815Z D:\a\1\s\FooApp\FooApp.csproj : error 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 -> Microsoft.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.2114327Z D:\a\1\s\FooApp\FooApp.csproj : error 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
Here is the 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>
Upvotes: 2
Views: 1197
Reputation: 131571
Most likely the SDK 2.1.301 SDK isn't installed on the TFS server. 2.1.301 corresponds to .NET Core 2.1.1
The package contains a reference to :
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
As the error says, this package ends up requiring the 2.1.1 version of Microsoft.AspNetCore.Razor.Language
. The Microsoft.AspNetCore.App
package found on the build server though is 2.1.0.
The solution is to install the 2.1.301 SDK on the server
UPDATE
If VSTS doesn't have the latest SDK version, it can be installed following the steps shown here:
.NET Core Tool Installer
task as the first task in the build process and specify the SDK version. In this case it's 2.1.301
Nuget Tool Installer
right after it.These steps should install the correct versions of the SDK and NuGet
Upvotes: 3