0

I am using the post here to deploy MVC5 application to IIS 8. In IIS i have a web site "Default Web Site" which is pointed to physical location "C:\Inetpub\wwwroot\mywebsite" My build file look like below

    <?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>

I'm running the following command to build & deploy

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

The command builds the project and deploys the project. However it is not deploying the project directly under "Default Web Site" instead its creating a new application under "Default Web Site" with the name "MyProjectName_deploy" and this application is pointing to new physical location. "C:\inetpub\wwwroot\mywebsite\MyProjectName_deploy"

I want the code to deploy directly to C:\inetpub\wwwroot\mywebsite where "Default Web Site" is pointing.

Community
  • 1
  • 1
LP13
  • 30,567
  • 53
  • 217
  • 400

1 Answers1

0

Add the following to your build file:

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

Related details - https://dotnetcatch.com/2016/03/03/simple-service-versioning-with-webdeploy/

chief7
  • 14,263
  • 14
  • 47
  • 80