Skip to content

Instantly share code, notes, and snippets.

@phongbv
Created April 26, 2020 13:41
Show Gist options
  • Save phongbv/0997e3eb9b5c55336e0ffdca26175a5e to your computer and use it in GitHub Desktop.
Save phongbv/0997e3eb9b5c55336e0ffdca26175a5e to your computer and use it in GitHub Desktop.
An example Visual Studio pubxml file to zip the output and exclude file when publishing an ASP.NET web application to file system
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Publish\SimpleExample</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
<Target Name="ZipPublishOutput" AfterTargets="GatherAllFilesToPublish">
<Exec Command='powershell -nologo -noprofile -command "Get-ChildItem -path $(WPPAllFilesInSingleFolder)\* -Exclude web.config | compress-archive -force -destinationpath $(publishUrl).zip"' />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment