本文介绍了VS2010 Web Deploy:如何删除绝对路径并自动执行setAcl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2010中集成的Web部署非常不错.它可以创建一个程序包,准备使用MSDeploy在目标IIS计算机上进行部署.问题是,此软件包将重新分发给客户端,该客户端将在安装MSDeploy时使用IIS中的导入应用程序"自己安装.

The integrated Web Deployment in Visual Studio 2010 is pretty nice. It can create a package ready to be deployed using MSDeploy on a target IIS machine. Problem is, this package will be redistributed to a client that will install it himself using the "Import Application" from IIS when MSDeploy is installed.

创建的默认软件包始终在源清单文件中包含开发计算机的完整路径"D:\ Dev \ XXX \ obj \ Debug \ Package \ PackageTmp".由于它是通过这种方式设计的,因此它当然不会阻止安装,但是在导入对话框中看起来很丑陋,对客户端没有任何意义.更糟糕的是,他会想知道这些路径是什么,而且看起来很混乱.

The default package created always include the full path from the development machine, "D:\Dev\XXX\obj\Debug\Package\PackageTmp" in the source manifest file. It doesn't prevent installation of course since it was designed this way, but it looks ugly in the import dialog and has no meaning to the client. Worse he will wonder what are those paths and it looks quite confusing.

通过自定义.csproj文件(通过添加包创建任务使用的MSBuild属性),我设法向包中添加了其他参数.但是,我花了整个下午的大部分时间在2600行长的Web.Publishing.targets中,试图弄明白什么参数影响了开发路径"的行为,但徒劳无功.我还尝试在部署后使用setAcl在给定文件夹上自定义安全性,但是我只能通过使用相对路径来通过MSBuild做到这一点……尽管我解决了第一个问题也没关系.

By customizing the .csproj file (by adding MSBuild properties used by the package creation task), I managed to add additional parameters to the package. However, I spent most of the afternoon in the 2600 lines long Web.Publishing.targets trying to understand what parameter influenced the "development path" behavior, in vain. I also tried to use the setAcl to customize security on a given folder after deployment, but I only managed to do this with MSBuild by using a relative path... it shouldn't matter if I resolve the first problem though.

我可以在生成的归档文件创建后对其进行修改,但是如果所有内容都使用MSBuild进行了自动化,则我更愿意.有人知道怎么做吗?

I could modify the generated archive after its creation but I would prefer if everything was automatized using MSBuild. Does anyone know how to do that?

推荐答案

显示的路径由属性_MSDeployDirPath_FullPath确定.

The displayed path is determined by the property _MSDeployDirPath_FullPath.

此属性由以下属性链设置:

This property is setted by this chain of properties:

  • <_MSDeployDirPath_FullPath>@(_MSDeployDirPath->'%(FullPath)')</_MSDeployDirPath_FullPath>
  • <_MSDeployDirPath Include="$(_PackageTempDir)" />
  • <_PackageTempDir>$(PackageTempRootDir)\PackageTmp</_PackageTempDir>
  • <PackageTempRootDir>$(IntermediateOutputPath)Package</PackageTempRootDir>
  • <_MSDeployDirPath_FullPath>@(_MSDeployDirPath->'%(FullPath)')</_MSDeployDirPath_FullPath>
  • <_MSDeployDirPath Include="$(_PackageTempDir)" />
  • <_PackageTempDir>$(PackageTempRootDir)\PackageTmp</_PackageTempDir>
  • <PackageTempRootDir>$(IntermediateOutputPath)Package</PackageTempRootDir>

_MSDeployDirPath_FullPath <-- @(_MSDeployDirPath->'%(FullPath)') <-- _PackageTempDir <-- $(PackageTempRootDir)\PackageTmp

您没有相对路径,因为_MSDeployDirPath_FullPath_MSDeployDirPath的完整路径.

AS you can see, you can't have a relative path, because _MSDeployDirPath_FullPath is the fullpath of _MSDeployDirPath.

但是您可以通过使用要向客户显示的路径覆盖属性来简化显示的路径 _PackageTempDir. (此路径将用作软件包生成的临时目录)

But you can simplify the displayed path by overriding the property _PackageTempDir with the path you want to be displayed to your customer. (This path will be used as a temporary directory for the package generation)

您可以覆盖属性:

  • 在命令行中:

  • In command line :

msbuild.exe projectfile.csproj /t:Package /p:_PackageTempDir=C:\Package

  • 或直接在项目文件中:

  • Or directly in the project file :

    <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
    
    <!-- Must be after Microsoft.WebApplication.targets import -->
    <PropertyGroup>
      <_PackageTempDir>C:\Package</_PackageTempDir>
    </PropertyGroup>
    

  • 这篇关于VS2010 Web Deploy:如何删除绝对路径并自动执行setAcl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    10-22 07:51