【问题标题】:How can I publish site from command line with some publish profile?如何使用一些发布配置文件从命令行发布站点?
【发布时间】:2011-03-25 16:23:18
【问题描述】:

有点像

msbuild /t:publish [use PublishProfileName] someproject.csproj

【问题讨论】:

    标签: asp.net visual-studio-2010 msbuild


    【解决方案1】:
    msbuild MyProject.csproj /t:PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Release;_PackageTempDir=C:\temp\somelocation;AutoParameterizationWebConfigConnectionStrings=false
    

    MSBuild 2010 - how to publish web app to a specific location (nant)?

    对于 Visual Studio 2012,您可以使用

    msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=Production;Password=foo
    

    ASP.NET Web Deployment using Visual Studio: Command Line Deployment

    【讨论】:

    • 运行该 msbuild 命令后,我的 web.config 以这样的方式结束:
    • @Jhonny 你需要 AutoParameterizationWebConfigConnectionStrings 参数,我已经更新了我的答案。
    【解决方案2】:

    这是实现 Pavel 解决方案但在 MsBuild 文件中使用 MsBuild 目标的替代解决方案:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="build"  
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <PropertyGroup>
            <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
            <OutputDirectory>$(DeploymentProject)\bin\$(Configuration)</OutputDirectory>
            <OutputPath>C:\Inetpub\wwwroot</OutputPath>
        </PropertyGroup>
        <Target Name="build">
            <MSBuild 
            Projects="Your Solution File.sln"
            Properties="Configuration=$(Configuration);DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=$(OutputPath);AutoParameterizationWebConfigConnectionStrings=false"
            >
            </MSBuild>
        </Target>
    </Project>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多