Manipulating ASP.NET Project File

Damir Dobric Posts

Next talks:

 

    

Follow me on Twitter: #ddobric



 

 

Archives

Sometimes there is a need to programmatically append some user controls or pages to the ASP.NET project file. While reading this you may wonder that there is anybody out there in universe who would do that. In one project we created one tool which generates ASP.NET application in one specific problem domain. To do that we created the core of the application and the rest is generated by tool.

Unfortunately, if your application requires hundreds of controls or pages you may notice that Visual Studio is not the tool, which is able to handle such cases. If you never tried to add >100 controls to Visual Studio do not try, because you will spend your time awaiting for VS to do whatever it has to be done.

To solve this problem I created a simple tool (another one) which appends auto-generated controls and pages in the CSPROJ file of the ASP.NET Web Application.

Following picture shows what has to done to append one UserControl in the web application project file.

After changing of project file the Web Application can be built as usual. To achieve flexible deployment I used additionally the Web-Application Deployment project AddIn (for VS 2005 or for VS 2008). Because I want to automate the build process following procedure can be used to build and deploy the web application:

First, it is necessary to build the web application. Otherwise, deployment would fail. This command invokes MSBUILD to start building process of the ASP/NET Web Application which is described in the MyWebApplication.csproj file.

>msbuild C:\Temp\MySolution\MyWebApplicationSolution\
         MyWebApplication\MyWebApplication.csproj

After the solution has been successfully built, MSBUILD is used to start building of for web deployment project. A Deployment process is described in the MyWebApplicationBuild.csproj_deploy.wdproj project file:

>msbuild C:\Temp\MySolution\MyWebApplicationSolution\
         MyWebApplicationBuild.csproj_deploy.wdproj


Posted Dec 12 2007, 11:28 PM by Damir Dobric

Comments

Damir Dobric Posts wrote XLinq Query Examples
on 12-13-2007 21:36

In this pos I will show some intersting XLing examples used to query the data in the Visual Studio project

developers.de is a .Net Community Blog powered by daenet GmbH.