Solved

Publish ASP.NET 2.0 Website Using MSBuild

Posted on 2011-09-05
3
425 Views
Last Modified: 2012-05-12
Hi all,

I have a VS2005 solution which consists of a classlibrary and a website (not a web application!).

I have created a a script to use MSBuild to publish the website.

Unfortunately, when it comes to publishing the website, it give the dreaded "MSB6006: aspnet_compiler.exe execited with code 1"

I think it is something to do with the fact that the website in the solution references the classlibrary project, but I'm not sure how to handle it or what settings to change.

I have attached the code from my build file

Any help is much appreciated.

Thanks.

resourcesys.


<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="All">

	<!--We import the comminity tasks project so we can use there custom tasks in the build file -->
	<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
  
  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

 	<PropertyGroup>
		<ProjectDir>P:\Builds\REP_Testing</ProjectDir>

		<SourceCode>$(ProjectDir)\SourceCode</SourceCode>
		<BuiltSolution>$(ProjectDir)\BuiltSolution</BuiltSolution>
		 <PublishedWebsite>$(ProjectDir)\PublishedWebsite</PublishedWebsite>

		<SvnRepoPath>http://performoee:8080/svn/REP_Testing/trunk</SvnRepoPath>
		<SvnUsername>ccnet</SvnUsername>
		 <SvnPassword>ccnet</SvnPassword>

		<Major>0</Major>
		<Minor>0</Minor>
		<Build>0</Build>
		<Revision>0</Revision>
	</PropertyGroup>
  
  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

  	<!--Get rid of old source code by deleting and recreating the directory -->
	<Target Name="CleanSourceCodeDirectory">
		<RemoveDir Directories="$(SourceCode)" />
		<Message Text="Source Code Directory Cleaned"/>
	</Target>

  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

  	<!--Get the latest code form the repository -->
	<Target Name="CheckoutSourceCodeFromRepository" DependsOnTargets="CleanSourceCodeDirectory">
		<SvnExport RepositoryPath="$(SvnRepoPath)" LocalPath="$(SourceCode)" Username="$(SvnUsername)"  Password="$(SvnPassword)">
			<Output TaskParameter="Revision" PropertyName="Revision" />
		</SvnExport>

      		<copy sourcefiles="$(SourceCode)\REP_WebSite\web.publish.config" destinationfiles="$(SourceCode)\REP_WebSite\web.config" />
		
		<delete files="$(SourceCode)\REP_WebSite\web.publish.config" /> 
       		<delete files="$(SourceCode)\REP_WebSite\web.template.config" /> 

  		<Message Text="Checkout Of Source Code For Revision: $(Revision) Complete"/>
	</Target>

  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

  	<!--Set values for version numbers in the AssemblyInfo.vb file -->
	<Target Name="SetVersionProperties" DependsOnTargets="CheckoutSourceCodeFromRepository">
		<Time Format="yyyy">
			<Output TaskParameter="FormattedTime" PropertyName="Major" />
		</Time>

		<Time Format="MM">
			<Output TaskParameter="FormattedTime" PropertyName="Minor" />
		</Time>

		<Time Format="dd">
			<Output TaskParameter="FormattedTime" PropertyName="Build" />
		</Time>
    
		<Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>
    
		<AssemblyInfo CodeLanguage="VB" OutputFile="$(SourceCode)\REP_WebSite\Include\AssemblyInfo.vb" AssemblyVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyFileVersion="$(Major).$(Minor).$(Build).$(Revision)" AssemblyTitle="REP_Testing" AssemblyDescription="$(SvnRepoPath)" Guid="3d5900ae-111a-45be-96b3-d9e4606ca793" Condition="$(Revision) != '0' "/> 

  		<Message Text="Version Numbers In Assembly File Set"/>
	</Target>

  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

  	<!--Build the solution -->
	<Target Name="BuildSourceCodeSolution" DependsOnTargets="SetVersionProperties">
		 <AspNetCompiler VirtualPath="/REP_WebSite" PhysicalPath="$(SourceCode)\REP_Website\"  TargetPath="$(PublishedWebsite)\" Clean="true" Force="true"  Debug="true" Updateable="true" />

		<Message Text="The Solution Has Built Successfully"/>
	</Target>

  <!--======================================================================================================================= -->
  
  
  <!--======================================================================================================================= -->

	<Target Name="All">
		<CallTarget Targets="CleanSourceCodeDirectory" />
		<CallTarget Targets="CheckoutSourceCodeFromRepository" />
		<CallTarget Targets="SetVersionProperties" />
		<CallTarget Targets="BuildSourceCodeSolution" />
	</Target>
  
</Project>

Open in new window

0
Comment
Question by:resourcesys
3 Comments
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36487799
There could be multiple reasons for the error. The thread http://forums.asp.net/t/1051551.aspx deals with it.
0
 
LVL 28

Accepted Solution

by:
strickdd earned 500 total points
ID: 36491067
Not sure what version of visual studio you are using, but I highly recommend web deploy pojects. These use MSBuild XML to compile the website based on your rules and make it MUCH easier to do:

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=25163
0
 

Author Closing Comment

by:resourcesys
ID: 36495572
Used a web deployment project and with a little tweeking everything worked correctly.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question