如何为xbuild添加缺少的程序集引用?(单声道/ Linux)的

Ame*_*sse 2 .net linux mono xbuild nuget

我们有一个C#项目,可以在Windows和TeamCity中的Visual Studio中很好地构建.

我尝试使用Mono的Linux在Linux上构建它xbuild:

MONO_IOMAP=case xbuild BuildAll.sln
Run Code Online (Sandbox Code Playgroud)

构建失败,有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
Run Code Online (Sandbox Code Playgroud)

错误:

***REDACTED***: error CS0234: The type or namespace name `XmlDiffPatch' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)

有几个.cs文件

using Microsoft.XmlDiffPatch;
Run Code Online (Sandbox Code Playgroud)

我在一个.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>
Run Code Online (Sandbox Code Playgroud)

我已经确认文件lib\XmlDiffPatch.dll确实存在.

该项目有几个模块(对不起,我不知道确切的.NET用语,我来自Java/Maven背景),警告/错误只出现在有lib目录的模块中.

我需要做什么,使用Mono在Linux上构建这个项目?我最好的猜测是.csproj文件丢失了,所以他们找不到所需的文件.dll.

我看了类似的问题,但他们基本上说"只是添加一个参考",而没有解释如何在Linux上这样做.我没有"解决方案探险家"或任何东西.

我应该补充一点,我没有使用monodevelop,这是所有控制台和编辑文件vi.

我还想补充说,对.csproj文件或其他文件的任何更改仍应与Windows兼容.

编辑

我不知道它是否有用,但我注意到NuGet上XmlDiffPatch提供了所需的版本.我们的C#项目目前根本不使用NuGet,但我当然愿意接受建议 - 只要它只需要在Linux上编辑文件,它就会在Windows开发人员提交后自动在Visual Studio中工作.

Sus*_*ver 6

您可以添加一个HintPath,.csproj这样当MSBuild/xbuild将程序集引用传递给csc/mcs时,它将被找到:

<Reference Include="XmlDiffPatch, Version=1.0.8.28, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" >
 <HintPath>lib\XmlDiffPatch.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)

注意:编辑路径以便找到相对于其所在位置的路径.csproj(假设lib您的问题中的目录).

https://msdn.microsoft.com/en-us/library/bb629388.aspx

HintPath | 可选字符串.| 装配的相对或绝对路径.