The MAUI app project template does not target windows out-of-the-box
See original GitHub issueDescription
Following the steps to create a MAUI app, I get a project that does not target windows:
Steps to Reproduce
- Create a new project using the “.NET MAUI App (Preview)” template
- open dependencies in the solution explorer
Version with bug
Unknown/Other (please specify)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
I don’t know how to see the version of the project templates - or how to update those other than when updating VS itself
Did you find any workaround?
I can fix this in the project file by removing the xml comments around this line
<!-- <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks> -->
and changing this section
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0-experimental1" />
<PackageReference Include="Microsoft.WindowsAppSDK.Foundation" Version="1.0.0-experimental1" />
<PackageReference Include="Microsoft.WindowsAppSDK.WinUI" Version="1.0.0-experimental1" />
<PackageReference Include="Microsoft.WindowsAppSDK.InteractiveExperiences" Version="1.0.0-experimental1" NoWarn="NU1701" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.26-experimental1" />
</ItemGroup>
to
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
Relevant log output
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Troubleshoot known issues - .NET MAUI
Learn about .NET MAUI known issues and troubleshooting you can do to resolve these issues.
Read more >Is Maui dead on arrival? : r/dotnet
My vote is the Microsoft Authenticator app, I want them to have to make the ... My Blazor is targeted as a WASM...
Read more >The Most Comprehensive UI Library of .NET MAUI Controls
The UI suite offers 60+ .NET MAUI controls for building modern-looking multi-platform applications, including DataGrid, ListView, Charts and DatePicker.
Read more >Start Your New .NET MAUI App with These Amazing Templates!
Not 1, but 2 amazingly extensive .NET MAUI templates to kickstart your new .NET MAUI project. Community members Matt Lacey and Allan Ritchie ......
Read more >.NET MAUI guide: Complete overview + demo - ...
We take a deep dive into .NET MAUI, evaluating its performance, comparing it Xamarin.Forms, and using it to build a cross-platform demo app....
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 Free
Top 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
I was merely curious - half expecting an explanation along the lines you just gave 😃 Thanks again for a very quick answer! (my next step is to try publishing to windows - and I will be following your bullet 4 from issue 4329) (edited to get rid of the linking between issues, since that seems not very relevant…)
I think you need to update your templates, this has not been the default for a while now. To clarify: the recent versions of templates have Windows enabled by default for a couple of previews already.
For some reason the templates aren’t updated nicely with Visual Studio, you can update them manually at this time by running the following command in a terminal window:
dotnet new -i Microsoft.Maui.Templates
Also check this portion of a video by James for more info: https://www.youtube.com/watch?v=ugem4UbAtC0&t=672s