views:

1366

answers:

3

A .NET 3.5 solution ended up with this warning when compiling with msbuild.

Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found the one that was referencing an older version of the dependant assembly.

I did try using MSBUILD from VS 2010 Beta 2 (as the Connect article indicated this was fixed in the next version of the CLR) but that didn't provide any more detail either (maybe fixed post Beta 2)

Is there a better (more automated) approach?

+10  A: 

Change the "MSBuild project build output verbosity" to "Normal" or above. To do this, follow these steps:

  1. Bring up the Tools/Options dialog (Tools->Options...).
  2. In the left-hand tree, select the Projects/Solutions node, and then select Build and Run.
    • Note: if this node doesn't show up, make sure that the checkbox at the bottom of the dialog ("Show all settings") is checked.
  3. In the tools/options page that appears, select the MSBuild project build output verbosity level to "Normal."
  4. Build the project and look in the output window.

Check out the MSBuild messages. The ResolveAssemblyReferences task, which is the task from which MSB3247 originates, should help you debug this particular issue.

My specific case was an incorrect reference to SqlServerCe. See below. I had two projects referencing two different versions of SqlServerCe. I went to the project with the older version, removed the reference, then added the correct reference.

Target ResolveAssemblyReferences:
    Consider app.config remapping of assembly "System.Data.SqlServerCe, ..." 
        from Version "3.5.1.0" [H:\...\Debug\System.Data.SqlServerCe.dll] 
        to Version "9.0.242.0" [C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\System.Data.SqlServerCe.dll]
        to solve conflict and get rid of warning.
    C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : 
        warning MSB3247: Found conflicts between different versions of the same dependent assembly.

You do not have to open each assembly to determine the versions of referenced assemblies.

  • You can check the Properties of each Reference.
  • Open the project properties and check the versions of the References section.
  • Open the projects with a Text Editor.
  • Use .Net Reflector.
AMissico
Your solutions looks good to me, however I don't think it is always useful to use the References section to view version numbers. I've often seen VS "lie" to me about which version it is using vs. which version is actually mentioned in the .csproj file.
David Gardiner
@David Gardiner - I would agree with your "lying" statement when using C# projects. In my experience, C# projects can get confused regarding the referened version and the actual version compiled/linked. When this happens, I clean the solution, manually delete the bin and obj folders, then delete the temporary project assemblies in %APPDATA%. A rebuild solution usually resolves the problem. (VB rarely suffers from this specific problem.)
AMissico
win for telling people to actually use the Output window. Build is so much more than F5 + Error List window.
JJS
+2  A: 

I found that (at least in Visual Studio 2010) you need to set the output verbosity to at least Detailed to be able to spot the problem.

It might be that my problem was a reference that was previously a GAC reference, but that was no longer the case after my machine's reinstall.

ErikHeemskerk