3.1.401 SDK fails to resolve correct available runtimes with 2.2.x
See original GitHub issueDescribe the bug
I have a have a single target project with the following config:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
The build machine has dotnet core SDK. 2.2.402 and 3.1.401 installed. When I attempt to build this project, the following error is emitted and the build fails:
##[error]C:\hostedtoolcache\windows\dotnet\sdk\2.2.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): Error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.
If I instead install SDKs 2.2.402 and 3.1.302 this error does not occur and the build succeeds.
To Reproduce
- Install SDKs 2.2.402 and 3.1.401
- Run
msbuild.exe" "D:\a\1\s\MySolution.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.166.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.166.2\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:PublishProfile=WebDeployPackage /p:configuration="Release" /p:_MSDeployUserAgent="VSTS_4522ee20-b1c7-418b-b3de-2bf24bb4eccd_build_43_0"
- Error (see above)
Expected Result
The build should succeed.
Additional information
This was discovered on Azure DevOps. Nothing changes between the two builds other changing the Use .NET Core
task to target 3.1.302
instead of 3.1.x
.
Was there a breaking change in the last patch build or is this a bug?
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
NETSDK1141: Unable to resolve the .NET SDK version as ...
The SDK version specified in global.json could not be found, due to an incorrect path. How to fix the error. Install the SDK...
Read more >The current .NET SDK does not support targeting . ...
This happened to me after installing 2.2.100-preview3-009430 and then updating to Visual Studio 15.9.2. I resolved by enabling the "Use previews ...
Read more >Visual Studio 2019 unable to locate .Net Core SDK
Step 1) First run dotnet --list-sdks from the command line (as in Grzegorz Smulko's answer). Take note of the greatest version number.
Read more >Incompatible versions of Mono MSBuild and .NET Core ...
NET Core SDK are incompatible on Linux and macOS. If you use such... ... 5): [MSB4018] The "ResolvePackageAssets" task failed unexpectedly. System.
Read more >Why don't any of these methods work for installing .Net ...
I went to the following official Microsoft link to install .NET Core 6.x (SDK & runtime) and they would not work.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, we are closing to net5.0 release. Please expect a very long delay.
Yes.
If you test, yes, it will fail to run. However I tried the following pipeline. If you install runtime and the SDK both in the same location. SDK will be able to find the runtime and run it.
dotnet --info result