Question

In compiling a solution ported from .NET 1.1 in VS2003 to .NET 3.5 in VS2008, I get several suggestions, of which this one is representative:

Consider app.config remapping of assembly "System.Windows.Forms, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\System.Windows.Forms.dll] to solve conflict and get rid of warning.

Neither project in the solution has an app.config file. There are, however, gazillions of *.resx files that contain "Version=1.0.5000.0"

Should I do a global search and replace of those with "Version=2.0.0.0" or how should I rectify this?

UPDATE

I selected "Project > Upgrade Project", rebuilt, and now the messages include:

C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Windows.Forms.DataGrid". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

No way to resolve conflict between "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" and "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" arbitrarily.

No way to resolve conflict between "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" and "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" arbitrarily.

Consider app.config remapping of assembly "System.Windows.Forms, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "3.5.0.0" [C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Windows.Forms.dll] to solve conflict and get rid of warning.

UPDATE 2

I do have this line in my code:

this.dtGridUPC = new System.Windows.Forms.DataGrid(); 

and although the compiler warned me with this: "Could not locate the assembly "System.Windows.Forms.DataGrid". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors."

...I get no compilation errors.

Curiouser and curiouser.

Was it helpful?

Solution 2

You can add an app.config file and then map the libraries like this:

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="dotless.ClientOnly" publicKeyToken="96b446c9e63eae34" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.3.1.0" newVersion="1.3.1.0" />
      </dependentAssembly>

OTHER TIPS

Please use Auto-generate binding redirects at project properties window in Visual Studio

enter image description here

I have just fixed this error really simple. Close your project. Open again.Go to NuGet Packages for solutions. You will have a section there Consolidate. Just near search tool. Go there and choose what version you want to use. Also make sure that all your projects have the same version. Then inside all solutions add missing libraries before your namespace. Now compile your project and I hope it will start working again.

I added an app.config file with this code, and my compile time is now 1/3 of what it was. This was for System.Data

<configuration>
    <runtime>
        <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <!-- 2.0 to 3.5 -->
            <dependentassembly>
                <assemblyidentity culture="neutral" publickeytoken="969db8053d3322ac" name="System.Data" />
                <bindingredirect newVersion="3.5.0.0" oldVersion="2.0.0.0" />
            </dependentassembly>

            <!-- 1.0 to 3.5 -->
            <dependentassembly>
                <assemblyidentity culture="neutral" publickeytoken="969db8053d3322ac" name="System.Data" />
                <bindingredirect newVersion="3.5.0.0" oldVersion="1.0.5000.0" />
            </dependentassembly>
        </assemblybinding>
    </runtime>
</configuration>

I found this code here: http://grenangen.se/node/25#comment-1003

In my case the following warning was shown in the Output window:

11>  Consider app.config remapping of assembly "log4net, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" from Version "1.2.15.0" [] to Version "2.0.12.0" [C:\s\[SolutionName]\log4net.dll] to solve conflict and get rid of warning.
11>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2182,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><dependentAssembly><assemblyIdentity name="log4net" culture="neutral" publicKeyToken="669e0ddf0bb1aa2a" /><bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" /></dependentAssembly></assemblyBinding>

When I clicked this warning in the Output window "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets" file opened. I was surprised I should change something what is outside of my solution folder. Another surprise was I should change app.config even I worked on the web service with web.config configuration file. Programmers probably didn't realized that this warning shows also for services...

Anyway, double-click on this warning in the Error List window, not in the Output window. Be sure your Warnings button at the top of the Error List window is pressed so you can see this warning in the Error List Window. This way you should solve this warning by proper way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top