locked
The file or assembly System.ComponentModel.Annotations version=4.2.0.0 The found assemblys manifestdefination is not equal to assemblyes reference RRS feed

  • Question

  • User-1955941912 posted

    Hi 
    I get the above error and I don't know what to do. I have went through a lot of pages, but nothing seams to get rid of the error. The error doesn't show up on compile time. I have 10-15 times reinstalled the nuget in both projects. 

    It's first after I made a new project (Businesslayer) the error came. 

    The error come here

    <th>
                @Html.DisplayNameFor(model => model.Name)
            </th>

    I have checked the System.ComponentModel version and also System.ComponentModel.Annotations and both is the same what I installed in the Nuget manager.

    The BusinessLayer project look like this

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="System.ComponentModel" Version="4.3.0" />
        <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
        <PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
      </ItemGroup>
    
      <ItemGroup>
        <Reference Include="System.Configuration">
          <HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Configuration.dll</HintPath>
        </Reference>
      </ItemGroup>
    </Project>

    I hope some of you can help me. I do not know what to do :-)

    Best regards

    SimsenVejle



    Tuesday, February 2, 2021 5:59 PM

Answers

  • User1686398519 posted

    Hi SimsenVejle,

    You can try bindingRedirect to redirect one assembly version to another.

    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.2.0.0" />

    You can click this link to see a more detailed explanation.

    Best Regards,

    YihuiSun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2021 7:20 AM

All replies

  • User-1955941912 posted

    I don't know if that helps you telling me what I have to do.

    I remove the System.ComponentModel.Annotations from my project in both projects. Then I go into Nuget Manager and install the latest stabel 5.0.0.

    Then when look in my object browser I can see 2 System.ComponentModel.Annotations first 4.2.0.0 and then 4.2.1.0.

    I have tried to remove the bin folder - then I right click on the System.ComponentModel.Annotations.dll file an the fileversion sais 4.6.26515.6

    I'm confused

    Tuesday, February 2, 2021 7:44 PM
  • User1686398519 posted

    Hi SimsenVejle,

    You can try bindingRedirect to redirect one assembly version to another.

    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="4.2.0.0" />

    You can click this link to see a more detailed explanation.

    Best Regards,

    YihuiSun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 3, 2021 7:20 AM
  • User-1955941912 posted

    Thank you very much 

    best regards

    SimsenVejle

    Wednesday, February 3, 2021 1:56 PM