简体   繁体   English

如何在Visual Studio 2012中部署具有所有依赖项的C#项目

[英]How to Deploy c# project with all dependencies in visual studio 2012

I have created a small c# program in visual studio 2012, I used two external dll libraries. 我在Visual Studio 2012中创建了一个小型c#程序,我使用了两个外部dll库。 When I build the project for release, it creates the release file with a bunch of other files, including the external dll's I used. 当我构建要发布的项目时,它会与其他文件(包括我使用的外部dll)一起创建发布文件。 It works on my computer, but if I copy that whole release file to another computer it just gives me an error message and exits. 它可以在我的计算机上运行,​​但是如果我将整个发行文件复制到另一台计算机上,它只会给我一条错误消息并退出。 What else does the program need to run? 该程序还需要运行什么?

The error message is: 错误消息是:

The application was unable to start correctly(0x000007b). 应用程序无法正确启动(0x000007b)。 click OK to close the application. 单击确定关闭该应用程序。

I suspect that your error code is actually 0xC000007B (STATUS_INVALID_IMAGE_FORMAT), rather than 0x0000007B (INACCESSIBLE_BOOT_DEVICE). 我怀疑您的错误代码实际上是0xC000007B (STATUS_INVALID_IMAGE_FORMAT),而不是0x0000007B(INACCESSIBLE_BOOT_DEVICE)。 The former is common when your application encounters a runtime mixup between the 32 and 64 bit versions of a DLL. 当您的应用程序在DLL的32位和64位版本之间遇到运行时混合时,前者很常见。

What could be happening is that your application (say it's 32 bit) has a dependency on a certain DLL, call it FOO.DLL. 可能发生的情况是您的应用程序(例如32位)依赖于某个DLL,称为FOO.DLL。 When run on your local machine, you are picking up the correct version of the 32 bit version of FOO.DLL on your path. 在本地计算机上运行时,您将在路径上获得FOO.DLL的32位版本的正确版本。 But when you deploy to the other machine, you are picking up a 64 bit version from somewhere on the system path. 但是,当您部署到另一台计算机时,您将从系统路径上的某个位置获取64位版本。 The INVALID_IMAGE_FORMAT error is thrown when the loader finds a 64 bit DLL trying to be loaded into your 32 bit app. 当加载程序找到试图加载到32位应用程序中的64位DLL时,将引发INVALID_IMAGE_FORMAT错误。

One way to fix this is by identifying the DLL and redistributing the correct version with your application. 解决此问题的一种方法是,识别DLL并在您的应用程序中重新分发正确的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决使用 Visual Studio 将 C# 项目部署到 AX 2012 的错误? - How to solve Error to Deploy C# Project using Visual Studio to AX 2012? 如何在Visual Studio 2012 C#项目中使用SQLConfigDataSource - How to Use SQLConfigDataSource in a Visual Studio 2012 C# Project 如何部署Windows应用商店项目(Visual Studio Ultimate 2012) - How to deploy windows app store project (Visual Studio Ultimate 2012) 如何在Visual Studio 2010中使用SQL Server 2012数据库打包和部署C#桌面应用程序? - How to package and deploy a C# desktop application with a SQL Server 2012 database in Visual Studio 2010? 在Visual Studio 2012中是否为C#项目设置了“清理时扩展删除”设置? - Is there a setting for “Extensions to Delete on Clean” in Visual Studio 2012 for a C# project? Visual Studio 2012使用外部数据库发布项目C# - Visual studio 2012 publish project c# with external DataBase 将VB项目转换为C#Visual Studio 2012 - Convert a VB project to C# Visual Studio 2012 在 Visual Studio 2012 中的 C# 项目中更改文件完整路径 - Change file full path in a C# project in Visual studio 2012 Visual Studio 2012 C#:删除所有* CheckedListBox中的* Checked项目 - Visual Studio 2012 C#: Remove ALL *Checked Items in a CheckedListBox 重建全部失败,出现0个错误-Visual Studio 2012 C# - Rebuild All Failed with 0 errors - Visual studio 2012 C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM