-
Notifications
You must be signed in to change notification settings - Fork 320
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
PRI: Improve error message when referencing WinUI3 from net5.0 project #361
Comments
I transferred this issue from the WinUI repo since this is an issue with the PRI gen targets. I agree that a better error message telling the user what they need to do would be better. |
Wanted to add I also hit this with a WPF desktop application project (net5) with the PR metapackage. |
@stevewri Any news? I encountered this error today in a MAUI Preview 14 app and I don't know what to do. |
@janseris this really shouldn’t be an issue with Maui. Are you not multitargeting your Maui app? |
I am taking this project: https://github.com/jasho/cookbook-maui When I add
I have no idea what causes the issue because I checked the default MAUI Preview 14 (latest) project template .csproj contents and they seem to match the linked project .csproj MAUI project file. |
@janseris ? That’s a different error than what I reported here |
I thought these two shared the Platform version number parsing issue. |
For me fixing this issue was in the line with net6.0-windows. |
I've a similar issue with WinUI and dotnet 7. 2022-11-16 15:49:20 Critical Project 'App1' load failed| [MSB4086] A numeric comparison was attempted on "$(TargetPlatformVersion)" that evaluates to "" instead of a number, in condition "'$(TargetPlatformVersion)' < '10.0.18362.0'". C:\Users\hugod.nuget\packages\microsoft.windowsappsdk\1.2.221109.1\buildTransitive\Microsoft.InteractiveExperiences.Common.targets at (15:27) I'm using Visual Studio Pro v17.4.1 |
Same, switching target framework to dotnet 7 does not work even though it's supposed to be supported. |
You saved me with this post, thanks! :-) Exactly the same problem, fixed this way! |
JohnGomes... you saved the day... It worked on my Windows App SDK. Now is asking to upgrade some dependency class libraries... i wil do anyways... :) |
Describe the bug
The build error you receive when incorrectly targeting
net5.0
instead ofnet5.0-windows10.0.xxxxx
is very unhelpful:VS also shows the following tooltip error:
This issue was reported by a user in the WinUI Discord channel, and didn't know what to do at first. A better error message would have saved the person a lot of time.
Steps to reproduce the bug
net5.0
.csproj
:Expected behavior
A helpful error that informs the user that they need to retarget.
As an example, see the PR I did for RX.NET here to help users target the correct thing: dotnet/reactive#1442
(just put the .targets file in the
net5.0
folder instead of net5.0-windows`Version Info
NuGet package version:
[Microsoft.WinUI 3.0.0-preview3.201113.0]
Windows app type:
Additional context
The main problem is probably that the .targets files aren't in the proper
\build\net5.0-windows10.[minversion]
folder, so it gets included in every target framework. Once that has moved to a subfolder, the error should go away (as the targets aren't included), and the approach used in the PR referenced above can be used to improve the error message.The text was updated successfully, but these errors were encountered: