C# App Developed with VS2010 fails on startup with .NET 3.0
Read a ton of material on this one and still cannot find a workable solution...
We have a "Hello, World1" app--one text block on a MainWindow--built and tested with VS2010 (C#). Target version is set to .NET 3.0. When "deployed" on a .NET 3.0 (SP2) system the app fails on startup. It fails in the call to InitializeComponent() in the MainWindow. The error is basically a dump.
When the same app is put on a system with .NET 3.5 it works flawlessly.
Note all the modules loaded during the debugger (in VS2010) indicate dll being loaded are for .Net 2.0. V2.50727.
Can't figur开发者_StackOverflow中文版e out how to identify what's causing the load problem. thoughts, strategies, tools, suggestions?
(This is actually holding up a deployment.)PS. Upgrading to V3.5 in the near future is NOT and option--should be, but it's not.
Don't guess at the cause of the error, let .NET tell you. Write an event handler for AppDomain.CurrentDomain.UnhandledException and display or log the value of e.ExceptionObject.ToString().
You may need to know the InnerException as well in this case since the constructor failed. Cast e.ExceptionObject to Exception. If you can't make sense of the stack trace and the exception message then copy/paste it into your question.
You may want to note which versions of .Net are installed, as well as which Service Packs.
As the Microsoft download page says, .Net 3.5 also updates .Net 3.0 and .net 2.0.
Also, check your references. If you're referencing a library that depends on .Net 3.5 or a .Net 3.0 Service Pack, that could cause the error you're seeing.
Finally, I recommend Sysinternals Process Monitor and Process explorer to see exactly which dlls are loaded.
精彩评论