[英]How can I reference an assembly generated in Visual Studio with NAnt (and make my app work)?
I'm having a problem for a few hours now, and I didn't manage to find a solution by searching the web: when I create a project in Visual Studio (C# 2010 express) with a .dll as the target, I can use it as a reference in other VS projects without problem, but when I try to reference it in a NAnt .build file, the build process works, but my app crash, telling me it can't load the assembly or one of its dependencies. 我现在有几个小时的问题了,我没有设法通过搜索网络找到解决方案:当我在Visual Studio (C#2010 express)中以.dll为目标创建项目时,可以可以毫无问题地将其用作其他VS项目中的引用,但是当我尝试在NAnt .build文件中引用它时,构建过程可以正常工作,但是我的应用程序崩溃,告诉我它无法加载程序集或其依赖项之一。
I think maybe it's looking for the basic assemblies like System
, System.Windows.Forms
, etc. that I use in my .dll, but I don't know why, and how to resolve this problem. 我认为也许正在寻找在.dll中使用的基本程序集,例如
System
, System.Windows.Forms
等,但我不知道为什么以及如何解决此问题。
Actually I never had to reference System
, System.Data
, etc. in NAnt .build files before, so I think I'm missing something... 实际上,我以前从来没有在NAnt .build文件中引用
System
, System.Data
等,所以我认为我缺少一些东西...
I'm initially a graphist so very new to C#, sorry :) 我最初是一位对C#还是一个新手的绘图员,对不起:)
Thanks, 谢谢,
Paul. 保罗
请检查您是否没有尝试从使用.net框架的较早版本构建的程序集中引用使用.net框架的较新版本构建的dll。
I actually found the answer by myself, very simple actually: I was referencing the library on C:\\\\myClass.dll
and I thought that it had to be at the same place to run the program, but it actually has to be in the same folder than the .exe file to be correctly referenced... I've got a lot of things to learn! 我实际上自己找到了答案,实际上非常简单:我在
C:\\\\myClass.dll
上引用该库,并且我认为它必须在同一位置运行该程序,但实际上必须在与正确引用.exe文件的文件夹相同...我要学习很多东西!
Actually my main problem is that at first I couldn't load the library in a 3rd party CG software (3dsmax), so I tried to use it in a "test" program and build it with NAnt and I thought it was the same issue that I had with NAnt but not at all, so it got me confused since I believed the problem was coming from VS building process while it was coming from 3dsmax. 实际上,我的主要问题是,起初我无法在第3方CG软件(3dsmax)中加载该库,所以我尝试在“测试”程序中使用它并使用NAnt进行构建,因此我认为这是同一个问题我曾经与NAnt一起使用过,但根本没有,所以让我感到困惑,因为我认为问题来自VS构建过程,而问题来自3dsmax。 Thank you guys for the help.
谢谢你们的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.