This requires editing your phpproj file and some knowledge of MSBUILD.
In order to edit your phpproj file:
- Right-click your project ("MyPhpSite") and select "Unload Project".
- Right-click your project again and select "edit MyPhpSite.phpproj"
at the end of the file, enter the following to pull in the "Build" target:
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
Since I'm not sure exactly how you plan on using the zip file, I'll assume you just want to have it available for download from Visual Studio Online.
Add an inline task for zipping the file.
<UsingTask TaskName="Zip" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFileFolder ParameterType="System.String" Required="true" />
<OutputFileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.IO.Compression" />
<Using Namespace="System.IO.Compression" />
<Code Type="Fragment" Language="cs">
<![CDATA[
ZipFile.CreateFromDirectory(InputFolderName, OutputFileName);
]]>
</Code>
</Task>
</UsingTask>
set the following PropertyGroup and ItemGroup
<PropertyGroup>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Payload Include="$(OutputPath)$(Name)" />
</ItemGroup>
Set the following targets, the last one being the one that moves the files to a single location and then zips them up.
<Target Name="CreateManifestResourceNames" />
<Target Name="CoreCompile" />
<Target Name="CopyFilesToOutputDirectory">
<MakeDir Directories="$(OutputPath)$(Name)" />
<Copy SourceFiles="@(Compile)" DestinationFiles="$(OutputPath)$(Name)\%(Identity)" />
<Copy SourceFiles="@(Content)" DestinationFiles="$(OutputPath)$(Name)\%(Identity)" />
<Zip InputFolderName="@Payload" OutputFileName="$(OutputPath)$(Name).zip/>
</Target>
The Blank targets are there in order to keep MSBuild from throwing an error.
This will get you to having a successful build that ends in a zip file to download.