简体   繁体   English

设置要在Visual Studio 2013中发布的项目

[英]Setting up a project for release in visual studio 2013

I'm working on a C# project that is nearing release. 我正在开发一个即将发布的C#项目。 As part of this, I have started building the project and testing it on another machine. 作为其中的一部分,我已经开始构建项目并在另一台机器上进行测试。 This has revealed some odd problems. 这揭示了一些奇怪的问题。 My biggest concern, though, is that my project is failing to run. 不过,我最大的担心是我的项目无法运行。 I can do some basic things, but when I try to use my projects primary functionality it crashes. 我可以做一些基本的事情,但是当我尝试使用项目的主要功能时,它就会崩溃。 Using Visual Studio, I was able to determine the exception that was causing the crash. 使用Visual Studio,我能够确定导致崩溃的异常。

Essentially, I'm getting a FileNotFoundException on the dll that contains most of my project's functional code. 本质上,我在包含我项目大部分功能代码的dll上收到FileNotFoundException。 I'm not sure if I've made an error in adding the dll to my project, or if there's a problem in one of the files in the dll. 我不确定在将dll添加到项目中是否出错,或者dll中的文件之一是否存在问题。

The dll was added as a reference using the Project -> Add Reerences feature of the user interface. 使用用户界面的“ 项目” ->“ 添加内容”功能将dll添加为参考。

The dll contains three files which contain absolute file paths (these are for #import statements). 该dll包含三个包含绝对文件路径的文件(这些文件用于#import语句)。 Example follows. 示例如下。

#import "C:\Users\Me\Documents\Projects\MyProject\Delegates\bin\MyDelegate.tlb" raw_interfaces_only

My hang up is I'm not exactly sure what I'm doing wrong here. 我的挂断电话是我不确定自己在做什么错。 I suspect that those import statements are causing problems, but I'm not exactly sure how to fix them if they in fact are the problem. 我怀疑这些导入语句会引起问题,但是如果它们确实是问题,我不确定如何解决它们。 This is my first c#/c++ project so any help would be appreciated. 这是我的第一个c#/ c ++项目,因此将不胜感激。

Adding the dll as a reference DOES NOT include the dll with your project--you are simply telling your project to use the library for your code. 将dll添加为参考不会将dll包含在您的项目中-您只是在告诉您的项目将库用于代码。 The dll will need to be installed on all computers that run your application, for your application to use the dll. 该dll将需要安装在运行您的应用程序的所有计算机上,以便您的应用程序使用该dll。

If the dll also uses three files (as you specified), then those files must also be included, and be installed in the expected path. 如果dll也使用三个文件(如您指定的),则这些文件也必须包括在内,并安装在预期的路径中。

Presuming you have redistribution rights on the dll you mention, you can include the dll in your project. 假设您对提到的dll具有重新分发权,则可以在项目中包含该dll。 Be sure to set the "copy" property as "copy always" or "copy if newer" and change the reference to use the copy that ends up in you bin folder. 确保将“复制”属性设置为“始终复制”或“如果更新则复制”,并更改引用以使用最终位于bin文件夹中的副本。 Then you only need to be sure to include that dll and install it in the same folder as your application. 然后,您只需要确保包含该dll并将其安装在与您的应用程序相同的文件夹中即可。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM