maui
maui copied to clipboard
Cannot deploy windows when referencing net6 and ApplicationDisplayVersion < 1.0
Description
When targeting net6.0 in the MAUI project and setting ApplicationDisplayVersion less than 1.0 then then deployment for Windows is not working and throws the error:
Severity Code Description Project File Line Suppression State Error NETSDK1005 Assets file 'C:\Users\JanDu\source\repos\BugSample\BugSample\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041.0' in the TargetFrameworks for your project. BugSample C:\Program Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267
At the same time if we do not reference net6.0 then it works (only referencing ios, android, windows) but then unit testing is not possible.
Here is a video: Just if I change the version to 0.1 from 1.0 the solution doesn't build anymore and restoring nuget packages fails.
https://gifyu.com/image/SEsbg
My whole team encounters this issue, both with Visual Studio 2022 and Preview.
Steps to Reproduce
- Create new Maui project
- Add targetFramework net6.0
- Set ApplicationDisplayVersion to 0.1
- Run
Link to public reproduction project repository
https://github.com/janduldhardt/issue-1425176615
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
windows10.0.19041.0
Did you find any workaround?
Set version to 1.0 and above
Relevant log output
NETSDK1005 Assets file 'C:\Users\JanDu\source\repos\BugSample\BugSample\obj\project.assets.json' doesn't have a target for 'net6.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net6.0-windows10.0.19041.0' in the TargetFrameworks for your project. BugSample C:\Program Files\dotnet\sdk\6.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267
I'm not sure if the ApplicationDisplayVersion matter much in this case. It seems that the refences simply haven't restored yet as indicated by the error message.
Could you try right clicking on your solution node and choose "Restore NuGet Packages", wait for that to complete and then try again?
Else, please add a reproduction project as requested. I have just tried to reproduce here locally and it works fine for me.
Hi @janduldhardt. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@jfversluis I added a sample repository + a video that shows the problem. https://gifyu.com/image/SEsbg When v1.0 dotnet restore and restoring nugets works perfectly fine. If I then set the version to 0.1 and rebuild the project it stops working. I could reproduce your case, that if I restore the nugets with v1.0 and then just change to v0.1 then I can also start the application but as soon as any kind of restoring happens it fails.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
If I set ApplicationDisplayVersion to 1.0.1 and delete bin and obj folders it fails with
Error NETSDK1005 Assets file '\obj\project.assets.json' doesn't have a target for 'net7.0-windows10.0.19041.0'.
Ensure that restore has run and that you have included 'net7.0-windows10.0.19041.0' in the TargetFrameworks for your project.
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267
If I delete bin and obj folders again and set ApplicationDisplayVersion back to 1.0 it works again.
Same issue here
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on windows platform with above project.
https://github.com/janduldhardt/issue-1425176615
Same problem here. If I change the display version away from 1.0 the build fails with NetSDK1005. Nuget and Dotnet restore does not work.
Same problem here, MAUI blazor net7.
When publish win app, no problem con android publish.
UPDATE:
This one worked for me (https://stackoverflow.com/questions/65508600/project-assets-json-doesnt-have-a-target-for-net472-ensure-that-restore-has
del obj\project.assets.json dotnet restore