Dav*_*mit 3 asp.net msbuild visual-studio-2012 publish-profiles
我通过visual studio通过PublishProfile发布我的MVC项目(通过UI,右键单击项目,发布)并勾选清除目标文件夹的选项.但我不希望清除特定文件夹"下载"
我花了无数个小时试图完成这项工作,我想我的代码与此处解释的完全相同,但它仍然会删除"下载"文件夹
另外作为下面的示例,我有"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>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
(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>
Run Code Online (Sandbox Code Playgroud)
(2)从Visual Studio中发布时,不能使用自定义跳过规则.您必须从命令提示符使用MSBuild发布.我的问题的本质是将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"
Run Code Online (Sandbox Code Playgroud)
如果我尝试从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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2479 次 |
| 最近记录: |