Windows Azure 找不到 C++/CLI 项目的 DLL [英] Windows Azure not finding DLL of C++/CLI project

查看:31
本文介绍了Windows Azure 找不到 C++/CLI 项目的 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含非托管 C 压缩库的 C++/CLI 项目,并且该项目被调用 C++ 压缩函数的 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:

无法加载文件或程序集LZGEncoder.DLL"或其依赖项之一.找不到指定的模块.

为什么找不到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 Redistributable 包添加到项目中,以及在启动时静默安装它的脚本,现在本机 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) 下载 Visual C++ 2010 Redistributable Package,并将其添加到您的项目中.

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>  

更新:
Visual C++ 2012 已经发布,同样的脚本也可以运行,尽管每个人都应该确保 Azure 至少运行 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆