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

publish failed with PublishSingleFile=true #13290

Closed
zhangchaoza opened this issue Feb 13, 2023 · 2 comments
Closed

publish failed with PublishSingleFile=true #13290

zhangchaoza opened this issue Feb 13, 2023 · 2 comments
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) external platform/windows 🪟 t/bug Something isn't working

Comments

@zhangchaoza
Copy link

Description

I created a app by using the default template and test if it can be packaged as a SingleFile by using PublishSingleFile=true. But i have trouble in publish command.

The command I used is dotnet publish -c release -p:WindowsPackageType=None --sc -f net7.0-windows10.0.19041.0 -p:PublishSingleFile=true MauiDemo.csproj

output:

MSBuild version 17.4.1+9a89d02ff for .NET
  正在确定要还原的项目…
  所有项目均是最新的,无法还原。
  MauiDemo -> C:\Users\zhangchao\Source\gitee\ZCStudio\LanguageLearning\CSharp\Net\UI\Maui\MauiDemo\bin\release\net7.0-windows10.0.19041.0\win10-x64\MauiDemo.dll
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(465,5): error MSB6006: “C:\Users\zhangchao\.nuget\packages\microsoft.netcore.app.crossgen2.win-x64\7.0.2\tools\crossgen2.exe”已退出,代码为 -
1073741819。 [C:\Users\zhangchao\Source\gitee\ZCStudio\LanguageLearning\CSharp\Net\UI\Maui\MauiDemo\MauiDemo.csproj::TargetFramework=net7.0-windows10.0.19041.0]
C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(353,5): error NETSDK1096: 程序集性能优化失败。可将失败的程序集排除在优化操作之外,或者将 PublishReadyToRun 属性设置为 false。 [C:\Users\zhangchao\Source\gitee\ZCStudio\Lan
guageLearning\CSharp\Net\UI\Maui\MauiDemo\MauiDemo.csproj::TargetFramework=net7.0-windows10.0.19041.0]

then i tried set PublishReadyToRun to false as the output recommend and publish command was executed successfully, but the exe crashed.

event:

[-](https://github.com/dotnet/maui/issues/new?assignees=&labels=t%2Fbug&template=bug-report.yml#) <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
[-](https://github.com/dotnet/maui/issues/new?assignees=&labels=t%2Fbug&template=bug-report.yml#) <System>
  <Provider Name="Application Error" Guid="{a0e9b465-b939-57d7-b27d-95d8e925ff57}" /> 
  <EventID>1000</EventID> 
  <Version>0</Version> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8000000000000000</Keywords> 
  <TimeCreated SystemTime="2023-02-13T03:00:59.4109211Z" /> 
  <EventRecordID>70630</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="3700" ThreadID="25464" /> 
  <Channel>Application</Channel> 
  <Computer>DESKTOP-QI1T7SG</Computer> 
  <Security UserID="S-1-5-21-3995134750-3331547773-3469137920-1001" /> 
  </System>
[-](https://github.com/dotnet/maui/issues/new?assignees=&labels=t%2Fbug&template=bug-report.yml#) <EventData>
  <Data Name="AppName">MauiDemo.exe</Data> 
  <Data Name="AppVersion">1.0.0.0</Data> 
  <Data Name="AppTimeStamp">638f9140</Data> 
  <Data Name="ModuleName">Microsoft.ui.xaml.dll</Data> 
  <Data Name="ModuleVersion">3.0.0.2211</Data> 
  <Data Name="ModuleTimeStamp">6a51b790</Data> 
  <Data Name="ExceptionCode">c000027b</Data> 
  <Data Name="FaultingOffset">00000000007cf04c</Data> 
  <Data Name="ProcessId">0x1630</Data> 
  <Data Name="ProcessCreationTime">0x1d93f57656e215f</Data> 
  <Data Name="AppPath">C:\Users\zhangchao\Source\gitee\ZCStudio\LanguageLearning\CSharp\Net\UI\Maui\MauiDemo\publish\UnPackage\MauiDemo.exe</Data> 
  <Data Name="ModulePath">C:\Users\zhangchao\Source\gitee\ZCStudio\LanguageLearning\CSharp\Net\UI\Maui\MauiDemo\publish\UnPackage\Microsoft.ui.xaml.dll</Data> 
  <Data Name="IntegratorReportId">127a6b4d-4f5c-4e23-af2d-c5ebe45fa7aa</Data> 
  <Data Name="PackageFullName" /> 
  <Data Name="PackageRelativeAppId" /> 
  </EventData>
  </Event>

Steps to Reproduce

  1. Create a new .Net MAUI application by using the default template
  2. dotnet publish -c release -p:WindowsPackageType=None --sc -f net7.0-windows10.0.19041.0 -p:PublishSingleFile=true MauiDemo.csproj
  3. publish command failed.
  4. dotnet publish -c release -p:WindowsPackageType=None --sc -f net7.0-windows10.0.19041.0 -p:PublishSingleFile=true -p:PublishReadyToRun=false MauiDemo.csproj
  5. app crashed

Link to public reproduction project repository

https://github.com/zhangchaoza/MauiReproduction

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

windows sdk 10.0.19041.0

Did you find any workaround?

no

Relevant log output

No response

@zhangchaoza zhangchaoza added the t/bug Something isn't working label Feb 13, 2023
@drasticactions
Copy link
Contributor

I believe this is a limitation of WinUI Packaged Applications.

  • You're trying to use "PublishSingleFile" on a packaged application. That doesn't work since the point of it is to be a "Packaged" MSIX application that you install. As MAUI uses Published WinUI apps as its default deployment system, it also won't work.
  • Unpackaged WinUI/MAUI apps are also, I believe, unsupported at the moment. You can see a task tracking that here (Windows Unpackaged support in .NET MAUI  #10564). Once this work is completed, you should be able to use PublishSingleFile for that.

@jsuarezruiz jsuarezruiz added the area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) label Feb 13, 2023
@zhangchaoza
Copy link
Author

I believe this is a limitation of WinUI Packaged Applications.

  • You're trying to use "PublishSingleFile" on a packaged application. That doesn't work since the point of it is to be a "Packaged" MSIX application that you install. As MAUI uses Published WinUI apps as its default deployment system, it also won't work.
  • Unpackaged WinUI/MAUI apps are also, I believe, unsupported at the moment. You can see a task tracking that here (Windows Unpackaged support in .NET MAUI  #10564). Once this work is completed, you should be able to use PublishSingleFile for that.

Thanks for your answer !

@PureWeen PureWeen closed this as not planned Won't fix, can't repro, duplicate, stale Feb 14, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) external platform/windows 🪟 t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants