How to create scripts for publication and publication after publication in VS2010

I would like to create a script that takes some action, then publishes the site to create, and then runs another script.

Is this possible in VS2010?

Thank!

+3
source share
2 answers

Of course it is possible. I believe you need MSBuild . He already has many default tasks , such as copying, deleting, etc. There are also many third-party tasks for MSBuild, such as SDCTasks or Community Tasks

, - ( SDCTasks). - -, - .

   <Import Project="$(MSBuildExtensionsPath)\SDCTasks\Microsoft.Sdc.CommonWOBizTalk.tasks"/>
    ...
    <ItemGroup>
        <SolutionToBuild Include="$(BuildProjectFolderPath)/../../website.sln">
            <Targets></Targets>
            <Properties></Properties>
        </SolutionToBuild>

        <SolutionToBuild Include="$(BuildProjectFolderPath)/../../services.sln">
            <Targets></Targets>
            <Properties></Properties>
        </SolutionToBuild>

    </ItemGroup>

  <PropertyGroup>
    <PublishFolder>\\myservername\deployto</PublishFolder>
  </PropertyGroup>

  <Target Name="AfterCompile" DependsOnTargets="PublishWebSite;PublishServices;SetConfiguration"/>

  <Target Name="PublishWebSite">
    <Folder.CleanFolder Path="$(PublishFolder)" Force="True" />
    <Folder.CopyFolder Source="$(OutDir)_PublishedWebsites\MyWebSite" Destination="$(PublishFolder)" />
  </Target> 

  <Target Name="PublishServices">
    <MakeDir Directories="$(PublishFolder)\Services"/>
    <Folder.CopyFolder Source="$(OutDir)_PublishedWebsites\MyService" Destination= "$(PublishFolder)\ Services" />
  </Target>

  <Target Name="SetConfiguration">
      <Copy SourceFiles="$(OutDir)_PublishedWebsites\MyWebSite\WebRelease.config" DestinationFiles="$(PublishFolder)\web.config" />
      <Copy SourceFiles="$(OutDir)_PublishedWebsites\MyService\WebRelease.config" DestinationFiles="$(PublishFolder)\Services\web.config" />
  </Target>
+3

, , , . TFS 2010, , , .

0

Source: https://habr.com/ru/post/1776083/


All Articles