Solved

Publish ASP.NET 2.0 Website Using MSBuild

Posted on 2011-09-05
3
429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 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