Skip to content
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

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

Closed
Dbquity opened this issue Jan 28, 2022 · 6 comments
Closed

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

Dbquity opened this issue Jan 28, 2022 · 6 comments
Labels
platform/windows 🪟 t/bug Something isn't working

Comments

@Dbquity
Copy link

Dbquity commented Jan 28, 2022

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

@Dbquity Dbquity added the t/bug Something isn't working label Jan 28, 2022
@Dbquity
Copy link
Author

Dbquity commented Jan 28, 2022

This issue was prompted by the comments in #3625

@jfversluis
Copy link
Member

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

@Dbquity
Copy link
Author

Dbquity commented Jan 28, 2022

Thanks @jfversluis !

Is the comment in the second line below still needed?

<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
    <!-- Required - WinUI does not yet have buildTransitive for everything -->
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
    <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>

@jfversluis
Copy link
Member

I think so. I think ultimately we can do without these explicit references and it will be implied by adding .NET MAUI to your project, but it seems WinUI hasn't implemented something like that yet... But I might be mistaken.

Why you ask?

@Dbquity
Copy link
Author

Dbquity commented 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...)

@jfversluis
Copy link
Member

Let me know how that one goes!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants