Scary, isn't it?

With a brand new Vista and VS2008 on my laptop, I was just about to migrate some old projects of mine in the new studio format. The conversion wizard went smoothly but when I tried to rebuild the accompanying C# website I was greeted by the following dreadful error message:

The CodeDom provider type "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located.



That's it. No File, no line, no project. Nowhere to look for the specific problem. Yay!

A check of the web.config and the project references showed nothing suspicious -- google seemed to be the only reasonable option. A quick search and some deliberation unraveled the mystery in the nick of time:)

Some background info though: trying to be minimalistic with the Visual Studio installation this time, I decided not to go for the "Automatic" choice but removed some components that would be of no use to me -- one of these was the Visual J# language support (no offense but if I'll be writing Java code, I'll be writing it in Java... and Eclipse:)). So that would explain why the compiler cannot find the respective VJSharpCodeProvider type -- it simply is not present on my machine as it's a part of the Visual J# redistribution package.

OK, but why would the compiler even try to load the J# provider in my C# Website in the first place? I dug deeper in the contents of my website and finally found the real culprit -- awhile back when I started writing unit tests with the jsunit framework, it seems for this particular website I've copied the whole jsunit distribution package i.e. the framework files, the example tests, the test runner, AND among all -- the supporting files for running the framework for Java-powered sites I think (their specific purpose is irrelevant, the important fact is they were part of the project). I instantly removed the Java related files and the site compiled successfully. Cool. Then I experimented by simply adding an empty "test.java" file to the website root... and it broke again.

So the conclusion -- no matter whether you are really using a VJ# webform, the sole precence of a *.java file in the WebSite structure triggers the initialization of the VJSharpCodeProvider (<rant>ain't cool, is it?</ rant>)... and it fails miserably in scenarios like mine. I admit it's not the most common case and most probably the behavior is unchanged and exists in the previous versions of Visual Studio but still... watch out for those nasty java files in your projects;).


rahnev
About the Author

Stefan Rahnev

Stefan Rahnev (@StDiR) is Product Manager for Telerik Kendo UI living in Sofia, Bulgaria. He has been working for the company since 2005, when he started out as a regular support officer. His next steps at Telerik took him through the positions of Technical Support Director, co-team leader in one of the ASP.NET AJAX teams and unit manager for UI for ASP.NET AJAX and Kendo UI. Stefan’s main interests are web development, agile processes planning and management, client services and psychology.

Related Posts

Comments