I need to convert a project started as a Web Application to a Class Libray, is this possible?
Thanks
I need to convert a project started as a Web Application to a Class Libray, is this possible?
Thanks
The correct answer is yes. Just edit the csproj (msbuild) file and change the ProjectGuid and remove the ProjectTypeGuids:
<ProjectGuid>{9845066A-3C9E-4F51-8F5F-8F513E8D03C1}</ProjectGuid>
It really is that simple.
If you want to make it exactly the same as a class library project, here's how to do it for a Visual Studio 2010 project:
Edit the csproj file
PropertyGroup
ProjectTypeGuids
UseIISExpress
<FileAlignment>512</FileAlignment>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
to <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<ProjectExtensions>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
OutputPath
to bin\Debug\
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
OutputPath
to bin\Release\
Open the project in Visual Studio
No. Your best bet is to create a Class.Library and copy the .cs files into your new project.
A Class Library won't do anything with .aspx pages, it will see those as files in the solution.
I came here to have a class library with mvc menu items. This is, right click on views folder to add view or controller to add controller within a classlibrary.
I was able to achieve this by editing my mvc.web.app.csproj, copy the <ProjectTypeGuids />
to my class.lib.csproj project.
For more context on what I am doing, see: How to reuse Areas, Controllers, Views, Models, Routes in multiple apps or websites.