.NET Core-指定ReferencePath的构建项目 [英] .NET Core - build project specifying ReferencePath
问题描述
我为 .NetCore 平台提供了一个 .csproj ,其中包含经典参考.我在开发环境中使用hintpath
属性.但是我应该在CI环境中构建 csproj ,将引用的程序集放在不同的目录中.
在经典的 net4 上,我为 MSBuild 工具使用了/p:ReferencePath
参数.
但是"dotnet构建"没有类似的论点.
作为后备,我找到了"dotnet msbuild"命令,但是此工具忽略了/p:ReferencePath=xxx
参数并显示
I have a .csproj for the .NetCore platform with classic references. I'm using the hintpath
attribute for the development environment. But I should build csproj on the CI-environment where referenced assemblies are placed in the different directory.
On the classic net4 I've used the /p:ReferencePath
argument for the MSBuild tool.
But the "dotnet build" has no similar argument.
As a fallback I found the "dotnet msbuild" command but this tool is ignores the /p:ReferencePath=xxx
argument and shows me
警告MSB3245:无法解决此引用.无法找到程序集"AssemblyName".检查以确保程序集在磁盘上.如果您的代码需要此引用,则可能会出现编译错误.
warning MSB3245: Could not resolve this reference. Could not locate the assembly "AssemblyName". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
请指导我,我可以检查什么, dotnet-build / dotnet-msbuild 工具在哪里搜索引用的程序集以及如何指定该目录?
Please guide me, what can I check, where dotnet-build/dotnet-msbuild tools are searching the referenced assemblies and how to specify that directory?
推荐答案
Microsoft.NET.Sdk.props解决了问题:AssemblySearchPaths没有ReferencePath. 通过添加到csproj进行修复:
Problem is coused by Microsoft.NET.Sdk.props: AssemblySearchPaths has no ReferencePath. Fixed by adding to csproj:
<PropertyGroup>
<AssemblySearchPaths>
$(AssemblySearchPaths);
$(ReferencePath);
</AssemblySearchPaths>
</PropertyGroup>
这篇关于.NET Core-指定ReferencePath的构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!