我们有一个网站项目的解决方案,该项目托管在负载平衡的环境中。目前没有使用CI,部署是使用> _ <zip文件手动进行的,但是我正在设置它,但遇到了一些困难。该解决方案需要一个App_Config文件夹,该文件夹在根目录中包含该站点的所有配置,但是这些配置不同于每个托管服务器,其中一个是管理服务器,另一个是交付服务器。
每个单独的服务器配置都存储在/ Configs / servername /的单独文件夹中,该文件夹包含一个web.config文件和App_Config文件夹。这些已从此文件夹手动复制到根目录,以覆盖已经存在的目录。另外,也不希望部署/ Configs /文件夹。
最好不要对Visual Studio解决方案进行任何更改。
在TeamCity中部署之前是否可以自动执行此操作?
问候
您可能需要根据计算机名称为属性设置不同的值。那是交易的把戏。
<Choose>
<When Condition=" '$(Computername)'=='MyManagementServer01' ">
<PropertyGroup>
<MyCustomProperty001>Red</MyCustomProperty001>
<MyCustomProperty002>Yellow</MyCustomProperty002>
</PropertyGroup>
</When>
<When Condition=" '$(Computername)'=='MyDeliveryServer01' ">
<PropertyGroup>
<MyCustomProperty001>Black</MyCustomProperty001>
<MyCustomProperty002>White</MyCustomProperty002>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<MyCustomProperty001>NoMatchMyCustomProperty001</MyCustomProperty001>
<MyCustomProperty002>NoMatchMyCustomProperty002</MyCustomProperty002>
</PropertyGroup>
</Otherwise>
</Choose>
您可以设置一个名为
<ConfigurationSourceFolder>/Configs/MyManagementServer01/</ConfigurationSourceFolder>
或设置一个“ DeploymentType”
<DeploymentType>ManagementServerType</DeploymentType>
您还可以在“目标”甚至“任务”上放置条件。
<MakeDir Directories="C:\MyCoolDirectory" Condition="('$(MyCustomProperty001)'!='')"/>
////////最好不必对Visual Studio解决方案进行任何更改。//////
因此,这里有一个“一般性”提示。而不是在csproj文件中进行很多自定义的,有时难以遵循的更改....使用基本的.msbuild文件。
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapped">
<PropertyGroup>
<!-- Always declare some kind of "base directory" and then work off of that in the majority of cases -->
<WorkingCheckout>.</WorkingCheckout>
</PropertyGroup>
<Target Name="AllTargetsWrapped">
<CallTarget Targets="BuildItUp" />
</Target>
<Target Name="BuildItUp" >
<MSBuild Projects="$(WorkingCheckout)\MySolution.sln" Targets="Build" Properties="Configuration=$(Configuration)">
<Output TaskParameter="TargetOutputs" ItemName="TargetOutputsItemName"/>
</MSBuild>
<Message Text="BuildItUp completed" />
</Target>
</Project>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句