2 Replies Last post: Nov 9, 2010 3:23 PM by henrik -  
David Seng Newbie 2 posts since
Mar 13, 2009
Currently Being Moderated

Mar 13, 2009 1:06 AM

Publish an ASP.net Web Application with Team City

I've figured out how to publish an ASP.net Web Application with Team City using the sln2008 runner and thought that I'd share.

 

In step 6 of the Build Configuration add a System Property name OutDir (I'm not sure if case matters or not) and give a value of something arbitrary like "publish/" (do not include the quotes). I found that it is picky it didn't like the "\" but maybe you could try escaping it and that would work.

 

Then inside the the csproj file for the web application, open it in Notepad and find the AfterBuild element, ususally it is commented out towards the bottom of the file.

 

  <Target Name="AfterBuild">
    <Exec Command="xcopy &quot;$(WebProjectOutputDir)&quot; &quot;\\server\www.website.com&quot;"/>
  </Target>

 

I was using beyond compare with a script but changed this sample to use xcopy for shortness.

Filip Kierzek Newbie 1 posts since
Jan 12, 2010
Currently Being Moderated
Jan 12, 2010 3:33 PM in response to: David Seng
Re: Publish an ASP.net Web Application with Team City

Hi David,

 

I guess I am trying to do the same thing. I've tried your method but I can't get the section to execute at all.

 

The second approach I've taken is to put on configuration screen "#3 - Runner: sln2008" the word "Publish" in the Targets field expecting TC do do a publish just like I can do from VS2008 when I right click on project and select "publish" from there. The message I get is:

 

[Project "Portal.csproj" (Publish target(s)):] Skipping unpublishable project.

 

However the project is clearly publishable as I am able to publish it from VS2008.

 

Thanks in advance for any suggestion.

 

Filip Kierzek

henrik - Newbie 9 posts since
Nov 9, 2010
Currently Being Moderated
Nov 9, 2010 3:23 PM in response to: David Seng
Re: Publish an ASP.net Web Application with Team City

You could also use RoboCopy:


        <Exec Command="robocopy /MIR $(OutputPath) $(OutputWebSite) /NP /XF Web.*.config *.t" IgnoreExitCode="true">
            <Output TaskParameter="ExitCode" PropertyName="ExitCode"/>
        </Exec>

 

/XF means exclude file, and I'm excluding the transformations files for web.config.

 

RobyCopy is generally better made than xcopy from my own experience. It can be downloaded for Server 2003 here:

http://www.microsoft.com/downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd

and exists already for versions above that.

More Like This

  • Retrieving data ...