0

When a .csproj contains an Item like: <Reference Include="System.Data" /> how does MSBuild know where to look for it? Is it possible to change this by running MSBuild from command line?

My issue:

I'm setting up a new build environment and my build fails because a DLL is not referenced properly during build. If I write an absolute path to that DLL the build is successful.

My .csproj contains:

  <ItemGroup>
    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
    <Reference Include="System.Web.Services" />
    <Reference Include="System.XML" />
  </ItemGroup>

and build complains that it can not find "..UnitTestFramework" even though it is available on the system in the same place it is located on a different build environment where the build works fine. If copy that DLL to the project folder and add a HintPath it works fine:

So this works:

  <ItemGroup>
    <Reference Include="System.Web.Services" />
    <Reference Include="System.XML" />
    <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework"> 
<HintPath>..\..\DLL\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
    </Reference>
  </ItemGroup>

This is not an acceptable solution and I suspect that the problem is some default setting that dictates where msbuild should look for references.

Tadija Bagarić
  • 2,495
  • 2
  • 31
  • 48

0 Answers0