1
我爲包含位於lib文件夾內的多個第三方庫的項目創建bild文件。所以,我的構建腳本是這樣的:在子目錄中使用nant和參考庫構建
<csc target="library" ....>
<sources>
<include name="**/*.cs" />
<!-- common assembly-level attributes -->
<include name="../../src/CommonAssemblyInfo.cs" />
<exclude name="Properties/AssemblyInfo.cs" />
</sources>
<references>
<include name="${build.dir}/bin/lib/Should.Fluent.dll" />
</references>
</csc>
編譯運行正常,然而,運行時不工作,說,它不能找到庫Should.Fluent.dll。我怎樣才能讓程序找到它?
你告訴我,從你的應用程序或GAC之外的其他目錄運行dll是不可能的?因爲我已經閱讀了一個/ lib-switch到csc.exe,告訴程序在哪裏搜索dll。 – Alxandr
此開關僅在編譯期間有效,在運行時不做任何事情。但是,MSBuild會自動將您的引用複製到輸出目錄,因此大多數開發人員不會注意到這一點。你可以勾選['AppDomain.CurrentDomain.AssemblyResolve'](http://stackoverflow.com/questions/5260404/resolve-assembly-references-from-other-other-folder)來改變這一點,但我不會推薦它。 – skolima
我明白了。那麼,我猜我必須將資源留在同一個目錄中。 – Alxandr