我正在尝试通过添加以下内容来设置我的 csproj 文件以在父目录中搜索依赖项:
<PropertyGroup>
<AssemblySearchPaths>
..\Dependencies\VS2012TestAssemblies\; $(AssemblySearchPaths)
</AssemblySearchPaths>
</PropertyGroup>
我将它作为最后一个 PropertyGroup 元素添加到第一个 ItemGroup 之前,它具有所有 Reference 声明。
不幸的是,这导致所有其他引用无法解析,例如:
ResolveAssemblyReferences:
Primary reference "Microsoft.CSharp".
9>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.CSharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
For SearchPath "..\Dependencies\VS2012TestAssemblies\".
Considered "..\Dependencies\VS2012TestAssemblies\Microsoft.CSharp.winmd", but it didn't exist.
Considered "..\Dependencies\VS2012TestAssemblies\Microsoft.CSharp.dll", but it didn't exist.
Considered "..\Dependencies\VS2012TestAssemblies\Microsoft.CSharp.exe", but it didn't exist.
有没有一种简单的方法可以告诉 msbuild 在哪里搜索我的项目的依赖项?我意识到我可以使用 /p:ReferencePath,但是我更喜欢在 csproj 文件本身中包含编译逻辑,而不是让 TFS Team Builds 指示查看位置,更不用说我希望能够在其他文件上编译它开发者机器。
我确实尝试将 $(AssemblySearchPaths) 移到列表的第一位,但这并没有帮助。