MsDeploy Virtual Directory gets converted to Virtual Application on deploy

你离开我真会死。 提交于 2019-12-23 17:23:48

问题


For my CMS to work properly it needs to be deployed to a virtual directory underneath the www root so it can access (via reflection) the website to manage (note: CMS = N2CMS). When using Visual Studio 'Publish To Web' all is fine. But when I generate the package via msbuild commandline and publish that version my virtual directory is converted to a virtual application.

I configured my remote server to have a virtual directory '/n2' underneath my IIS web application ('exampleapp') and configured this path in the Package/Publish Web settings (IIS Website/Application name to use on the destination server) within my project in Visual Studio.

To generate the deploy package:

msbuild.exe myproject.csproj /T:Package

This generates the zipped package of my code together with MsDeploy commandline batch files to execute (standard msbuild/msdeploy target).

The generated SetParameters.xml contains the following:

<?xml version="1.0" encoding="utf-8"?>
<parameters>
  <setParameter name="IIS Web Application Name" value="exampleapp/n2" />
</parameters>

The generated SourceManifest.xml contains the following

<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
  <IisApp path="C:\...shortened-path...\PackageTmp" managedRuntimeVersion="v4.0" />
  <setAcl path="C:\...shortened-path...\PackageTmp" setAclResourceType="Directory" />
  <setAcl path="C:\...shortened-path...\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>

Anybody got a clue why the virtual directory gets converted to virtual application?


回答1:


In the Microsoft.Web.Publishing.targets file, DeployAsIisApp defaults to true:

<DeployAsIisApp Condition="'$(DeployAsIisApp)'==''">true</DeployAsIisApp>

You should be able to override it to false by adding it to the appropriate PropertyGroup element in the project file or in a .wpp.targets file in the project folder; on editing the project file, see

http://msdn.microsoft.com/en-us/library/ff398069.aspx




回答2:


I've got success with the following combination of deployment parameters (in csproj) when publish web application project (WAP) to the virtual directory without marking it as IIS application:

<DeployOnBuild>True</DeployOnBuild>
<DeployAsIisApp>False</DeployAsIisApp>
<DeployIisAppPhysicalPath>MyWebSite/MyVirtualDirectory</DeployIisAppPhysicalPath>


来源:https://stackoverflow.com/questions/9329263/msdeploy-virtual-directory-gets-converted-to-virtual-application-on-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!