Can TeamCity publish a Web project using the sln2008 build runner?

自闭症网瘾萝莉.ら 提交于 2019-11-30 11:05:11

问题


I'm building an ASP.Net MVC project in TeamCity.

Can I somehow call the Publish target and get the output copied to a folder under IIS? or do I need to write an msbuild script for this?


回答1:


I've written a pretty long blog post on this very topic that may interest you:

http://www.diaryofaninja.com/blog/2010/05/09/automated-site-deployments-with-teamcity-deployment-projects-amp-svn

basically:

  • install web deployment projects
  • add web deployment project to your solution
  • setup the solution configuration manager to have a "Deployment" build configuration
  • get team city to use this build switch when running the build
  • have a beer and wonder in glory at your automagical awesomenesss



回答2:


Have you tried a Web Deployment Project (WDP)? I have multiple Web Application Projects (WAP) with associated WDPs that work great with TeamCity for deployment scenarios.

I use the sln2008 runner to build my solution (containing both the WAP and the WDP). I've modified the WDP project file (an MSBuild script) to copy the output to a network share:

<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Deploy' ">
    <!-- copy WDP output to \\build02\wwwroot\Belden.Web.Intranet\ -->
    <ItemGroup>
        <MySourceFiles Include="$(OutputPath)**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(MySourceFiles)" DestinationFiles="@(MySourceFiles->'\\build02\wwwroot\Belden.Web.Intranet\$(ProjectDir)%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

I haven't tried this with MVC/WDP, but I imagine it would work the same ...




回答3:


I believe you can: Publish sln. Have a look at the targets. Hopefully it will lead you in the right direction.




回答4:


I also had a look at this a while ago but could but had no luck with publishing targets, maybe because my IIS resided on a different server. Here is how I did it anyway, hope it helps TeamCity deletes files on build have a look at the accepted answer.



来源:https://stackoverflow.com/questions/1162253/can-teamcity-publish-a-web-project-using-the-sln2008-build-runner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!