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

[BUG] Appx manifest not found or is invalid #74

Closed
gutisalex opened this issue Jan 10, 2022 · 21 comments · Fixed by #86
Closed

[BUG] Appx manifest not found or is invalid #74

gutisalex opened this issue Jan 10, 2022 · 21 comments · Fixed by #86
Assignees
Labels
bug Something isn't working fixed bug fixed not active issue not active

Comments

@gutisalex
Copy link

gutisalex commented Jan 10, 2022

ℹ️ Info

Version: 2.8.1

💬 Description

msix:create fails

ERROR: PRI191: 0x80004005 - Appx manifest not found or is invalid. Please ensure well-formed manifest file is present. Or specify an index name with /in switch.
An dieser Stelle sind keine Leerzeichen zugelassen.

📜 Pubspec.yaml

msix_config:
display_name: MyApp
publisher_display_name: MyApp
identity_name: de.myapp.togo
msix_version: 1.0.4.49
certificate_path: .\windows\runner\resources\windows_certificate.pfx
certificate_password: aPassword
publisher: CN=MyApp & Co. KG, O=MyApp & Co. KG, L=Hamburg, S=Hamburg, C=DE
logo_path: .\windows\runner\resources\app_icon.png
start_menu_icon_path: .\windows\runner\resources\app_icon.png
tile_icon_path: .\windows\runner\resources\app_icon.png
#vs_generated_images_folder_path: C:<PathToFolder>\Images
languages: de-de
icons_background_color: "#003976"
architecture: x64
capabilities: "internetClient"

@YehudaKremer
Copy link
Owner

hello @gutisalex

im trying to understand this error,
can you please paste here the full log, for example:

flutter pub run msix:create
✓ parsing cli arguments
✓ validating config values
✓ cleaning temporary files
✓ copying assets folder
✓ creating app icons folder
✓ generating icons
[some error.......]
✓ copying app icons
✓ copying VC libraries
✓ getting certificate publisher
✓ generate appx manifest
✓ generate PRI file
✓ packing
✓ cleaning temporary files
✓ installing certificate
✓ signing
❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚ 100%
Msix Installer Created...

also, if its okay can you send me the .msix file for debugging (only if its open source/public/not sensitive data..)

@YehudaKremer YehudaKremer added the bug Something isn't working label Jan 10, 2022
@YehudaKremer YehudaKremer self-assigned this Jan 10, 2022
@gutisalex
Copy link
Author

hey

I just reverted back to 2.0.0 and the problem still occured, its weird because it was working a month ago and I did not change the pfx neither the config in pubspec, anyway here a full log of msix:create with version 2.0:

flutter pub run msix:create
✓ parsing cli arguments
✓ validating config values                                                             
✓ cleaning temporary files                                                                 
✓ copying assets folder                                                                 
✓ creating app icons folder                                                              
✓ copying app icons                                                                  
✓ copying VC libraries
✓ getting certificate publisher                                                             
✓ generate appx manifest                                                                      
✓ generate PRI file                                                               
❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚ 71% packing..                         
Microsoft (R) MakeAppx Tool
Copyright (C) 2013 Microsoft.  All rights reserved.

Option /v specified, switching to verbose output.
Option /o specified, existing files will be overwritten.
Using default hash method: SHA256.
The path (/p) parameter is: "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release\myApp.msix"
The content directory (/d) parameter is: "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release"
Enumerating files from directory "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release"
Packing 33 file(s) in "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release" (content directory) to "\\?\C:\Users\user\Dev\myApp\build\windows\run
ner\Release\myApp.msix" (output file name).
Memory limit defaulting to 8470546432 bytes.
Using "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release\AppxManifest.xml" as the manifest for the package.
MakeAppx : error: Failure at appxFactory->CreateManifestReader(manifestStream, &manifestReader) - 0x80080204 - The specified package format is not valid: The package manifest is not valid.
Cleaning up output file "\\?\C:\Users\user\Dev\myApp\build\windows\runner\Release\myApp.msix".
MakeAppx : error: Failure at (CreatePackage( overwrite, hashAlgorithm, fileList, outputPath, manifestStream.Get(), forceCompressionNone, performanceOptions, encryptPackage, encryptionOptio
ns, cgmPath, mainPackagePathForResourceExemption, makepriExeFullPath)) - 0x80080204 - The specified package format is not valid: The package manifest is not valid.
MakeAppx : error: Package creation failed.

And here on 2.8.1 which is slightly different:

flutter pub run msix:create
✓ parsing cli arguments
✓ validating config values                                                               
✓ cleaning temporary files                                                                   
✓ copying assets folder                                                                   
✓ creating app icons folder                                                                
✓ generating icons                                                                     
✓ copying app icons
✓ copying VC libraries
✓ getting certificate publisher                                                               
✓ generate appx manifest                                                                        
❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚❚ 66% generate PRI file..                              
Microsoft (R) MakePRI Tool
Copyright (C) 2013 Microsoft. All rights reserved.


Usage:
------
    MakePri.exe new /pr <project root> /cf <config file> [options]

Example:
--------
    MakePri.exe new /pr C:\MyApp\src\ /cf C:\MyApp\priconfig.xml /mn
    C:\MyApp\AppXManifest.xml /of C:\MyApp\src\resources.pri /o

Description:
------------
    Creates a PRI file at [outputfile] by indexing all files in the
    [projectroot]and its subdirectories as directed by the [configxml]. The
    index will be assigned [indexname] to reference resources in the application

Required Parameters:
--------------------
    /ProjectRoot(pr)  : <FOLDERPATH> Root location of project files
    /ConfigXml(cf)    : <FILEPATH> Configuration file location. Use
                        'Makepri.exe createconfig' command to generate one

Options:
--------
    /OutputFile(of)   : <FILEPATH> Output location of PRI file, default is
                        [current directory]\resources.pri
    /Manifest(mn)     : <FILEPATH> Location of the application or component's
                        manifest. This parameter is ignored if [indexname]
                        is given. Default is [projectroot]\AppXManifest.xml
    /IndexName(in)    : <STRING> Name for the generated index of resources.
                        Typically matches the AppX package name, class library
                        simple name, etc. May be supplied via the
                        [manifest] parameter.
                        If IndexName is not specified and an AppX manifest
                        file is not present, the default name 'Application'
                        will be used.
    /VersionMajor(vma): <INTEGER> [Deprecated] Major version number for
                        index, default is 1
    /IndexLog(il)     : <FILEPATH> XML Log of indexed resources, no file
                        generated by default
    /AutoMerge(am)    : This flag is not recommended for normal use with AppX
                        packages. It causes Makepri.exe to set the auto
                        merge flag within the PRI file. Default is not set.
    /ReverseMap(rm)   : Generate a reverse mapping section in the PRI file
                        which can be used for debugging purposes.
    /MappingFile(mf)  : <MAPPINGFILETYPE> Generate a mapping file in the given
                        file format.
    /SchemaFile(sf)   : <FILEPATH> Output location of XML resource schema
                        description.
    /IndexOptions(io) : <OPTIONS> Options to provide detailed control over
                        behavior of resource indexers.
    /Overwrite(o)     : Overwrite an existing output file of the same name
                        without prompting
    /Verbose(v)       : Causes verbose messages to be output to the console
    /Help(h, ?)       : Display the usage help text
    /ExtensionDll(ex) : <FILEPATH> Location of the MRT environment extension
                        DLL. This DLL must be signed by a Microsoft-issued
                        certificate. Default is an empty path (no DLL
                        will be used).


    FOLDERPATH       - is a valid path to a folder
    FILEPATH         - is a path to a file, either relative to the current
                       directory or absolute
    MAPPINGFILETYPE  - Supported File type(s): 'AppX'



ERROR: PRI191: 0x80004005 - Appx manifest not found or is invalid. Please ensure well-formed manifest file is present. Or specify an index name with /in switch.
An dieser Stelle sind keine Leerzeichen zugelassen.


pub finished with exit code -1

Unfortanatly its not open source... all company related names have been replaced

@gutisalex gutisalex changed the title [BUG] Appx manifest not found or is invalid since update to 2.8.1 [BUG] Appx manifest not found or is invalid Jan 10, 2022
@YehudaKremer
Copy link
Owner

the problem is with the Ampersand('&') in the publisher value.
see microsoft/msix-packaging#342 (comment)

i will try to find a solution for this..

@gutisalex
Copy link
Author

ok thanks for the info... I tried to remove the ampersands in the pubspec for testing purposes but that did not do the trick... I guess the issue sits in the pfx file then?!

I checket out an older state of the application and for some reason it still works there. In that version I use an older dart sdk (sdk: ">=2.7.0 <3.0.0") than now (sdk: '>=2.12.0 <3.0.0') and msix version 2.0.0. Dont know if this could be related?! Just trying to provide as much info as possible.

If you need more let me know....

@YehudaKremer
Copy link
Owner

the latest version extract automatically the publisher from the pfx file
see https://github.com/YehudaKremer/msix/blob/main/CHANGELOG.md#254

you can try different certificate without Ampersand in the certificate Subject

@YehudaKremer
Copy link
Owner

I checket out an older state of the application and for some reason it still works there. In that version I use an older dart sdk (sdk: ">=2.7.0 <3.0.0") than now (sdk: '>=2.12.0 <3.0.0') and msix version 2.0.0. Dont know if this could be related?! Just trying to provide as much info as possible.

If you need more let me know....

thank you 👍 i will check it..

@gutisalex
Copy link
Author

ah ok, I get the certificate from the company I work with and the & is part of their brand name... I think I cannot change that!

@gutisalex
Copy link
Author

Ok I went through several of my commits and localized the one which broke msix to work... I found out eventhough I used msix 2.0.0 (it was declared like ^2.0.0, ^probably means it used the newest 2.x.x) it got updated in pubspec.lock from 2.3.1 to 2.6.2 and there it stopped working.

So now I use 2.3.1 and msix:create is working again... I hope it helps you to narrow down the issue?!

@YehudaKremer
Copy link
Owner

Very good thorough investigation 🥇
I will compare to 2.3.1

Thank you

@Baw-Appie
Copy link
Contributor

I have a same issue.
After downgrading to 2.1.3 the issue was resolved.

@Baw-Appie
Copy link
Contributor

This package uses certutil to automatically generate the publisher. but it doesn't handle special characters correctly.

certutil:

CN=Stella IT USA, LLC., O=Stella IT USA, LLC., S=Wyoming, C=US

But what I need:

CN=&quot;Stella IT USA, LLC.&quot;, O=&quot;Stella IT USA, LLC.&quot;, S=Wyoming, C=US

@alexmercerind
Copy link
Contributor

alexmercerind commented Feb 5, 2022

Oh I also just faced it. Seems HTML entities aren't being encoded properly in the manifest.

In my case, I had an ampersand in my package description.

YehudaKremer added a commit that referenced this issue Feb 5, 2022
@YehudaKremer YehudaKremer reopened this Feb 5, 2022
@YehudaKremer
Copy link
Owner

Hello guys

I publish new version (2.8.14) with @Baw-Appie fix,
and i added some additions to handle ampersand and other special characters.

Please try 2.8.14 to see if its works with your certificates, Thank You 👍

@khainke
Copy link

khainke commented Feb 7, 2022

Did you test this fix against whitespaces in publisher names?

Because exactly 2.8.13 is working for me, but at >= 2.8.14 its failing with

"Error: SignerSign() failed." (-2147024885/0x8007000b)

which is an indication for missmatched publisher name.
And my publisher name includes whitespaces, something like 'company GmbH'.

Otherwise, i would open another issue.

@YehudaKremer
Copy link
Owner

Hello

White space is not special character..

Can you please run it again (with >= 2.8.14) and paste here the content of \build\windows\runner\Release\AppxManifest.xml.
and also the original full Subject value of your certificate for comparation

thanks

@khainke
Copy link

khainke commented Feb 8, 2022

That's strange, i dont have a \build\windows\runner\Release\AppxManifest.xml, i don't rly know why, flutter doctor reports no problem, flutter build windowsdoes not, im on Flutter 2.10.0.

I will try and test it on a new created demo flutter project, maybe it's because my windows folder is too old / missconfigured. When the error persists, i will open a new issue.

@YehudaKremer
Copy link
Owner

sorry, my bad

the \build\windows\runner\Release\AppxManifest.xml file is delete after successfully creation of the msix file,
so if you got error its not delete.

BUT the sign step is after the deleting/cleaning step, so is deleted for you anyway

sorry again

@YehudaKremer
Copy link
Owner

What is your certificate Subject value?

@khainke
Copy link

khainke commented Feb 8, 2022

My subject value indeed includes an umlaut ST=Thüringen, encoding is utf-8 (utf8 = yes in config for csr):

emailAddress = [email protected],CN = company GmbH,O = company GmbH,L = Jena,ST = Th\C3\BCringen,C = DE

(i replaced my companies exact name)

YehudaKremer added a commit that referenced this issue Feb 11, 2022
@YehudaKremer
Copy link
Owner

Hello @khainke

A lot of digging but a simple fix, published in version 3.0.0-dev.8 please check it out

@khainke
Copy link

khainke commented Feb 11, 2022

Thank you, when running without -o nor -n option it works fine.

But when using the options -o and -n to specify the output path, i get an error:

RangeError (start): Invalid value: Not in inclusive range 0..48: -1
#0      RangeError.checkValidRange (dart:core/errors.dart:350:7)
#1      _StringBase.substring (dart:core-patch/string_patch.dart:400:27)
#2      Msix.create (package:msix/msix.dart:37:10)
<asynchronous suspension>
pub finished with exit code 255

(corresponding line tries to find /build/windows which is not in my designated output path, so maybe it has problems there?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed bug fixed not active issue not active
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants