问题描述
我有一个周围托管C COM pression库包装了一个C ++ / CLI的项目,而这个项目是由调用C ++的COM preSS功能的MVC3项目中引用。
I have a C++/CLI project that wraps around an unmanaged C compression library, and this project is referenced by an MVC3 project that calls the C++ Compress function.
一切工作正常当地,但是当我发布的解决Azure云,我得到一个错误说,它无法找到该模块/ DLL:
Everything works fine locally, but when I publish the solution to the Azure cloud, I get an error saying it could not find the module/dll:
无法加载文件或程序集LZGEn coder.DLL'或它的一个依赖。指定的模块找不到。的
Could not load file or assembly 'LZGEncoder.DLL' or one of its dependencies. The specified module could not be found.
为什么不能找到它的DLL文件?它是将错误的地方或者在所有被编译?有什么办法,我可以检查?谢谢!
Why can't it find the DLL file? is it going to the wrong place or being compiled at all? Is there any way I can check? Thanks!
推荐答案
的问题是,在Visual C ++ 2010运行时库从云身边缺少的。
The problem was that the Visual C++ 2010 Runtime libraries were missing from the cloud side.
我所做的是在Visual C ++ 2010可再发行组件添加到项目中,与脚本一起静默安装在启动时,现在本地的dll的工作。您还需要这个,如果你使用的是原生的C DLL的。
What I did was add the Visual C++ 2010 Redistributable package to the project, along with a script to silently install it at start up, and now the native dll's work. You also need this if you're using native C dll's.
步骤:
1) ,并把它添加到您的项目。
1) Download Visual C++ 2010 Redistributable Package, and add it to your project.
2)创建一个新的批处理文件,这添加到它:结果 vcredist_x64.exe / Q / norestart更新日志文件结果
退出/ B 0
2) Create a new batch file and add this to it:vcredist_x64.exe /q /norestart
exit /b 0
3)打开 ServiceDefinition.csdef中的文件和相关WebRole元素补充一点:
3) Open the ServiceDefinition.csdef file and add this under the relevant WebRole element:
<Startup>
<Task commandLine="InstallVCRedist.bat" executionContext="elevated" taskType="simple" />
</Startup>
更新:结果
是出相同的脚本作品,虽然每个人都应该确保Azure是ATLEAST运行Windows Server 2008的 R2 ,否则在启动任务将挂起和作用将不会开始(直到你通过RDP任务管理器杀vcredist进程)。
UPDATE:
Visual C++ 2012 is out and the same script works, though everyone should make sure Azure is running atleast Windows Server 2008 R2, otherwise the start-up task will hang and the role will never start (until you kill the vcredist process in the task manager via RDP).
这篇关于Windows Azure中找不到C ++ / CLI项目的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!