My blog has moved! Redirecting…

You should be automatically redirected. If not, visit http://www.digitalfugu.com/blog/ and update your bookmarks.

Tuesday, April 22, 2008

.NET 2.0 App Recomplied after .NET 3.0 Installed Crashes

We've been working with .NET 2.0 for a while now and having a grand old time with it but have started to look at some of the .NET 3.0 and 3.5 technologies lately. We found that one of our Click-once applications was having problems after being recompiled. The error we received when we tried to launch the application through Click-Once was:
Could not load file or assembly 'WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

At first we didn't notice that this was a version 3.0 assembly and thought that .NET 2.0 SP1 might fix it. Of course, it didn't. We checked all of our dependencies with Dependency Walker and Process Explorer but couldn't find any reference to WindowsBase.dll. We also found that if we had .NET 3.0 on the client or on the click-once web server it worked fine. If both the client and the click-once server didn't have .NET 3.0 installed, then it failed horribly. This lead us to think that maybe, just maybe, it wasn't really our application but the Click-Once assemblies created by Visual Studio 2005.

The real problem turns out to be something completely not what we expected. It was the Windows Workflow Foundation Extensions for Visual Studio 2005 that caused the problem. For some reason, the WF Extensions for VS 2005 caused the Click-Once assemblies to require WindowsBase.dll from the 3.0 framework.

The solution was simple:
  1. Close the solution
  2. Uninstall the WF Extensions (I rebooted afterwards just for kicks.)
  3. Re-open the solution
  4. "clean" the solution
  5. Re-build the project
  6. Re-publish to our Click-Once server
After that we were home free. I suspect that we might also have gotten away with openning the solution in Visual Studio 2008 and targeted the 2.0 framework for the build.

No comments: