-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
I'm currently in the process of experimentally migrating one of our production apps to the .NET 6 RC 1 to check the upgrade path before the RTM releases. The code is an ASP.NET Core app originally targeting net5.0-windows because of some Windows-only dependencies.
After migrating to net6.0-windows and updating the nuget references to 6.0.0-rc.1.*, the solution failed to compile with the following error:
[home folder]\.nuget\packages\microsoft.aspnetcore.mvc.testing\6.0.0-rc.1.21452.15\buildTransitive\net6.0\Microsoft.AspNetCore.Mvc.Testing.targets(3,3): error MSB4019: The imported project "[home folder]\.nuget\packages\microsoft.aspnetcore.mvc.testing\6.0.0-rc.1.21452.15\build\net6.0-windows\Microsoft.AspNetCore.Mvc.Testing.targets" was not found. Confirm that the expression in the Import declaration "..\..\build\net6.0-windows\Microsoft.AspNetCore.Mvc.Testing.targets" is correct, and that the file exists on disk. [project path]
The issue happened on one of our test projects that reference Microsoft.AspNetCore.Mvc.Testing version 6.0.0-rc.1.*. When I looked into the package itself, the problem seems to be that there is no targets file for net6.0-windows at the specified path.
buildTransitive/net6.0/Microsoft.AspNetCore.Mvc.Testing.Targets:
<Project>
<Import Project="..\..\build\$(TargetFramework)\Microsoft.AspNetCore.Mvc.Testing.targets" />
</Project>
The specified path should lead to build/net6.0-windows/Microsoft.AspNetCore.Mvc.Testing.targets but that does not exist, there is only build/net6.0/Microsoft.AspNetCore.Mvc.Testing.targets. Therefore the message correctly states that the path cannot be imported.
The simplest repro is to create a new project, reference Microsoft.AspNetCore.Mvc.Testing:6.0.0-rc.1.* and target net6.0-windows. I'm attaching the repro code:
Repro.zip
Just retargeting to net6.0 fixes the problem and the code compiles. With net6.0-windows the compilation fails. Is there something wrong with the setup or is this a problem with the package itself?
System info:
Windows 10 21H1
.NET SDK 6.0.100-rc.1.21458.32
Visual Studio 2022 Professional (17.0.0 Preview 4)