1

So we have a project (target .NET framework 4.6.2) that uses System.Diagnostics.Tracing, which is a dependency from a chain of other packages.

User 1 installed it via Nuget and shared the code to others. However, now we are in a mess that eventually results in the error of The located assembly's manifest definition does not match the assembly reference (Exception from HRESULT: 0x80131040 for at least one of us.

And trying to fix it, we realized that the reference to System.Diagnostics.Tracing is different for each of us.

User 1: It points to C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Diagnostics.Tracing.dll

User 2: It points to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib\System.Diagnostics.Tracing.dll

User 3: The only one that it actually points to the installed Nuget package C:\Users\User3\Documents\Project\Test\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll

And for some reason User 3 is the one who can't run the project. User 1 and User 2 are fine.

And the .csproj file does have this specifically.

<Reference Include="System.Diagnostics.Tracing">
    <HintPath>..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
    <Private>True</Private>
</Reference>

We are out of ideas why this would happen, and how to fix it. Nuget is supposed to be a good way to deal with dependencies, and somehow it is very messy in this situation.

Anyone has experience on dealing with this?

Ngoc Pham
  • 443
  • 5
  • 17
  • 1
    HintPath is just that: a hint of where to find the assembly if it can't be found in other places (e.g. the GAC; but there are also other places that it looks). – Richardissimo Jun 12 '18 at 22:33
  • 1. All switch to VS2017. 2. Modify the project to use package references instead of `packages.config`. Then it might have a higher possibility to work. – Lex Li Jun 12 '18 at 22:34
  • @Richardissimo Is there any way to tell it not to take that as a "hint"? – Ngoc Pham Jun 13 '18 at 03:17
  • @LexLi I believe we all have VS2017, but we haven't tried package references. Might worth a shot. Thanks! – Ngoc Pham Jun 13 '18 at 03:23
  • The build process will use a defined order of places to look. I'm struggling to find an official source for where it looks; but the 'Compile Time Reference Resolution' part of [this answer](https://stackoverflow.com/a/32342226/5198140) indicates a sequence of places where it will look. Make sure the NuGet package referred to has been added to your version control system, and all 3 users have the file at that location in their workspace. You can make sure everyone gets the same version by making sure those other versions don't exist on the other users machines. – Richardissimo Jun 13 '18 at 16:46

0 Answers0