<p>I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem).</p>
<p>The problem is that if I include an external component I always get the following warning:</p>
<blockquote>
<p>Found conflicts between different versions of the same dependent assembly.</p>
</blockquote>
<p>What exactly does this warning mean and is there maybe a possibility to exclude this warning (like using #pragma disable in the source code files)?</p>

[{'answer_id': 17812, 'author': 'Matt Hamilton', 'author_id': 615, 'author_profile': 'https://Stackoverflow.com/users/615', 'pm_score': 6, 'selected': False, 'text': '<p>Basically this happens when the assemblies you\'re referencing have "Copy Local" set to "True", meaning that a copy of the DLL is placed in the bin folder along with your exe.</p>\n\n<p>Since Visual Studio will copy all of the dependencies of a referenced assembly as well, it\'s possible to end up with two different builds of the same assembly being referred to. This is more likely to happen if your projects are in separate solutions, and can therefore be compiled separately.</p>\n\n<p>The way I\'ve gotten around it is to set Copy Local to False for references in assembly projects. Only do it for executables/web applications where you need the assembly for the finished product to run.</p>\n\n<p>Hope that makes sense!</p>\n'}, {'answer_id': 17816, 'author': 'Jon Limjap', 'author_id': 372, 'author_profile': 'https://Stackoverflow.com/users/372', 'pm_score': 2, 'selected': False, 'text': '<p>This actually depends on your external component. When you reference an external component in a .NET application it generates a GUID to identify that component. This error occurs when the external component referenced by one of your projects has the same name and but different version as another such component in another assembly.</p>\n\n<p>This sometimes happens when you use "Browse" to find references and add the wrong version of the assembly, or you have a different version of the component in your code repository as the one you installed in the local machine.</p>\n\n<p>Do try to find which projects have these conflicts, remove the components from the reference list, then add them again making sure that you\'re pointing to the same file.</p>\n'}, {'answer_id': 2137718, 'author': 'Brian Low', 'author_id': 46039, 'author_profile': 'https://Stackoverflow.com/users/46039', 'pm_score': 10, 'selected': True, 'text': '<p>This warning means that two projects reference the same assembly (e.g. <code>System.Windows.Forms</code>) but the two projects require different versions. You have a few options:</p>\n\n<ol>\n<li><p>Recompile all projects to use the same versions (e.g. move all to .Net 3.5). This is the preferred option because all code is running with the versions of dependencies they were compiled with.</p></li>\n<li><p>Add a <a href="http://msdn.microsoft.com/en-us/library/433ysdt1.aspx" rel="noreferrer">binding redirect</a>. This will suppress the warning. However, your .Net 2.0 projects will (at runtime) be bound to the .Net 3.5 versions of dependent assemblies such as <code>System.Windows.Forms</code>. You can quickly add a binding redirect by double-clicking on error in Visual Studio.</p></li>\n<li><p>Use <code>CopyLocal=true</code>. I\'m not sure if this will suppress the warning. It will, like option 2 above, mean that all projects will use the .Net 3.5 version of System.Windows.Forms.</p></li>\n</ol>\n\n<p>Here are a couple of ways to identify the offending reference(s):</p>\n\n<ul>\n<li>You can use a utility such as the one found at\n<a href="https://gist.github.com/1553265" rel="noreferrer">https://gist.github.com/1553265</a> </li>\n<li>Another simple method is to set Build\noutput verbosity (Tools, Options, Projects and Solutions, Build and\nRun, MSBuild project build output verbosity, Detailed) and after\nbuilding, search the output window for the warning, and look at the\ntext just above it.  <em>(Hat tip to <a href="https://stackoverflow.com/users/44547/pauloya">pauloya</a> who suggested this in the\ncomments on this answer)</em>.</li>\n</ul>\n'}, {'answer_id': 8887403, 'author': 'MoMo', 'author_id': 176728, 'author_profile': 'https://Stackoverflow.com/users/176728', 'pm_score': 3, 'selected': False, 'text': '<p>I just had this warning message and cleaned the solution and recompiled (Build -> Clean Solution) and it went away.</p>\n'}, {'answer_id': 13312274, 'author': 'Gorgsenegger', 'author_id': 412036, 'author_profile': 'https://Stackoverflow.com/users/412036', 'pm_score': 5, 'selected': False, 'text': '<p>I had the same problem with one of my projects, however, none of the above helped to solve the warning. I checked the detailed build logfile, I used AsmSpy to verify that I used the correct versions for each project in the affected solution, I double checked the actual entries in each project file - nothing helped.</p>\n\n<p>Eventually it turned out that the problem was a nested dependency of one of the references I had in one project. This reference (A) in turn required a different version of (B) which was referenced directly from all other projects in my solution. Updating the reference in the referenced project solved it.</p>\n\n<pre><code>Solution A\n+--Project A\n   +--Reference A (version 1.1.0.0)\n   +--Reference B\n+--Project B\n   +--Reference A (version 1.1.0.0)\n   +--Reference B\n   +--Reference C\n+--Project C\n   +--Reference X (this indirectly references Reference A, but with e.g. version 1.1.1.0)\n\nSolution B\n+--Project A\n   +--Reference A (version 1.1.1.0)\n</code></pre>\n\n<p>I hope the above shows what I mean, took my a couple of hours to find out, so hopefully someone else will benefit as well.</p>\n'}, {'answer_id': 21730097, 'author': 'Igor Gorjanc', 'author_id': 1436738, 'author_profile': 'https://Stackoverflow.com/users/1436738', 'pm_score': 0, 'selected': False, 'text': '<p>This happened to me too. One dll was referenced twice: once directly (in references) and once indirectly (referenced by another referenced project). \nI removed direct reference, cleaned &amp; rebuilt solution. Problem fixed.</p>\n'}, {'answer_id': 22950878, 'author': 'Bill', 'author_id': 1157412, 'author_profile': 'https://Stackoverflow.com/users/1157412', 'pm_score': 2, 'selected': False, 'text': "<p>I have another way to do this if you're using Nuget to manage your dependencies. I've discovered that sometimes VS and Nuget don't match up and Nuget is unable to recognize that your projects are out of sync. The packages.config will say one thing but the path shown in References - Properties will indicate something else.  </p>\n\n<p>If you're willing to update your dependencies, do the following:</p>\n\n<ol>\n<li><p>From Solution Explorer, right click the Project and click 'Manage\nNuget Packages'</p></li>\n<li><p>Select 'Installed packages' tab in left pane Record your installed\n    packages     You may want to copy your packages.config to your\n    desktop first if you have a lot, so you can cross check it with\n    Google to see what Nuget pkgs are installed</p></li>\n<li><p>Uninstall your packages. Its OK, we're going to add them right back.</p></li>\n<li><p>Immediately install the packages you need. What Nuget will do is not only get you the latest version, but will alter your references, and also add the binding redirects for you.</p></li>\n<li><p>Do this for all of your projects.</p></li>\n<li><p>At the solution level, do a Clean and Rebuild.</p></li>\n</ol>\n\n<p>You may want to start with the lower projects and work your way to the higher level ones, and rebuild each project as you go along.</p>\n\n<p>If you don't want to update your dependencies, then you can use the package manager console, and use the syntax Update-Package -ProjectName [yourProjectName] [packageName] -Version [versionNumber]</p>\n"}, {'answer_id': 24226821, 'author': 'Sukhi', 'author_id': 1367159, 'author_profile': 'https://Stackoverflow.com/users/1367159', 'pm_score': 0, 'selected': False, 'text': '<ol>\n<li>Open "Solution Explorer".</li>\n<li>Click on "Show all files"</li>\n<li>Expand "References"</li>\n<li>You\'ll see one (or more) reference(s) with slightly different icon than the rest. Typically, it is with yellow box suggesting you to take a note of it. Just remove it.</li>\n<li>Add the reference back and compile your code.</li>\n<li>That\'s all.</li>\n</ol>\n\n<p>In my case, there was a problem with MySQL reference. Somehow, I could list three versions of it under the list of all available references; for .net 2.0, .net 4.0 and .net 4.5. I followed process 1 through 6 above and it worked for me.</p>\n'}, {'answer_id': 24724384, 'author': 'Phil50', 'author_id': 2669005, 'author_profile': 'https://Stackoverflow.com/users/2669005', 'pm_score': 3, 'selected': False, 'text': '<p>I had the same issue and I resolved by changing the following in web.config.</p>\n\n<p>It happened to me because I am running the application using Newtonsoft.Json 4.0 </p>\n\n<p>From:</p>\n\n<pre><code>&lt;dependentAssembly&gt;\n  &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;\n  &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /&gt;\n&lt;/dependentAssembly&gt;\n</code></pre>\n\n<p>To:</p>\n\n<pre><code>&lt;dependentAssembly&gt;\n  &lt;assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /&gt;\n  &lt;bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="4.5.0.0" /&gt;\n&lt;/dependentAssembly&gt;\n</code></pre>\n'}, {'answer_id': 27030865, 'author': 'Tristan Lewis', 'author_id': 1633723, 'author_profile': 'https://Stackoverflow.com/users/1633723', 'pm_score': 1, 'selected': False, 'text': '<p>Also had this problem - in my case it was caused by having the "Specific Version" property on a number of references set to true. Changing this to false on those references resolved the issue.</p>\n'}, {'answer_id': 33633349, 'author': 'user1477388', 'author_id': 1477388, 'author_profile': 'https://Stackoverflow.com/users/1477388', 'pm_score': 5, 'selected': False, 'text': '<p>I wanted to post pauloya\'s solution they provided in the comments above.  I believe it is the best solution for finding the offending references.</p>\n\n<blockquote>\n  <p>The simplest way to find what are the "offending reference(s)" is to\n  set Build output verbosity (Tools, Options, Projects and Solutions,\n  Build and Run, MSBuild project build output verbosity, Detailed) and\n  after building, search the output window for the warning. See the text\n  just above it.</p>\n</blockquote>\n\n<p>For example, when you search the output panel for "conflict" you may find something like this:</p>\n\n<pre><code>3&gt;  There was a conflict between "EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".\n3&gt;      "EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was not.\n</code></pre>\n\n<p>As you can see, there is a conflict between EF versions 5 and 6.</p>\n'}, {'answer_id': 39797248, 'author': 'Tiago Gouvêa', 'author_id': 448292, 'author_profile': 'https://Stackoverflow.com/users/448292', 'pm_score': 5, 'selected': False, 'text': '<p>On Visual Studio if you right click on the <strong>solution</strong> and <strong>Manage nuget packages</strong> theres a <strong>"Consolidate"</strong> tab which sets all the packages to the same version.</p>\n'}, {'answer_id': 43467975, 'author': 'Neelam Prajapati', 'author_id': 6055037, 'author_profile': 'https://Stackoverflow.com/users/6055037', 'pm_score': 1, 'selected': False, 'text': '<p>=> check there will be some instance of application installed partially. </p>\n\n<p>=> first of all uninstall that instance from uninstall application.</p>\n\n<p>=> then,clean,Rebuild,and try to deploy.</p>\n\n<p>this solved my issue.hope it helps you too.\nBest Regards.</p>\n'}, {'answer_id': 46642769, 'author': 'Telwa Gangnam', 'author_id': 2487347, 'author_profile': 'https://Stackoverflow.com/users/2487347', 'pm_score': 0, 'selected': False, 'text': "<p>Another thing to consider and check is, make sure you don't have any service running that's using that bin folder. if their is stop the service and rebuild solution</p>\n"}, {'answer_id': 49246205, 'author': 'Dpedrinha', 'author_id': 1464539, 'author_profile': 'https://Stackoverflow.com/users/1464539', 'pm_score': 0, 'selected': False, 'text': "<p>There seems to be a problem on Mac Visual Studio when editing .resx files. \nI don't really know what happened, but I got this problem as soon as I edited some .resx files on my Mac.\nI opened the project on Windows, opened the files and they were as if they haven't been edited.\nSo I edited them, saved, and everything started working again on Mac too.</p>\n"}, {'answer_id': 55532395, 'author': 'Jacek Plesnar', 'author_id': 4066629, 'author_profile': 'https://Stackoverflow.com/users/4066629', 'pm_score': 0, 'selected': False, 'text': '<p>I had such issue when my project had reference to NETStandardLibrary and one of referenced assemblies was published for netcore. Just published it as netstandard and problem was gone</p>\n'}, {'answer_id': 56402282, 'author': 'spanish-math', 'author_id': 105028, 'author_profile': 'https://Stackoverflow.com/users/105028', 'pm_score': 1, 'selected': False, 'text': '<p>If using NuGet all I had to do was:</p>\n\n<ol>\n<li><p>right click project and click Manage NuGet Packages.. </p></li>\n<li><p>click the cog in top right</p></li>\n<li><p>click General tab in NuGet Package Manager above Package Sources</p></li>\n<li><p>check "Skip Applying binding redirects" in Binding Redirects</p></li>\n<li><p>Clean and rebuild and the warning\'s gone</p></li>\n</ol>\n\n<p>Easy peasy</p>\n'}, {'answer_id': 56570312, 'author': 'newprint', 'author_id': 465292, 'author_profile': 'https://Stackoverflow.com/users/465292', 'pm_score': 2, 'selected': False, 'text': '<p>I just spent sometime debugging the same issue. Note, that issue might not be between different projects, but actually between several references in one project that depend on different versions of the same dll/assembly. In my case, issue was reference <code>FastMember.dll</code> versions mismatch that comes from two different NuGet packages in a single project. When I was given a project, it would not compile because NuGet packages were missing and VS refused to restore missing packages. Through the NuGet menu, I manually update all the NuGets to the latest version, that is when the warning appeared. </p>\n\n<p>In Visual Studio <code>Tools &gt; Options &gt; Build and Run &gt; MSBuld Project build output verbosity: (set to) Diagnostics.</code> Look for the line(s) <code>There was a conflict between</code> in the <code>Output</code> window. Below is the part of output that I got:</p>\n\n<pre><code>1&gt;  There was a conflict between "FastMember, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" and "FastMember, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null". (TaskId:19)\n1&gt;      "FastMember, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" was chosen because it was primary and "FastMember, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" was not. (TaskId:19)\n1&gt;      References which depend on "FastMember, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null" [C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\FastMember.1.5.0\\lib\\net461\\FastMember.dll]. (TaskId:19)\n1&gt;          C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\FastMember.1.5.0\\lib\\net461\\FastMember.dll (TaskId:19)\n1&gt;            Project file item includes which caused reference "C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\FastMember.1.5.0\\lib\\net461\\FastMember.dll". (TaskId:19)\n1&gt;              FastMember, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL (TaskId:19)\n1&gt;      References which depend on "FastMember, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null" []. (TaskId:19)\n1&gt;          C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\ClosedXML.0.94.2\\lib\\net46\\ClosedXML.dll (TaskId:19)\n1&gt;            Project file item includes which caused reference "C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\ClosedXML.0.94.2\\lib\\net46\\ClosedXML.dll". (TaskId:19)\n1&gt;              ClosedXML, Version=0.94.2.0, Culture=neutral, processorArchitecture=MSIL (TaskId:19)\n</code></pre>\n\n<p>Notice, that <code>Project file item includes which caused reference "C:\\Users\\ksd3jvp\\Source\\Temp\\AITool\\Misra\\AMSAITool\\packages\\ClosedXML.0.94.2\\lib\\net46\\ClosedXML.dll"</code></p>\n\n<p><code>ClosedXML.dll</code> comes from <code>ClosedXML</code> NuGet and it depends on <code>FastMember.dll 1.3.0.0</code>. On top of it, there is also <code>FastMember</code> Nuget in the project, and it has  <code>FastMember.dll 1.5.0.0</code>. Mismatch ! </p>\n\n<p>I have uninstalled <code>ClosedXML</code> &amp; <code>FastMember</code> NuGets, because I had binding redirect and installed just latest version of <code>ClosedXML</code> That fixed the issue ! </p>\n'}, {'answer_id': 58124703, 'author': 'Harry', 'author_id': 126537, 'author_profile': 'https://Stackoverflow.com/users/126537', 'pm_score': 0, 'selected': False, 'text': '<p>Here\'s the solution, .NET Core 3.0 style:\n<a href="https://github.com/HTD/ref-check" rel="nofollow noreferrer">https://github.com/HTD/ref-check</a></p>\n\n<p>When you find what conflicts, maybe you would be able to resolve the conflicts.\nIf the conflicting references are from other packages, you either out of luck, or you need to use sources instead.</p>\n\n<p>In my case, the packages conflicting are often of my own, so I can fix dependency problems and republish them.</p>\n'}, {'answer_id': 69426035, 'author': 'Tim Makins', 'author_id': 3750058, 'author_profile': 'https://Stackoverflow.com/users/3750058', 'pm_score': 0, 'selected': False, 'text': "<p>I had the same problem. In the project's 'obj' folder I renamed the folder 'Debug' to 'Debug_OLD' and rebuilt. A new 'Debug' folder was built automatically, and the problem went away.</p>\n"}, {'answer_id': 74196681, 'author': 'Kluge', 'author_id': 8752, 'author_profile': 'https://Stackoverflow.com/users/8752', 'pm_score': 0, 'selected': False, 'text': '<p>After some hours of trying to analyze the detailed build log, I discovered that several of the projects in my solution were targeting different .Net versions.  I changed them all to .Net 4.7.2 and rebuilt the solution and the error was resolved.</p>\n'}]
['https://Stackoverflow.com/questions/17806', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2078/']