views:

87

answers:

3

I have a pretty complex WPF and C++/CLI application that was built using .NET 3.5. We've migrated to 4.0 to take advantage of the WPF goodies, so all our projects in the solution are targeting 4.0.

On running our application on XP machines with just 4.0 (and MSVC++ 2010 [and 2008]), an error dialog will pop up with the message:

"To run this application, you first must install one of the following version of the .NET framework: 2.0.50727"

If I go install .NET 2.0 with .NET 4.0 my application will run.

Anyone know how to debug loading the assemblies to find out what's going on?

UPDATE

I just found out about the "Modules" window in VS2010, and also watched the Modules loaded events in the output window when running in the debugger. I can clearly see there's a single .NET 2.0 module running with my application.

'Kudu.exe': Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll', Exports loaded.
'Kudu.exe': Loaded 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll', Exports loaded.
'Kudu.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_d08a205e442db5b5\msvcr80.dll', Exports loaded.

Is there any way to see what loaded this?

A: 

Try RedGate's .NET Reflector

+3  A: 

Check the target framework of every project in your solution.
Also, check the Object Browser's My Solution view and make sure you don't see mscorlib [2.0.0.0].

It's also possible that you're referencing a separate DLL that was compiled for .Net 2.0.

SLaks
All my projects are targeted .NET 4.0 so that's not an issue. I did see several references in the Object Browser that aren't in the 4.0 install location. Microsoft.mshtml.dll, Microsoft.OFfice.Interop.Outlook, Office.dll, and stdole.dll. The Mshtml is the webbrowser I need, the Office things are part of the MS Office tools in VS2010, but i'm not sure about stdole. Might be part of the office things too.
Jippers
+3  A: 

Okay I gave up and stepped through my code line by line from startup until I hit the module loading statements. No thanks to VS2010's terrible call stack and thanks to gratuitous break points, it was my reference to a now deprecated StrongName.h functions that I use to verify our assemblies.

.NET 4 now uses MetaHost.h and ICLRStrongName functions.

There REALLY needs to be a compiler warning about this.

Jippers