Install VS2010 CRT into WinSxS

Back in VS2005 and VS2008, by default they generate manifest file to use side-by-side CRT which are installed into WinSxS. Probably Microsoft realized side-by-side CRT created as much problem as shared CRT, and people are already familiar with later and know how to avoid trouble (by placing a local copy), VS2010 stayed away from side-by-side CRT to back to central location, system32.

However, due to some reason I need to install VS2010 CRT in the side-by-side fashion, and this article helps a lot. Here are the steps outlined.

1. Run makecert.exe –r –len 2048 -sv test.pvk -n “CN=My Test” test.cer to generate test signing certificate.

2. Run pvk2pfx.exe -pvk test.pvk -spc test.cer -pfx test.pfx to get the .pfx file.

3. Run pktextract.exe test.cer to get publicKeyToken, it will be used in next step:

Certificate: “My Test” – 2048 bits long
        publicKeyToken=”bc5287e203d52b16

4. Copy atl100.dll, msvcr100.dll, msvcp100.dll, test.cer and test.pfx into same folder, create a file named vc2010.manifest with following content (note the publicKeyToken was copied from output above):

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”yes”?>
<assembly xmlns=”urn:schemas-microsoft-com:asm.v1″ manifestVersion=”1.0″>
    <noInheritable></noInheritable>
    <assemblyIdentity type=”win32″ name=”Microsoft.VC100.CRT” version=”10.0.40219.1″ processorArchitecture=”x86″ publicKeyToken=”bc5287e203d52b16“></assemblyIdentity>
    <file name=”atl100.dll” hashalg=”SHA1″ ></file>
    <file name=”msvcr100.dll” hashalg=”SHA1″ ></file>
    <file name=”msvcp100.dll” hashalg=”SHA1″ ></file>
</assembly>

5. Now run mt.exe -manifest vc2010.manifest -hashupdate –makecdfs to update manifest with SHA1 hash of these three files, it will also generate a vc2010.manifest.cdf which will be used to create category file in next step.

6. Run makecat.exe vc2010.manifest.cdf which will generate vc2010.cat, it is the category file which will be used to validate files during install.

7. Run signtool.exe sign /f test.pfx vc2010.cat to sign the category file.

8. Run VS2010 and create a Setup project, add atl100.dll, msvcr100.dll, msvcp100.dll, vc2010.cat and vc2010.manifest, build it and get the .msi file.

9. Open the .msi file with Orca. It is shipped with Windows SDK.

10. Go to File table, modify Component_ columns to make them have same value.

11. Go to Component table, delete all rows except the one has the same GUID as set in previous step.

12. Go to FeatureComponents table and do the same.

13. Go to MsiAssembly table, add a new row with following values:

Component_ the value from column Component column in File table
Feature_ DefaultFeature
File_Manifest the value from File table, File column of the row for vc2010.manifest
File_Application leave it empty
Attribute 1

14. Go to MsiAssemblyName table, add 5 new rows, Component_ should be taken from Component column from File table, the name and value columns of these 5 rows should be taken from assemblyIdentity attribue in vs2010.manifest file:

Name Value
type win32
name Microsoft.VC100.CRT
version 10.0.40219.1
processorArchitecture x86
publicKeyToken bc5287e203d52b16

15. Go to AdvtExecuteSequence table, remove the row of MsiUnpublishAssemblies.

16. Use menu Tools | Validate to run a Full Msi Validation Suite check to make sure there is no error.

Now you can use the .msi to install VS2010 CRT into WinSxS. The client application needs to have dependency manifest:

<assembly xmlns=”urn:schemas-microsoft-com:asm.v1″ manifestVersion=”1.0″>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type=”win32″ name=”Microsoft.VC100.CRT” version=”10.0.40219.1″ processorArchitecture=”x86″ publicKeyToken=”bc5287e203d52b16″></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>

Advertisements

Posted on November 1, 2012, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: