|
Hi all,
I have solution containing both C# and C++ projects. Some of the assemblies created by these projects reference native assemblies that are installed in the C:\Windows\WinSxS folder. In order to specify which version of a native assembly to load the .exe file of the application contains an application manifest like this:
<?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Test1" version="1.0.0.0" processorArchitecture="x86" publicKeyToken="<public key token>"></assemblyIdentity> </dependentAssembly> </dependency> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Test2" version="1.0.0.0" processorArchitecture="x86" publicKeyToken="<public key token>"></assemblyIdentity> </dependentAssembly> </dependency> </asmv1:assembly>
The native assemblies Test1 and Test2 consist of multiple dlls and config files and are, as mentioned above, installed in the WinSxS folder. When I run the .exe file containing the above (embedded) application manifest everything works just fine, i.e. the application starts as expected and dlls are successfully loaded from the WinSxS folder (verified with Process Explorer).
Now I would like to use NGen to create native assemblies for my application. The problem is that NGen seems to ignore this embedded application manifest. I'm assuming this because NGen throws warnings that modules used by some of the .NET assemblies cannot be found:
Warning: System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E) while resolving 0x1000027 - <Name of assembly that references native assembly "Test1" or "Test2".
It doesn't matter whether I compile the application manifest into the .exe file (using the project properties of the project that creates the .exe file (in Visual Studio 2008)) or have it as a separate file (<name>.exe.manifest).
Of course it is also possible to include a manifest into each assembly that references a native assembly (Test1 or Test2). But actually I prefer having a list of all required native assemblies in the .exe file.
Does anyone know why NGen.exe ignores my application manifest? Can this behaviour be changed (command line switches, etc.)?
The application runs fine, it's only NGen that's causing headache.
Thanks!
|