Installing applications using Microsoft runtime .dll's

From Yggenyk
Revision as of 17:47, 10 March 2012 by WikiSysop (talk | contribs) (→‎Run time dependencies)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Run time dependencies

The examples here assumes you dependt on Microsoft.VC80.CRT version 8.0.50727.4053 but the situation is similar for other dependencies.
Windows caches the dependencies in C:\Windows\winsxs\ManifestCache, this is important to know when developing since once an exe has correctly located it's dependencies, it will continue to find them in the cache, until the exe is renamed, or moved to another folder. Therefor it is best to test your applications dependencies on a clean machine. This is easy under VmWare where you can continue to restore a snapshot.

Side By Side error

If you build an application that uses native .dll's that uses Microsoft Visual C++ runtime .dll's you need to install these runtime .dll's together with your application, or you will get errors like these:


SideBySide error dialog.png


In the event log, there is an Event 33, SideBySide error.

Activation context generation failed for "C:\Release\NativeManifestTest.exe". Dependent Assembly Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053" could not be found. Please use sxstrace.exe for detailed diagnosis.

If you start the application from Microsoft Visual Studio, you can get the error:

Error while trying to run project: Unable to start program 'C:\dev\mickey\NativeManifestTest\NativeManifestTest\bin\Release\NativeManifestTest.exe'.
This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.

WinSxs Tracing Utility

SxsTrace.exe is an application that traces why an executeable can't find it's dependencies. Usage: SxsTrace [Options]
Options:

Trace -logfile:FileName [-nostop]
Enabling tracing for sxs.
Tracing log is saved to FileName.
If -nostop is specified, will not prompt to stop tracing.
Parse -logfile:FileName -outfile:ParsedFile [-filter:AppName]
Translate the raw trace file into a human readable format and save the result to ParsedFile.
Use -filter option to filter the output.
Stoptrace
Stop the trace if it is not stopped before.

Example: SxsTrace Trace -logfile:SxsTrace.etl

SxsTrace Parse -logfile:SxsTrace.etl -outfile:SxsTrace.txt

Assembly Searching Sequence

Ways to distribute the dependencies

Installing copy in local folder

Create a sub folder called Microsoft.VC80.CRT in same folder where the .exe filel is located. Place following 4 files in the Microsoft.VC80.CRT folder

  1. Microsoft.VC80.CRT.manifest
  2. msvcm80.dll
  3. msvcp80.dll
  4. msvcr80.dll

The files can be downloaded here:

Embed manifest, and add merge module to installation of Managed (.NET) application

  1. Add the corrosponding merge module to your installer as prerequisite.
  2. Right click on the project, and selece Add - New item...
  3. Under General select Application Manifest File
  4. On the project's properties Application tab, under Resources, select Manifest: app.manifest' instead of Embed manifest with default settings.
  5. Add following this to app.manifest:
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.4053" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>

Installing runtime modules using standalone installers

This has the drawback, that if done as prerequisite in installer, it will be uninstalled, when application is uninstalled. Other applications installed later also depending on the runtime modules will stop working when your application is uninstalled.

<google>ENGELSK</google>

id=siteTree