问题
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