MS Web Deploy在网站下创建新文件夹?

时间:2016-05-05 16:11:27

标签: msbuild webdeploy microsoft-web-deploy

我使用post here将MVC5应用程序部署到IIS 8.在IIS中我有一个网站“默认网站”,它指向物理位置“C:\ Inetpub \ wwwroot \ mywebsite” 我的构建文件如下所示

    <?xml version="1.0" encoding="utf-8"?>
        <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build" ToolsVersion="4.0">
          <PropertyGroup>
            <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
            <ProjectFile Condition=" '$(ProjectFile)' == '' ">.\UI\$(ProjectName)\$(ProjectName).csproj</ProjectFile>
            <DeployServiceUrl Condition=" '$(DeployServiceUrl)' == '' ">http://localhost</DeployServiceUrl>
          </PropertyGroup>

          <Target Name="VerifyProperties">
            <!-- Verify that we have values for all required properties -->
            <Error Condition=" '$(ProjectName)' == '' " Text="ProjectName is required." />
          </Target>

          <Target Name="Build" DependsOnTargets="VerifyProperties">
            <!-- Deploy using windows authentication -->
            <MSBuild Projects="$(ProjectFile)"
                     Properties="Configuration=$(Configuration);
                                     MvcBuildViews=False;
                                     DeployOnBuild=true;
                                     DeployTarget=MSDeployPublish;
                                     CreatePackageOnPublish=True;
                                     AllowUntrustedCertificate=True;
                                     MSDeployPublishMethod=RemoteAgent;
                                     MsDeployServiceUrl=$(DeployServiceUrl);
                                     SkipExtraFilesOnServer=True;
                                     UserName=;
                                     Password=;"
                     ContinueOnError="false" />
          </Target>
        </Project>

我正在运行以下命令来构建&amp;部署

msbuild build.xml /p:Configuration=Release;ProjectName=MyProjectName;DeployServiceUrl=http://localhost

该命令构建项目并部署项目。但是,它不直接在“默认网站”下部署项目,而是在“默认网站”下创建一个名为“MyProjectName_deploy”的新应用程序,此应用程序指向新的物理位置。的 “C:\的Inetpub \ wwwroot的\ mywebsite \ MyProjectName_deploy”

我希望代码直接部署到“默认网站”指向的C:\ inetpub \ wwwroot \ mywebsite。

1 个答案:

答案 0 :(得分:0)

将以下内容添加到构建文件中:

<PropertyGroup>
  <DeployIisAppPath>Default Web Site</DeployIisAppPath>
</PropertyGroup>

相关细节 - https://dotnetcatch.com/2016/03/03/simple-service-versioning-with-webdeploy/