How to: Customize a SharePoint Solution Package by Using MSBuild Targets
You can customize how Visual Studio creates SharePoint package files (.wsp) by using command-line MSBuild targets.
Customizing and Running MSBuild Targets
You can customize MSBuild targets to create a SharePoint package. For example, you can customize the MSBuild properties that specify the packaging intermediate directory and the MSBuild item groups that specify the enumerated files.
To customize the BeforeLayout target
On the File menu, point to Open, and then click File.
Navigate to the project folder.
Click ProjectName.vbproj or ProjectName.csproj file, and then click Open.
Replace <Target Name="BeforeLayout" /> with your custom code. For example, to display a message in this target, add the following code.
<Target Name="BeforeLayout"> <Message Text="In the BeforeLayout Target"></Message> </Target>
To customize the AfterLayout target
On the File menu, point to Open, and then click File.
Navigate to the project folder.
Click ProjectName.vbproj or ProjectName.csproj file, and then click Open.
Replace <Target Name="AfterLayout" /> with your custom code. For example, to display a message in this target, add the following code.
<Target Name="AfterLayout"> <Message Text="In the AfterLayout Target"></Message> </Target>