.NET Core - build project specifying ReferencePath
我有一个.csproj用于.NetCore平台,具有经典参考。 我在开发环境中使用
在经典的net4上,我已将
但是" dotnet构建"没有类似的论点。
作为备用,我找到了" dotnet msbuild"命令,但是此工具忽略了
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工具在哪里搜索引用的程序集以及如何指定该目录?
Microsoft.NET.Sdk.props解决了此问题:AssemblySearchPaths没有ReferencePath。
通过添加到csproj进行修复:
1 2 3 4 5 6 | <PropertyGroup> <AssemblySearchPaths> $(AssemblySearchPaths); $(ReferencePath); </AssemblySearchPaths> </PropertyGroup> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <Choose> <When Condition="'$(Configuration)|$(Platform)'=='YourSpecialConfiguration|x64'"><!-- attention here --> <ItemGroup> <Reference Include="your.dllname"> <HintPath>yourSpecialPath\your.dllname.dll</HintPath><!-- attention here --> <Private>true</Private> </Reference> <!-- more references here --> </When> <Otherwise> <ItemGroup> <Reference Include="your.dllname"> <HintPath>yourRegularPath\your.dllname.dll</HintPath><!-- attention here --> <Private>true</Private> </Reference> <!-- AND more references here --> </Otherwise> </Choose> |
这将允许您仅更改CI / Build中的配置名称即可完成此工作。
But the"dotnet build" has no similar argument.
你为什么这么说?
对于您的问题,