Skip to content

Wrong assembly is being referenced in solution #3301

Open
@pavlexander

Description

@pavlexander

Wrong assembly is being referenced in solution

When trying to reference 1.0.4. version of an assembly - 1.0.1 version of file is being used.. Despite the fact, that project settings are pointing to the correct DLL. As the result - the solution is still compiled with 1.0.1 version.

General

Specs

OS:

  • OS Name Microsoft Windows 10 Enterprise
  • Version 10.0.16299 Build 16299

VS:

  • Microsoft Visual Studio Professional 2017
  • Version 15.9.7
  • VisualStudio.15.Release/15.9.7+28307.423
  • Microsoft .NET Framework
  • Version 4.7.02556

dotnet --version

  • 2.2.104

Prerequisites

Checkout the solution from my repo:

https://github.com/pavlexander/dotnetbugs/tree/master/Bugs/12032019_WrongAssemblyLoaded

Steps to reproduce

  1. Open the solution in VisualStudio
  2. Right click on project, "Add -> Reference".
  3. Browse for file in directory: "..12032019_WrongAssemblyLoaded\WrongAssemblyLoaded\DebugTests.Common.NugetWithPdb.1.0.4\lib\netstandard2.0\DebugTests.Common.NugetWithPdb2.dll"
    Proceed with adding of a reference.
    Note that file from 1.0.4 is selected.
  4. Right click on project, click "Edit WrongAssemblyLoaded.csproj"
  5. Verify that correct assembly is specified:
  <ItemGroup>
    <Reference Include="DebugTests.Common.NugetWithPdb">
      <HintPath>DebugTests.Common.NugetWithPdb.1.0.4\lib\netstandard2.0\DebugTests.Common.NugetWithPdb2.dll</HintPath>
    </Reference>
  </ItemGroup>
  1. Now, in VisualStudio, expand the tree of the project -> Dependencies -> Assemblies, find the assembly that you referenced and check the path.

Expected result:

Assembly from 1.0.4 folder is used

Actual result:

..\dotnetbugs\Bugs\12032019_WrongAssemblyLoaded\WrongAssemblyLoaded\DebugTests.Common.NugetWithPdb.1.0.1\lib\netstandard2.0\DebugTests.Common.NugetWithPdb.dll

And this is the issue. Assembly of version "1.0.1" is used in project, despite even the fact that in project settings "1.0.4" version is specified. If you try and build the solution now, in the output folder you will also see the "1.0.1" version. I don't think this is related to Visual Studio in any way. Because, even if you try to use the dotnet build command directly - it will also put the same wrong dll into an output directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions