Skip to content

Instantly share code, notes, and snippets.

@charlieanstey
Last active January 7, 2020 15:45
Show Gist options
  • Save charlieanstey/fd175f3a6b8b196529a0 to your computer and use it in GitHub Desktop.
Save charlieanstey/fd175f3a6b8b196529a0 to your computer and use it in GitHub Desktop.
Visual Studio :: Skip files like App_Data during deployment, MSBuild,
<PropertyGroup>
<OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
<ItemGroup>
<MsDeploySkipRules Include="SkipDeleteAppData">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipDeleteAppData">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
@JasonRodman
Copy link

Is there a trick to get this to work? It still deletes app_data folder on target machine when using one click publishing from visual studio.

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