Friday, July 17, 2009

How to add Web Resources (ascx,aspx,asmx etc) to a Class Library in Visual Studio

Open the .vbproj or .csproj file of your Class Library in notepad. The reason you have to open it in notepad and not in Visual Studio is that, you cannot open that file in Visual Studio, directly. But it can be opened in Visual Studio after unloading the project. Anyways, after opening this file, add the following line below <ProjectGuid> tag.

<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} </ProjectTypeGuids>

Save it and close it and reopen the project. Thats it. You can add any ascx,aspx, asmx to a class library in Visual Studio.