C Sharp
2 TopicsHow does "com4:ManagedInProcessServer" work under a MSIX packaging scenario?
I'm trying to create a MSIX package for a classic Windows desktop app. The app is written in C# (.NET Framework 4.7.2), and it's running perfectly both before and after packaging. The problem is that the app exposes a COM class library (also written in C#) for interop with other apps. The original installer of this app registers the COM library with "regasm.exe". Given that MSIX have the ability to expose COM servers, namely with the "windows.comServer" extension, I've tried adding the following extension to package manifest, but it does not work as intended: <com:Extension Category="windows.comServer"> <com:ComServer> <com:SurrogateServer DisplayName="TheApp Class Library"> <com:Class Id="8ae249dd-05f8-403e-ac32-00feab49c1f5" Path="TheApp.Library.dll" ThreadingModel="STA" /> </com:SurrogateServer> </com:ComServer> </com:Extension> After some research I've found that C# COM libraries registers differently with normal ones; namely it requires a few more entries than DLL path and CLSID written into the registry. Digging through the documents, I've found that https://learn.microsoft.com/en-us/uwp/schemas/appxpackage/uapmanifestschema/element-com4-managedinprocessserver seems to be just what I needed. So I've tried to use the following extension instead: <com4:Extension Category="windows.comServer"> <com4:ComServer> <com4:ManagedInProcessServer Assembly="TheApp.Library, Version=1.0.0.0, Culture=neutral" RuntimeVersion="v4.0.30319"> <com4:Class Id="8ae249dd-05f8-403e-ac32-00feab49c1f5" ImplementationClass="TheApp.Library.ExtensionManager" ThreadingModel="STA" Virtualization="disabled" /> </com4:ManagedInProcessServer> </com4:ComServer> </com4:Extension> But it still does not work. In fact, this time even the "HKEY_CLASSES_ROOT\CLSID\{...}" registry entries do not get generated. I've checked the https://learn.microsoft.com/en-us/windows/win32/appxpkg/troubleshooting#get-diagnostic-information and no error has ever occurred during package installation. It is as if the extension declaration is not there. What confuses me more is that "com4:ManagedInProcessServer" does not allow specifying codebase for the assembly. With "regasm.exe" one can specify the full path to COM library with "/codebase", but "com4:ManagedInProcessServer" does not seem to be allowing this. I've been looking for relevant information for quite some time, but all I could find is the single document page on XML schema (linked above), with no real-world code examples. (And by "no" I mean literally ZERO code example on Internet.) I would like to know if "com4:ManagedInProcessServer" works under the situation described above, and if not so, what should I do to have a C# COM library exposed by a MSIX package? If it matters, I'm using the latest version of Visual Studio Community 2022 with SDK version 10.0.22621.0. The MSIX package is to be deployed on a Windows 11 23H2 system.856Views0likes1CommentAttempting to install a created App Package fails with error code 0x8000FFFF among other issues.
After creating an App Package from a WinUI 3 project, attempting to install it using the created .msix file results in the error code: 0x8000FFFF. Installing the application using "Install.ps1" and enabling developer mode works but is not reasonable for end users. Also, when setting "Create App Bundle" to "Never", an "Index.html" file and subsequent .appinstaller file are never created even though the output window specifies that it has. Furthermore, if automatic updates were selected and "Copy and Close" is selected, the files are never copied even though the output window again specifies that the operation succeeded. This is the error that I get: App installation failed with error message: Deployment Add operation with target volume C: on Package ID_OF_MY_APP_1.0.0.0_x64__wtta9nmxf3nwp from: (NAME_OF_MY_APP_1.0.0.0_x64.msix) failed with error 0x8000FFFF. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x8000ffff) This is the process I'm going through: Create a new WinUI 3 C# project using "Template Studio for WinUI (C#)" Right click on the project and select "Package and Publish" => "Create App Packages..." Select "Enable Automatic Updates" Select "Always" under "Generate app bundle:" Set a local folder on your computer as the "Installer Location:" Create the app and select "Copy and Close". Navigate to the location listed. Observe that there is no "index.html" or .appinstaller file created. Attempt to install the .msix file. Observe error 0x8000FFFF. Navigate to the Installer location. Observe that the folder is empty. Is this a known issue? If so, is there a workaround? I'm trying to distribute the app I've made but the only way I've been able to do so using MSIX is the PowerShell script and enabling developer mode which is no good for end users.Solved4.6KViews0likes3Comments