Open ziaulhasanhamim opened 2 years ago
Using dotnet run works for me for an unpackaged winui app
@lhak Really you are able to run winui 3 apps from cli? How?
@ziaulhasanhamim Create a new WinUI project (empty project with separate packaging project). Then add the following lines to the project file:
<WindowsPackageType>None</WindowsPackageType>
<EnableMsixTooling>true</EnableMsixTooling>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
Dotnet run (in the directory with the project itself, not the solution) shows some warning message about running as AnyCPU, but the app still starts.
Do have any idea if it works with MAUI?
Hey team, our use case for an internal app I'm building with MAUI is being significantly impaired by this. Please, please fix or provide a workaround. I've been fighting Windows for days to get something working, and I need to move on.
There currently seems to be a bug in the winui build scripts that still set the runtime identifier to win10-platform instead of win-platform when in AnyCPU configuration. To workaround that, you can add
@lhak could you be a little more specific? I believe I am already doing that - I build in both Debug and Release with the platform set to x64, and this is my pubxml: (there are some missing open tags since github formatting is weird)
xml version="1.0" encoding="utf-8"? Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> PropertyGroup> PublishDir>bin\x64\Debug\net8.0-android\publish\</PublishDir> PublishProtocol>FileSystem</PublishProtocol> RuntimeIdentifier>win10-x64</RuntimeIdentifier> Platform>x64</Platform> Configuration>Debug</Configuration> TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> PublishSingleFile>false</PublishSingleFile> PublishReadyToRun>false</PublishReadyToRun> SelfContained>True</SelfContained> PublishAppxPackage>true</PublishAppxPackage> AppxPackageDir>C:\Users\<username>\temp\Packages</AppxPackageDir> /PropertyGroup> /Project>
@ajsuydam What error do you get? The issue I have observed is that "dotnet run" does not accept any parameters and reverts to AnyCPU configuration. The winui build scripts then set the runtime identifier to win10-platform (I think platform is derived from the system you are currently running on). This worked in the past, but does not work anymore with .net 8 (it should set it to win-platform) unless you set the UseRidGraph parameter to true.
So the workaround I have found is to set the Platform parameter directly in the csproj to avoid the AnyCPU configuration. Of course, this is not viable if you want to build for other platforms as well.
@lhak Where are you running dotnet run
from? I get a myriad of errors depending on the answer to that question.
@ajsuydam I used "dotnet run" from the commandline
After MAUI now it's possible to build cross-platform GUI apps with .net. But when building apps with MAUI Blazor or MAUI Comet many people prefer vs code over vs 2022. With MAUI it is possible to build with dotnet cli for all the platforms except windows. Because building winui apps is not supported with cli. But why not? This is a great time to support it.
dotnet build -t:Run -f net6.0-windows