简体   繁体   English

如何使用NAnt引用在Visual Studio中生成的程序集(并使我的应用程序正常工作)?

[英]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中使用的基本程序集,例如SystemSystem.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文件中引用SystemSystem.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.

相关问题 Visual Studio 2008和Nant,msbuild我们如何使用它进行自动化? Nant是否适用于vs2008? - Visual studio 2008 & nant , msbuild how we use this for automate? Is nant work for vs2008? 如何让我的Visual Studio看起来像这样? - How can I make my Visual Studio look like this? 如何在Visual Studio中抑制程序集引用警告? - How to suppress assembly reference warnings in Visual Studio? 如何在visual studio mac中添加对程序集的引用? - How to add reference to assembly in visual studio mac? 如何使用 Visual Studio 2017 创建参考程序集 - How to create a Reference Assembly with Visual Studio 2017 如何在没有 Visual Studio 的情况下引用程序集(* .dll)? - How to reference an assembly(*.dll) without visual studio? 如何在我的Visual Studio 2012项目中引用XML文件作为项目代码中的数据源? - How can I reference an XML file in my Visual Studio 2012 project as a data source in my project code? 如何使代码约定忽略特定的程序集引用? - How can I make Code Contracts ignore a specific assembly reference? 如何在我的 C# Visual Studio 项目中添加 VC++ DLL 作为参考? - How can I add a VC++ DLL as a reference in my C# Visual Studio project? 如何使 Visual Studio 中 Unity 的 C# 代码看起来/像教程中那样工作(图片) - How do I make my C# code for Unity in Visual Studio look/work like in the tutorial (picture)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM