如何使用TeamCity模拟VisualStudio发布Web功能

问题描述 投票:0回答:1

Visual Studio(VS)提供了一个“发布Web”功能,您可以从中选择一个配置文件并生成构建artfects - 这可以正常工作,我的Web.config从配置文件(例如web.Test.config)转换。

如果我使用/ p:Configuration =“Test”通过teamcity构建,构建是好的,但我没有看到任何转换 - 我的期望是好的。我确实有octoPack运行集。

我有其他VS项目,我是否使用团队城市来构建nuget包,然后通过Octopus部署到各种环境。八达通进行转型的地方。我认为我混淆了我对团队城市的期望,即它不是对VS的Publish-Web的模仿。即使我不使用章鱼部署到环境中,我必须使用teamcity + octopus这两个步骤来提供输出可交付成果。

visual-studio teamcity
1个回答
0
投票

要使其工作,您必须在发布配置文件* .pubxml中进行配置。然后,在TeamCity中,您应该使用此文件作为构建步骤。下面是一个示例,假设您在Visual Studio中的Debug和Release旁边有Test配置:

Test.pubxml

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <WebPublishMethod>MSDeploy</WebPublishMethod>
        <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
        <Configuration>Test</Configuration>
        <LastUsedBuildConfiguration>Test</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish>http://your-website:8080/</SiteUrlToLaunchAfterPublish>
        <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
        <ExcludeApp_Data>False</ExcludeApp_Data>
        <MSDeployServiceURL>server-name</MSDeployServiceURL>
        <DeployIisAppPath>SITE_NAME_ON_IIS</DeployIisAppPath>
        <RemoteSitePhysicalPath />
        <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
        <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
        <EnableMSDeployBackup>False</EnableMSDeployBackup>
        <UserName>UserNameWithPermission</UserName>
        <_SavePWD>True</_SavePWD>
    </PropertyGroup>
</Project>

命令行参数:

/p:DeployOnBuild=true
/p:PublishProfile="%teamcity.build.workingDir%\PathToConfiguration\Test.pubxml"
/p:SolutionDir="%teamcity.build.workingDir%"
/p:Password=PASSWORD

构建文件路径应该是您的* .csproj文件:

TeamCity Configuration

© www.soinside.com 2019 - 2024. All rights reserved.