visual-studio-2008 - 通过 NAnt 与 Visual Studio 构建 - 缺少一个 dll

标签 visual-studio-2008 dll msbuild nant reference

我的解决方案包括这两个项目:

  • MyNamespace.Web.UI
  • MyNamespace.Web.Core

UI 引用 Core,而 Core 引用 Foobar.dll,除了我的库之外,它不存在于任何地方。当我从 Visual Studio 2008 构建时,Foobar.dll 按预期位于 UI 项目的 Bin 文件夹中。我已经确定它在构建之前不存在。

但是当我从 NAnt 构建时,它不存在,这会导致运行时异常。 NAnt 任务如下所示:

<target name="compile" depends="init">
    <exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
       commandline="${solution.file} /m /t:Clean /p:Configuration=${project.config} /v:q" workingdir="." />
    <exec program="${framework::get-framework-directory(framework::get-target-framework())}\msbuild.exe"
       commandline="${solution.file} /m /t:Rebuild /p:Configuration=${project.config} /v:q" workingdir="." />
</target>

在VS中我尝试过构建、重建、在 Release模式和 Debug模式下重建等等。它总是一样的。 Foobar.dll 位于 Bin 文件夹中。 NAnt 则不然。我还尝试从 NAnt 脚本中删除/m 开关。结果相同。

Core 中引用了其他几个 dll,而 UI 中没有引用,它们在 NAnt 构建后按预期出现在 Bin 中。

我的解决方法是在 UI 项目中引用 Foobar.dll,但这让我有点恶心。知道什么会导致这种情况吗?

(顺便说一句,Foobar.dll实际上是NHibernate.ProxyGenerators.CaSTLeDynamicProxy.dll)

最佳答案

您可能可以在 VS 中选择“复制本地”,这隐式地在构建之前将其复制到本地。您需要在 NAnt 中模拟这一点。

与为什么您可以从 Visual Studio 中为 Web 项目执行“发布”类似,但对于命令行,您必须构建然后将输出复制到您要去的任何地方。

关于visual-studio-2008 - 通过 NAnt 与 Visual Studio 构建 - 缺少一个 dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/270479/

相关文章:

c# - 全屏模式下的 Windows Mobile 应用程序

c# - 单击 CheckBoxList 上的项目时需要显示一些内容

unix - 主可执行文件 : how portable is it? 上的 dlopen()/dlsym()

msbuild - 异常消息 : TF270015: 'MSBuild.SonarQube.Runner.exe' returned an unexpected exit code. 预期 '0' ;实际 '-532462766'

c# - 确保控制台项目中的 app.config 复制到 Web 项目的 bin 文件夹

asp.net - 在 ASPX 页面的源 View 中复制和粘贴控件 : How to force VS not to touch my IDs?

google-chrome - 如何在 Windows 中为 Google Chrome 创建 PPAPI 插件?

python - 使用 ctypes 调用指向定义为静态的函数的函数指针

c++ - 如何在 BuildServer 上构建 VS2010 C++ 项目

c# - 用数组名称包装序列化数组元素