gpt4 book ai didi

asp.net - wpp.targets 中的 MsDeploySkipRules 不适用于 PublishProfiles

转载 作者:行者123 更新时间:2023-12-01 11:42:30 29 4
gpt4 key购买 nike

我正在通过 Visual Studio(通过 UI、右键单击项目、发布)使用 PublishProfile 发布我的 MVC 项目,并勾选清除目标文件夹的选项。
但我不希望清除特定文件夹“下载”

我花了无数个小时试图使这项工作,我想我的代码与解释的人完全相同here但它仍然删除下载文件夹

同样作为下面的示例,我有“favicon”的 ExcludeFromPackageFiles,如果我取消选择删除目标文件夹(只是为了表明我的 wpp 目标实际上正在运行),它会起作用。

下面是我的 projectname.wpp.targets 文件

<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- this doesnt work -->
<PropertyGroup>
<AfterAddIisSettingAndFileContentsToSourceManifest>AddCustomSkipRules</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>

<PropertyGroup>
<UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>

<Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
<MsDeploySkipRules Include="SkipErrorLogFolder1">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>ErrorLog</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
</Target>

<!-- this works! -->
<ItemGroup>
<ExcludeFromPackageFiles Include="favicon.ico">
<FromTarget>ContactManager.Mvc.wpp.targets</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>

</Project>

有任何想法吗?

最佳答案

(1) AbsolutePath您示例中的值是从我的跳过规则示例中复制/粘贴的。您需要将该值更改为您的路径 Downloads文件夹。

  <Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
<MsDeploySkipRules Include="SkipDownloadsFolder">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>Downloads</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
</Target>

(2) 你 不能 从 Visual Studio 中发布时使用自定义跳过规则。您必须从命令提示符使用 MSBuild 进行发布。 my question的性质是关于将 VS 中管理的发布配置文件的便利性与自定义跳过规则(需要命令行)的实用程序相结合,因为从 VS 2012 Update 3 开始,命令行的限制尚未解除。

我的 MSBuild 命令如下所示:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe My.Website.sln /p:Configuration=Release;DeployOnBuild=true;PublishProfile="Test Server - Web Deploy"

如果我尝试从 VS 2012 中发布,我会收到以下错误,即使“-verb:sync”在输出中清晰可见:
2>Start Web Deploy Publish the Application/package to http://my.website.example.com/MSDEPLOYAGENTSERVICE ...
2>C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe
-source:manifest='C:\inetpub\wwwroot\My.Website\obj\Release\Package\My.Website.SourceManifest.xml'
-dest:auto,ComputerName='http://my.website.example.com/MSDEPLOYAGENTSERVICE',UserName='...',Password="...",IncludeAcls='False',AuthType='NTLM'
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-skip:skipaction='Delete',objectname='filePath',absolutepath='ErrorLog'
-skip:objectname='dirPath',absolutepath='obj\\Release\\Package\\PackageTmp\\App_Data$'
-skip:objectname='dirPath',absolutepath='MyWebsite/\\App_Data$'
-setParamFile:"C:\inetpub\wwwroot\My.Website\obj\Release\Package\My.Website.Publish.Parameters.xml"
-retryAttempts=2
2>MSDEPLOY(0,0): Error : The verb must be specified by using the -verb argument.
2>MSDEPLOY(0,0): Error count: 1.

关于asp.net - wpp.targets 中的 MsDeploySkipRules 不适用于 PublishProfiles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18226048/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com