Skip to content

Instantly share code, notes, and snippets.

@sihugh
Created May 13, 2015 13:07
Show Gist options
  • Save sihugh/db29516d43f025788dc0 to your computer and use it in GitHub Desktop.
Save sihugh/db29516d43f025788dc0 to your computer and use it in GitHub Desktop.
Build target example to build a WSP using an MSBuild target
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Include this step after the current build "depends on" list -->
<BuildDependsOn>
$(BuildDependsOn);
CreateWSP;
</BuildDependsOn>
<BinStash>$(SolutionDir)Bin\</BinStash>
<PostBuildEvent></PostBuildEvent>
</PropertyGroup>
<Target Name="CreateWSP" Inputs="@(None);@(Content);$(OutDir)$(TargetFileName)" Outputs="$(OutDir)$(ProjectName).wsp">
<PropertyGroup>
<ConfigFolder>$(ProjectDir)bin\$(ConfigurationName)</ConfigFolder>
</PropertyGroup>
<MakeDir Directories="$(ConfigFolder)" Condition="!Exists('$(ConfigFolder)')" />
<!-- For building when the output directory is not necessarily under the project root -->
<Copy SourceFiles="$(BinStash)$(TargetFileName)" DestinationFolder="$(ConfigFolder)" Condition="!Exists('ConfigFolder)$(TargetFileName)')" />
<Exec Command="$(SolutionDir)Tools\WSPBuilder.exe -CreateWSPFileList &quot;$(ProjectName).wspcontents.txt&quot;" WorkingDirectory="$(ProjectDir)" />
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment