Skip to content

Instantly share code, notes, and snippets.

@matijagrcic
Last active December 31, 2015 17:49
Show Gist options
  • Save matijagrcic/8023201 to your computer and use it in GitHub Desktop.
Save matijagrcic/8023201 to your computer and use it in GitHub Desktop.
<PropertyGroup>
<UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>
<PropertyGroup>
<AfterAddIisSettingAndFileContentsToSourceManifest>AddCustomSkipRules</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
<ItemGroup>
<MsDeploySkipRules Include="SkipDownloadsFiles">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>.*\\Content\\UserPictures\\.*$</AbsolutePath>
<XPath></XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipDownloadsFolder">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>.*\\Content\\UserPictures\\.*$</AbsolutePath>
<XPath></XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
Working:
I want to include Remove Additional Files at destination but i don't want to delete the folders
and content from Content\UserPictures\ directory.
It needs to work from VS Publish not command line.
Not working:
In Web Publish dialog Preview is not showing any changes.
@matijagrcic
Copy link
Author

Just tried your solution but it didn't work ;(

I get the

Web deployment task failed. An error occurred when the request was processed on the remote computer.
An error was encountered when processing operation 'Delete Directory' on 'UserPictures'.
I/O error occurred.

Note that in your publish profile you use
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>

while i want this to be

false

so i have used

<UseMsDeployExe>true</UseMsDeployExe>

which allows <SkipAction>Delete</SkipAction> to be used but i suspect that this causes VS Publish preview window and output window to not show any info.

Summary

My solution is working but i would really like Preview window and output window to show detailed info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment