I would like to create a script that does some actions, then publish the site to the production, and then runs another script within Visual Studio 2010.
Of course it's possible. I thing that you need MSBuild. It already have a lot default tasks like copying, deleting, etc. Also there are a lot third party tasks for MSBuild like SDCTasks or Community Tasks
For example here the one of various ways to deploy web site (using SDCTasks). In this example both web site solution and web services solution will be builded and in case of success they will be published to some remote server and properly configured with release version configuration files.
<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>
I think that what your looking for would be a macro that would perform the actions before calling publish, then perform some additional actions. If you're using TFS 2010 as well then you could customize a build definition to do what you're looking for as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With