question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The MAUI app project template does not target windows out-of-the-box

See original GitHub issue

Description

Following the steps to create a MAUI app, I get a project that does not target windows: image

Steps to Reproduce

  1. Create a new project using the “.NET MAUI App (Preview)” template
  2. 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Dbquitycommented, Jan 28, 2022

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…)

1reaction
jfversluiscommented, Jan 28, 2022

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found