LOST
LOST

Reputation: 3249

ReferencePath with the new .NET SDK?

I am trying to specify a custom ReferencePath in my .csproj file, that uses the new format.

Here's how it looks like:

<PropertyGroup>
  <ReferencePath>C:\...\binaries</ReferencePath>
</PropertyGroup>

With the following reference:

<Reference Include="MyDll">
  <Private>false</Private>
  <SpecificVersion>false</SpecificVersion>
</Reference>

C:\...\binaries contains MyDll.dll

However, during build I still get

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

I am trying to switch to ReferencePath from HintPaths, as they've become cumbersome to maintain.

Upvotes: 3

Views: 1665

Answers (2)

Dmitry C
Dmitry C

Reputation: 206

ReferencePath can be added manually to new csproj:

<PropertyGroup>
    <AssemblySearchPaths>
       $(AssemblySearchPaths);
       $(ReferencePath);
    </AssemblySearchPaths>
</PropertyGroup>

Upvotes: 0

honzajscz
honzajscz

Reputation: 3107

In the new SDK csproj you can use the AssemblySearchPaths variable instead of the ReferencePath variable to influence assembly probing

<AssemblySearchPaths>
  $(YOUR_SEMICOLON_SEPARATED_DIR_PATHS);$(AssemblySearchPaths);
</AssemblySearchPaths>

However, be careful with the old .NET Framework projects where this trick does not work.

Upvotes: 4

Related Questions