.net 如何为xbuild添加缺少的程序集引用?(Mono/Linux)
我们有一个C#项目,它在Windows和TeamCity上的Visual Studio中构建得非常好 我试着在Linux上使用Mono的.net 如何为xbuild添加缺少的程序集引用?(Mono/Linux),.net,linux,mono,nuget,xbuild,.net,Linux,Mono,Nuget,Xbuild,我们有一个C#项目,它在Windows和TeamCity上的Visual Studio中构建得非常好 我试着在Linux上使用Mono的xbuild这样构建它: MONO_IOMAP=case xbuild BuildAll.sln 构建失败,出现2个警告和7个错误,都是关于XmlDiffPatch 警告: /usr/lib/mono/4.5/Microsoft.Common.targets: warning : Reference 'XmlDiffPatch, Version=1.0.8.
xbuild
这样构建它:
MONO_IOMAP=case xbuild BuildAll.sln
构建失败,出现2个警告和7个错误,都是关于XmlDiffPatch
警告:
/usr/lib/mono/4.5/Microsoft.Common.targets: warning : Reference 'XmlDiffPatch, Version=1.0.8.28, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' not resolved
错误:
***REDACTED***: error CS0234: The type or namespace name `XmlDiffPatch' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
有两个.cs
文件
using Microsoft.XmlDiffPatch;
我有一个.csproj
文件:
<ItemGroup>
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<Reference Include="XmlDiffPatch, Version=1.0.8.28, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</ItemGroup>
...
<ItemGroup>
<None Include="lib\XmlDiffPatch.dll" />
</ItemGroup>
假的
...
我已确认确实存在一个文件lib\XmlDiffPatch.dll
该项目有几个模块(对不起,我不知道确切的.NET说法,我来自Java/Maven背景),警告/错误只出现在具有lib
目录的模块中
我需要做什么,使这个项目建立在Linux和Mono上?
我最好的猜测是.csproj
文件缺少某些内容,因此它们无法找到所需的.dll
我看了类似的问题,但他们基本上说“只需添加一个引用”,而没有解释如何在Linux上这样做。我没有“解决方案浏览器”之类的东西
我应该补充一点,我没有使用monodevelop,这是所有控制台和使用vi
编辑文件
我还想补充一点,对.csproj
或其他文件的任何更改都应与Windows兼容
编辑
我不知道它是否有用,但我注意到所需的
XmlDiffPatch
版本也很有用。我们的C#项目目前根本不使用NuGet,但我当然愿意接受建议——只要它只需要在Linux上编辑文件,并且在Windows开发人员完成我的提交后,它将在Visual Studio中自动工作。您可以向.csproj
添加HintPath
,因此当MSBuild/xbuild将程序集引用传递给csc/mcs时,将发现:
<Reference Include="XmlDiffPatch, Version=1.0.8.28, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" >
<HintPath>lib\XmlDiffPatch.dll</HintPath>
</Reference>
lib\XmlDiffPatch.dll
注意:编辑路径,使其相对于.csproj
所在的位置找到(假设问题中的lib
目录)
HintPath|
可选字符串部件的相对或绝对路径