Geeks With Blogs

News
Employers
Soppa Group India
iSmart Panache Inc
R Systems Internationals Ltd
Technovate eSolutions Pvt Ltd
The contents of this blog are my personal opinion and do not represent in any way the view of my employer.
These postings are provided "AS IS" with no warranties, and confer no rights.

Google PR™ - Post your Page Rank with MyGooglePageRank.com

Narendra Tiwari

.Net Framework 2.0 emerged with the very powerful and sophisticated compilation architecture here is a very brief description how we can compile a website in .Net 2.0 using MSBuild (Build tool shipped with .Net Framework 2.0)



Prerquisites:
     > Understading of Build tool, Build Tasks and Properties
     > Compilation Modes in .Net Framework 2.0

Those who are not aware of Build Tool, can follow the below given steps to compile Asp.Net 2.0 Website

1. Create a file with extention .msbuild with the following xml, replace the WebsiteName, PrecompiledAssembliesPath and BuildDirectory with your values.  

<Project DefaultTargets="Main" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
 <WebsiteName>MyWebSite</WebsiteName> 
 <PrecompiledAssembliesPath>E:\temp\Project\Build\</PrecompiledAssembliesPath>
  <BuildDirectory>E:\temp\Project\</BuildDirectory>
  </PropertyGroup>
  <Target Name="Main">
 <AspNetCompiler 
         VirtualPath="/$(WebsiteName)"
     PhysicalPath="$(BuildDirectory)"
     TargetPath="$(PrecompiledAssembliesPath)"
     Force="true"
     Debug="true"
     Updateable="true"
 />
  </Target>
</Project>

References: http://msdn2.microsoft.com/en-us/library/7z253716.aspx

2. Run Following command from command line from .Net 2.0 Command prompt (MSBuild.exe is available in..     
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727)
    MSBuild.exe C:\Progra~1\MSBuild\temp.msbuild

Actually the compilation is being done through aspnet_compiler.exe, which is called by AspNetCompiler task in MSBuild script. the task attributes like PhysicalPath, Debug, Updateable are mapped with aspnet_compiler.exe command line arguments inturn.

I hope this article covers enough things around MSBuild and .Net 2.0 compilation. feel free to ask for any clarification.

 

Posted on Tuesday, February 7, 2006 8:41 AM .Net | Back to top


Comments on this post: Website Compilation in .Net Framework 2.0 with MSBuild Script

# re: Website Compilation in .Net Framework 2.0 with MSBuild Script
Requesting Gravatar...
IS there any possiblity of compiling multiple web projects from a solution file in aspnet_Compiler.exe using MSBuild Script?
Left by Saravanan on Mar 31, 2010 3:32 PM

# re: Website Compilation in .Net Framework 2.0 with MSBuild Script
Requesting Gravatar...
Hi,

Yes its pretty easy. in above example we have only target "main" to compile a project.

you can create mutiple targets with different names and call them in main target. e.g.

---------------------------------------------------
<target name="main">
<CallTarget Targets="TargetA"/>
<CallTarget Targets="TargetB"/>
</target>

<Target Name="TargetA">
<Message Text="Building Project-A..." />
</Target>
<Target Name="TargetB">
<Message Text="Building Project-B..." />
</Target>
---------------------------------------------------

Hope this suffice to answer your query :)
Left by Narendra Tiwari on Apr 01, 2010 9:33 PM

# re: Website Compilation in .Net Framework 2.0 with MSBuild Script
Requesting Gravatar...
With this approach for each folder in the website one seperate dll is created, is there a way to have reduce the number of dlls per website.
Thanks,
Murali
Left by Murali on Sep 16, 2010 7:12 PM

Your comment:
 (will show your gravatar)


Copyright © Narendra Tiwari | Powered by: GeeksWithBlogs.net