?
Solved

Publish ASP.NET 2.0 Website Using MSBuild

Posted on 2011-09-05
3
Medium Priority
?
430 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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 …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 14 hours left to enroll

762 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