Forum Discussion
Private SxS Components (registration-free COM)
My normal procmon trace excludes the csrss process, so I hadn't noticed it's involvement. Perhaps that will prove important.
I guess I will have to just update the CI pipeline to use different manifests for MSI versus MSIX, and register the offending components in the VREG for the latter (I've quickly proven this out by hand and it works fine for my case). Not ideal, but it works.
- Jun 27, 2022
JDHIntercede Sounds like the right approach.
I'm running into this in trying to repackage existing MSIs into MSIX. Can you describe how to tell if the manifest is for registration-free COM? A sample manifest would go a long way to help me understand this.
- Jun 29, 2022
JDHIntercede Regarding csrss...
This is a session process. It will only attempt to read an external manifest file from a folder once during the life of the user session. I am seeing it successfully read the manifest file from the MSIX package during that first run. Subsequent launches don't look for the file again.
This doesn't explain the problem or eliminate the problem. I just want to make sure you didn't jump to incorrect conclusions.
- JDHIntercedeJun 30, 2022Brass Contributor
That explains the behaviour I saw when I put the DLLs into the real file-system where csrss was looking for them (it worked and then continued to work after I deleted them - confused me for a little while that one did!). Possibly also indicates that while csrss is reading the referenced dependency manifests from the real file-system, the application itself is able to find the DLLs inside the VFS (otherwise I'd assume it would have stopped working after deleting the files from the real FS).
- JDHIntercedeJun 27, 2022Brass Contributor
It pretty-much comes down to the elements inside it.
You can extract a manifest using mt.exe (https://docs.microsoft.com/en-us/windows/win32/sbscs/mt-exe) with the following:
mt.exe -inputresource:TheApplication.exe;#1 -out:extracted.manifest
If you open up the file you extracted, you're looking for elements like <comClass>, <typelib>, <comInterfaceExternalProxyStub> (docs https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests schema is https://docs.microsoft.com/en-us/windows/win32/sbscs/manifest-file-schema).
I've found that registrations directly inside the application manifest (i.e. the manifest in the application executable) seem to work fine. The issue comes about when the manifest is referencing external manifests, even if these are private and in the same folder. To identify this kind of thing, look for something like:
<dependency> <dependentAssembly> <assemblyIdentity name="SomeComponent" version="1.2.3.4" publicKeyToken="00000a0000cb0d0c" processorArchitecture="x86"/> </dependentAssembly> </dependency>
These entries are saying I depend on 'SomeComponent' with the identity specified, and the loader will look first in the GAC, then in the current directory for a DLL/manifest with the same name (this is the bit that's not respecting the VFS in MSIX), then, if not found, in a subdirectory with the same name. Side note: regardless of MSIX, if it finds a DLL with the same name, but without an embedded manifest, before it finds a standalone manifest file, it will fail - this can cause problems where the manifest file is standalone rather than embedded, as the loader stops looking after the failure even if the manifest exists.
- Jun 27, 2022
JDHIntercede Yeah, I've been digging into this a little.
I am fairly sure that you should be able to use the components with either internal or external application and component manifests in your MSIX package AS IS.
The trick will be to add the com registration directly into the AppXManifest. This, in essence, it the modern way to advertise the com components, whether or not they originally were registration-free or registered in the registry. It allows for side-by-side deployment in the package, but the installation of the MSIX package writes the registration from the AppXManifest into a new per-package location in the registry to make things easy to clean up.