Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Publish ASP.NET 2.0 Website Using MSBuild

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 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