我在这里使用帖子将 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>
我正在运行以下命令来构建和部署
msbuild build.xml /p:Configuration=Release;ProjectName=MyProjectName;DeployServiceUrl=http://localhost
该命令构建项目并部署项目。但是,它没有直接在“默认网站”下部署项目,而是在“默认网站”下创建一个名为“MyProjectName_deploy”的新应用程序,并且该应用程序指向新的物理位置。"C:\inetpub\wwwroot\mywebsite\MyProjectName_deploy"
我希望代码直接部署到“默认网站”指向的 C:\inetpub\wwwroot\mywebsite。