Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to build a .Net Core 2.2 project with Azure DevOps with on-premises agent #2172

Closed
haiduc32 opened this issue Dec 20, 2018 · 4 comments
Closed

Comments

@haiduc32
Copy link

We are using the Azure DevOps to host and build our code. We are starting to build new services on .Net Core and since 2.2 is out, decided to go that route. But after installing .Net Core SDK 2.2.101 on the build agent (on premises), creating a vanilla asp.net core empty project (New Project -> pushed to git, absolutely no changes), it looks like it wants to compile it against the 2.1, even though the TargetFramework is netcoreapp2.2.

For building we are using the Visual Studio Build task. Using dotnet build is not an option as we'll need multiple targets for some of the common components we are sharing between .net framework and .net core projects we have.

2018-12-19T15:41:51.1962553Z ##[error]C:\Users\VssAdministrator\.nuget\packages\microsoft.aspnetcore.app\2.1.0\build\netcoreapp2.1\Microsoft.AspNetCore.App.targets(14,5): Error : This version of Microsoft.AspNetCore.App is only compatible with the netcoreapp2.1 target framework. Please target netcoreapp2.1 or choose a version of Microsoft.AspNetCore.App compatible with netcoreapp2.2.

The .net core installed on the agent (output from dotnet --list-sdks):

2018-12-19T15:29:54.1887058Z 2.1.201 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1887424Z 2.1.202 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1887788Z 2.1.400 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1887954Z 2.1.402 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1888059Z 2.1.403 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1888137Z 2.1.500 [C:\Program Files\dotnet\sdk]
2018-12-19T15:29:54.1888211Z 2.2.101 [C:\Program Files\dotnet\sdk]

Same behavior can be observed on the Hosted VS2017 agent, but you need to install the .Net Core SDK 2.2.101 first using the .NET Core SDK Installer task.

Setting the version for Microsoft.AspNetCore.App explicitly in the csproj file resolves the exception, but does not solve the problem, as stranger errors pop up down the line.

Could not reproduce the problem on a developer machine. Might be related to the version of the Visual Studio installed.

@haiduc32
Copy link
Author

p.s. added here as seems like a .Net Core issue, rather than a Azure DevOps but I might be wrong...

@karelz
Copy link
Member

karelz commented Dec 20, 2018

It seems that something in your Azure DevOps setting (or in the platform itself) decided to use wrong MS.AspNetCore.App package. If it compiles locally, I would dig into the differences of used SDKs and other tools. Contacting Azure DevOps support may be one of the ways to narrow it down.
This may be also helpful: https://www.hanselman.com/blog/AzureDevOpsContinuousBuildDeployTestWithASPNETCore22PreviewInOneHour.aspx

If you find evidence this is a problem in .NET Core itself (SDK or runtime), please let us know and we can reopen.
Closing as this is likely problem in Azure DevOps.

@karelz karelz closed this as completed Dec 20, 2018
@haiduc32
Copy link
Author

haiduc32 commented Jan 3, 2019

UPDATE: for the benefit of anyone having the same issues

found the problem, it was due to the NuGet restore task using the 4.3 version (because I cloned the build definition from another project, doh..). Updated to latest and it worked OK.

@shravanipandarmish-gep
Copy link

we are using NuGet restore 4.8.1 still the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants