Open mattleibow opened 7 months ago
I'm trying to publish a Packaged app with WindowsAppSDKSelfContained=true
to avoid users needing to install the .NET 8 runtime separately. I've tried all the steps in your post @mattleibow to workaround this issue but I actually end up with this result:
C:\Users\runneradmin\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.Build.Msix.Packaging.targets(354,5): warning : Path to `mspdbcmf.exe` could not be found. A symbols package will not be generated. Review https://aka.ms/windowsappsdkdocs and ensure that all prerequisites for Windows App SDK development have been installed. [D:\a\Catlists\Catlists\src\Catlists\Catlists.csproj::TargetFramework=net8.0-windows10.0.19041.0]
MakeAppx : error : Manifest validation error: Line 29, Column 27, Reason: The file name "Catlists.exe" declared for element "*[local-name()='Applications']/*[local-name()='Application']" doesn't exist in the package. [D:\a\Catlists\Catlists\src\Catlists\Catlists.csproj::TargetFramework=net8.0-windows10.0.19041.0]
MakeAppx : error : Package creation failed. [D:\a\Catlists\Catlists\src\Catlists\Catlists.csproj::TargetFramework=net8.0-windows10.0.19041.0]
MakeAppx : error : 0x[80](https://github.com/BurkusCat/Catlists/actions/runs/7439263733/job/20238950717#step:9:81)080204 - The specified package format is not valid: The package manifest is not valid. [D:\a\Catlists\Catlists\src\Catlists\Catlists.csproj::TargetFramework=net8.0-windows10.0.19041.0]
Error: Process completed with exit code 1.
Hi, I have a net 8 MAUI app that include a cspoj of a library.
I have tried to add to both project (I also have tried a mix of options)
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' and '$(RuntimeIdentifierOverride)' != ''">
<RuntimeIdentifier>$(RuntimeIdentifierOverride)</RuntimeIdentifier>
</PropertyGroup>
<Target Name="WindowsAppSDKSelfContainedVerifyConfiguration"></Target>
<WindowsPackageType Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">None</WindowsPackageType>
<WindowsAppSDKSelfContained>True</WindowsAppSDKSelfContained>
<PublishSingleFile>True</PublishSingleFile>
<SelfContained>True</SelfContained>
to try to create a single EXE of my application.
I used this command:
dotnet publish -f:net8.0-windows10.0.19041.0 -p:WindowsPackageType=None -p:SelfContained=true -p:WindowsAppSDKSelfContained=true -p:RuntimeIdentifierOvveride=win-x64
but I always get this error (LibMobile is the library project):
C:\Users\pozzy\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: The "GenerateAppManifestFromAppx" task failed unexpectedly. [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\pozzy\Documents\Progetti\LibMobile\obj\Release\net8.0-windows10.0.19041.0\MsixContent\AppxManifest.xml'. [C:\Users\pozzy\Doc
uments\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.cs
proj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable
1 unixCreateMode) [C:\Users\p
ozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode) [C:\Users\pozzy
\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable
1 unixCreateMode) [C:\U
sers\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windo
ws10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlTextReaderImpl.OpenUrl() [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlTextReaderImpl.Read() [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlDocument.Load(XmlReader reader) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at System.Xml.XmlDocument.Load(String filename) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at InlineCode.GenerateAppManifestFromAppx.Execute() [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0
]
C:\Users\pozzy.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.WindowsAppSDK.SelfContained.targets(198,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToEx
ecuteTask) [C:\Users\pozzy\Documents\Progetti\LibMobile\LibMobile.csproj::TargetFramework=net8.0-windows10.0.19041.0]
`
Setting <WindowsAppSDKSelfContained>True</WindowsAppSDKSelfContained>
still fails with error MSB4018: The "GenerateAppManifestFromAppx" task failed unexpectedly.
. @mattleibow have you found a workaround?
This also happens when setting Platform to anything other than x64 for me... I need multi platform support on this here, otherwise this is a mess to work with...
@anpin only workaround I know is described in https://github.com/dotnet/maui/issues/9064#issuecomment-1685883983
I had this problem also in .NET 7.. Somehow the AppxManifest.xml file won't be generated if you use the -p:WindowsAppSDKSelfContained=true flag in a multi-project solution. The workaround is to publish without the parameter first, this will create the File in your main project under
/obj/Release/net8.0-windowsxxxxx/win10-x64/MsixContent/
Then you need to manually copy it into the other projects under /obj/Release/net8.0-windowsxxxxx/win10-x64/ in an "MsixContent" folder (you have to create it). Then run with your full publish command using the
-p:WindowsAppSDKSelfContained=true
I really don't know whats causing this..but the WindowsAppSDKSelfContained param surely is somehow guilty and the fact that it only occurs only multi-project solutions.
Describe the bug
I have a maui app which has a maui library. When I publish the app:
I get this error: https://github.com/microsoft/WindowsAppSDK/issues/3337
I fixed this by adding the RID to the csproj:
Now I can pass
-p:RuntimeIdentifierOverride=win10-x64
instead:I still get this error:
I partially worked around this by doing this: https://github.com/microsoft/WindowsAppSDK/issues/2684 and adding this to my
DirectoryBuild.targets
:Now I get another error:
I can work around this by adding this to my csproj:
I have worked around this in .NET maui by making all unpackaged apps be WindowsAppSDKSelfContained by default, but MSIX apps still need to do this sometimes.
Steps to reproduce the bug
dotnet publish -f net8.0-windows10.0.19041.0 -c Release -r win10-x64 -p:WindowsAppSDKSelfContained=true -p:SelfContained=true
Expected behavior
Publish works
Screenshots
No response
NuGet package version
Windows App SDK 1.4.3: 1.4.231115000
Packaging type
Packaged (MSIX), Unpackaged
Windows version
No response
IDE
Other
Additional context
No response