uno icon indicating copy to clipboard operation
uno copied to clipboard

dotnet new: UWP should not be mandatory

Open microhobby opened this issue 4 years ago • 8 comments

Current behavior

On Linux creating a new unoapp for Skia.GTK does not work anymore:

dotnet new unoapp -wasm=false -uwp=false -ios=false -android=false -macos=false -skia-wpf=false -st=false

Couldn't find an installed template that matches the input, searching online for one that does...
Matches from template source: NuGet
-----------------------------------
Template name "Cross-Platform App" (unoapp) from author "Uno Platform" in pack Uno.ProjectTemplates.Dotnet
    To use this template, run the following command and try again:
        dotnet new -i Uno.ProjectTemplates.Dotnet::3.5.1

The command only work if the -uwp-false is removed.

Expected behavior

For Skia.GTK and WASM projects UWP is not necessary and only creates garbage on the project.

How to reproduce it (as minimally and precisely as possible)

Check the Current behavior and run the command with the templates from master branch.

Workaround

1- Use your own templates. DRAWBACKS: mainaintence of templates, bump versions etc ...

2- Use VS 2019 to remove the UWP project DRAWBACK: does not work if user is on Linux using VS Code 🙄

Environment

Nuget Package:

  • [ ] Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
  • [x] Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
  • [ ] Uno.SourceGenerationTasks
  • [ ] Uno.UI.RemoteControl / Uno.WinUI.RemoteControl
  • [ ] Other:

Nuget Package Version(s):

Affected platform(s):

  • [ ] iOS
  • [ ] Android
  • [x] WebAssembly
  • [ ] WebAssembly renderers for Xamarin.Forms
  • [ ] macOS
  • [x] Skia
    • [ ] WPF
    • [x] GTK (Linux)
    • [ ] Tizen
  • [ ] Windows
  • [ ] Build tasks
  • [ ] Solution Templates

IDE:

  • [ ] Visual Studio 2017 (version: )
  • [ ] Visual Studio 2019 (version: )
  • [ ] Visual Studio for Mac (version: )
  • [ ] Rider Windows (version: )
  • [ ] Rider macOS (version: )
  • [x] Visual Studio Code (version: )

Relevant plugins:

  • [ ] Resharper (version: )

Anything else we need to know?

microhobby avatar Apr 10 '21 14:04 microhobby

Change from https://github.com/unoplatform/uno/pull/5641

microhobby avatar Apr 10 '21 14:04 microhobby

For now, the reason for the UWP project to be mandatory is the location of the icon and manifest files that are referenced from the Skia heads. This is also how the icon for the app is set, which makes it not garbage :)

Removing the project in the VS Code context does not change much as you don't need the SLN file anyways. You can remove the UWP project folder and move the files as needed.

jeromelaban avatar Apr 12 '21 01:04 jeromelaban

Well, from my tests omnisharp was not able to use the shared project just with the .csproj files, but with the solution it can load everything without problems, because of that I am relying on the solution files to work on extensions templates. There is also the case of cross platform projects WASM and Skia.GTK in this case shared also works better with the solution file.

Don't get me wrong, when I say garbage, it is that for Linux environments I believe that UWP is useless, since it is not possible to compile it using dotnet for Linux, right? So, VS Code complains about not found stuff and etc. Correct me if I'm wrong.

microhobby avatar Apr 12 '21 01:04 microhobby

Makes sense. It would probably make sense then to adjust the template to keep the UWP required files (assets and appxmanifest), but remove the project in the meantime, until we find a better solution.

jeromelaban avatar Apr 12 '21 13:04 jeromelaban

I just wanted to say that the original scenario also applies for MAC OS. I would like to be able to ignore the UWP project.

BTW: It seems that something is not working properly with the CLI on MAC OS (CLI v3.10.11 and v3.11.0-dev.139) when choosing a couple platforms, for example I wanted to create a solution only targeting Android and iOS using WinUI 3, I have tried the following commands without any luck:

WinUI 3

dotnet new unoapp-winui -o MyApp1 -ios=true -android=true -wasm=false -macos=false -sw=false -sg=false -wd=false

WinUI 3 + NET 6

dotnet new unoapp-winui-net6 -o MyApp2 -M=true -sw=false -sg=false -wd=false -wasm=false

Both commands apparently ignores all the flags set to "false" and creates all the available projects.

bgaprogrammer avatar Sep 21 '21 14:09 bgaprogrammer

@bgaprogrammer for now, the UWP project is needed for some assets. We'll change it at some point, particularly when support for single projects will be better supported. In the meantime, if you want to remove it you can make the adjustments to move the files reference to the location of your choosing.

jeromelaban avatar Sep 21 '21 14:09 jeromelaban

@jeromelaban Can this issue be closed now, or is the Windows project still mandatory?

lukeblevins avatar Sep 10 '22 14:09 lukeblevins

It is still mandatory, we have not changed the source of the manifest file.

jeromelaban avatar Sep 12 '22 19:09 jeromelaban

Now that each of the Skia targets has its own manifest, I think this can be closed, correct? @jeromelaban

MartinZikmund avatar Jul 10 '23 08:07 MartinZikmund

It can!

jeromelaban avatar Jul 11 '23 12:07 jeromelaban