C# reference in .props file

ぐ巨炮叔叔 提交于 2021-01-27 12:12:00

问题


When I add this code directly to the .csproj file, the reference is resolved correctly:

<ItemGroup>
  <Reference Include="base_csharp">
    <HintPath>D:\Repositories\MDSBuild\MdsDrivers\deps\Base\install\bin\Windows\MSVC\x86\Debug\base_csharp.dll</HintPath>
  </Reference>
</ItemGroup>

However, when I put the exact same code in a props file

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Reference Include="base_csharp">
      <HintPath>D:\Repositories\MDSBuild\MdsDrivers\deps\Base\install\bin\Windows\MSVC\x86\Debug\base_csharp.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
</Project>

And import that props file into the .csproj

<Import Project="D:\Repositories\MDSBuild\MdsDrivers\deps\Base\scripts\props\base_csharp.props" /

I get the warning that the reference could not be resolved:

warning MSB3245: Could not resolve this reference. Could not locate the assembly "base_csharp". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

The code is exactly the same and all the paths are absolute, but for some inexplicable reason it is unable to find the .dll file. What am I doing wrong?

来源:https://stackoverflow.com/questions/38049070/c-sharp-reference-in-props-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!