Monday, January 12, 2009

"Cannot locate resource" in VS.NET 2008 when debugging

I downloaded XamlTune - very helpful, but a little buggy. So I turned to the VS.NET 2008 debugger. But every time I tried to run the XamlTune source code, I would get a "Cannot locate resource 'Output.xaml'" error message at runtime during app startup.

I searched and searched and found zillions of people getting the "Cannot locate resource" error message, but nothing solved the problem in this case.

By trial and error, I finally discovered that the assembly name is the culprit in this case.

The XamlTune "solution" contains a DLL called XamlTune and a separate executable by the same name.

XamlTune.dll
XamlTune.exe

In Release mode, this runs fine, and presumably, in previous versions of VS.NET, it ran fine. But in VS.NET 2008 sp1, running in Debug mode, the aforesaid error occurs.

The solution is extremely simple: Change one or other project file so that the assembly names of the two projects differ.

Clearly a bug in the VS.NET or .NET framework implementation, and it certainly wasted hours of my time today, but when you know how to solve it, everything works nicely again...

No comments: