我为.NetCore平台提供了一个带有经典引用的.NetCore。我在开发环境中使用hintpath属性。但是我应该在CI-环境上构建csproj,其中引用的程序集放在不同的目录中。在经典的net4上,我为MSBuild工具使用了/p:ReferencePath参数。但是"dotnet构建“没有类似的论点。作为后盾,我找到了"dotnet“命令,但是这个工具忽略了/p:ReferencePath=xxx参数,并向我展示了
警告MSB3245:无法解析此引用。无法找到程序集"AssemblyName“。检查以确保程序集存在于磁盘上。如果代码需要此引用,则可能会出现编译错误。
请指导我,我可以检查什么,哪里有dotnet-build/dotnet工具搜索引用的程序集,以及如何指定该目录?
发布于 2019-01-10 18:49:06
Microsoft.NET.Sdk.props指出了问题: AssemblySearchPaths没有ReferencePath。通过添加到csproj来修正:
<PropertyGroup>
<AssemblySearchPaths>
$(AssemblySearchPaths);
$(ReferencePath);
</AssemblySearchPaths>
</PropertyGroup>发布于 2018-09-30 17:39:09
referencePath被新的项目文件格式忽略了,这似乎是一个错误。/t:restore和build目标,这样它就可以同时恢复和构建。<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中的配置名称,并完成此工作。
发布于 2019-01-14 20:21:15
但是"dotnet构建“没有类似的论点。
你为什么这么说?
dotnet cli仍然支持使用-p而不是/p的“属性注入”。链接(搜索"-p")
对于您的问题,build命令将类似于以下命令:
dotnet build -p:ReferencePath=xxx
https://stackoverflow.com/questions/50057777
复制相似问题