views:

904

answers:

1

I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file.

I followed the steps outlined in http://msdn.microsoft.com/en-us/library/ms235291.aspx section "Deploying Visual C++ library DLLs as private assemblies" but instead of using an external manifest file (i.e. Microsoft.VC90.CRT.manifest) I'd like to embed it in the DLLs somehow.

If I embed Microsoft.VC90.CRT.manifest into msvcr90.dll or the DLL loading it, and remove the external manifest file, LoadLibrary() fails.

The problem is when you embed the manifest into a DLL it actually embeds the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false">
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.DebugCRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b">
    </dependentAssembly>
  </dependency>
</assembly>

I think the <dependentAssembly> line is what's causing it to die if the manifest file is missing. Any ideas?

+1  A: 

Add the following to the preprocessor definitions:

_CRT_NOFORCE_MANIFEST
Roger Lipscombe