开发者

How do I deploy the Visual C++ Runtime 2010 in the bin library of a web application?

I am trying to deploy a web project that uses a specific library (in this case Chilkat) to a web host (appharbor.com). The problem is the library needs the Visual Studio C++ 2010 runtime (http://www.cknotes.com/?p=311). My question is how do I deploy that runtime correctly?

1. Choice of deployment method

On my local development machine the runtime is installed but I only have git push access to the hosting environment.

Based on MSDN there are three options to deploying the runtime:

  1. Use the redistributable package (recommended)
  2. Use Merge Modules (requires administrative rights)
  3. Deploy with the application

Option 3 is the only one I can do with this host since I don't have administrative access to the server.

2. Determining which dlls should be deployed

The MSDN page states that the dlls should be in "Program Files\Microsoft Visual Studio 10.0\VC\Redist". In my case the Redist directory does not exist at that location (running on 64-bit, so I checked both "Program Files" and "Program Files (x86)").

I unzipped the redistributable package and the vs_red.cab inside that to find a list of dlls that are contained: - atl100 - mfc100 (+ language variants) - mfc100u - msvcp100 - msvcr100 - vcomp100 - msdia71

At t开发者_C百科he same time I checked the library in reflector to see what is was referencing: - Microsoft.VisualC (.net) - KERNEL32.dll (native) - MSVCR100.dll (native) - ... and one mysterious library without a name. Shows up as module with empty text.

Side note: the chilkat library used here is available in x64 and x86 versions. I performed these tasks with the x86 only because the target system seems to be x86. (Deploying x64 leads to a "An attempt was made to load a program with an incorrect format." error.)

3. Finding the dlls to deploy

The dlls in the unzipped vc_red.cab where named incorrectly so I decided to find the dlls on the hard disk. Searching for atl100 revealed three location: system32, syswow64 and as part of an application directory.

All files mentioned above were in system32 except: - msdia71 (native) - This has to do with debugging and is not on my disk at all, so I'm assuming it is not needed. - Microsoft.VisualC (.net) - Found this in GAC in the correct version (10.x).

(I did not copy KERNEL32.dll because this is a Windows built-in library.)

4. Adding libraries to project

The VisualC .net library was added as a reference. The native libraries were added to the root of my web application and properties set to "Build Action: Content" and "Copy to Output: Always". Once built the dlls appeared next to the .net libraries in the bin folder as expected.

But when I deploy and run I get the error message: Could not load file or assembly '' or one of its dependencies. The specified module could not be found.

You can see the build output of the project here and I can observe that the dlls I think are required are being copied to the output directory, but still there a mistake somewhere. Anybody have an idea? Or a better approach at debugging this? Or am I doing something stupid :)?


Some options I see:

  • contact hoster support to install VC++ on the server
  • contact Chilkat support
  • deploy on a local server and turn on Fusion (http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.80).aspx)


You can add the dlls to the root project. Then, click on each dll -> click properties -> set 'Build Action': Content, and set 'copy to output Directory': Copy Always.

Now build, and check your bin. dlls are there.

I used this way as adding to references as existing items and browsing the dlls gave some errors that cannot load dll.

I liked to group the dlls in a folder and then have them in bin with no parent folder, but could not get to that yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜