Long story short, because of some issues with architecture and the fact that someone already put a few .aspx files in a class library, I\'d like to just finish off the chang
Create a new web application project in your solution and drag and drop all files from class library to the new web application project.
I did this by hand today in Visual Studio 2005 because it seemed easier and faster than the above. I just diffed a working web application .csproj file with my class library to determine the relevant differences. Based on that, I made the following changes. Keep in mind that it may be different for other versions or your individual project.
1) Right after the <ProjectGuid>
element near the top, I added
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
2) I removed <ProjectType>Local</ProjectType>
3) At the bottom of the file, right before the closing </Project>
, I added
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>3291</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
Would it be easiest to just create a new web project, then copy over the class files and *.aspx files into the new web project?
It's mentioned in the comments already, but somehow it's easy to miss (at least I missed it). If you applied Brad's solution, but your project is still missing the option to add areas, controllers and views, you still need to add an MVC project guid {E3E379DF-F4C6-4180-9B81-6769533ABE47}
.
The ProjectTypeGuids
line should now look like this:
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
As mentioned by JamesQMurphy, {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
will not work in VB projects. That's because it's a C# project guid. So for VB project a VB project guid has to be used. This guid is {F184B08F-C81C-45F6-A57F-5ABD9991F28F}
.
Here is a list of some of the known project guids (taken from this site):
P.S. In case you wonder, the list is apparently public domain.