In this walkthrough you will create basic MSBuild project. This project will remove
all object (*.obj) and precompiled header (*.pch) files recursively from given folder;
if the folder is not passed as a parameter, folder defaults to the project location
folder (such script may be useful to remove temprary files from C++ build folders).
Basic knowledge of MSBuild schema is assumed for this walkthrough.
|
- Click on File->New menu or Standard toolbar New button whereupon new
project will be created
|
|
|
- Select project element in project tree view by clicking on it
- Right click on Project element and click on Add PropertyGroup
|
|
|
- Select property group element in project tree view by clicking on it
- Right click on PropertyGroup element and click on Add Property
|
|
|
- Select Property1 element in project tree by clicking on it
- On Properties tab, click on Check for empty value button on
the tab toolbar
|
|
- On Properties tab, set Value property to
"$(MSBuildProjectDirectory)"
|
|
|
- Select project element in project tree view by clicking on it
- Right click on Project element and click Add ItemGroup
|
|
|
- Select item group element in project tree view by clicking on it
- Right click on ht ItemGroup element and click Add Item
|
|
- Select element item in project tree view by clicking on it
- On Properties tab, set Include property to "$(Property1)\**\*.obj; $(Property1)\**\*.pch"
|
|
|
- Select project element in project tree view by clicking on it
- Right click on Project element and click Add Target
|
|
|
- Select target element in project tree view by clicking on it
- Right click on Target element and click Add Task
|
|
- Select Delete task in Add Task dialog list
- Click Add button
- Click Close button
|
|
|
- Select task element in project tree view by clicking on it
- On Properties tab, set Files property to
"@(Item)"
|
|
|
- Select task element in project tree view by clicking on it
- Right click on Delete task element and click on DeletedFiles from
Add Output submenu
|
|
- Select task output parameter element in project tree view by clicking on it
- On Properties tab, set PropertyName property to "deleted"
|
|
|
- Right click on Target element from project tree and choose Add Task
- Select Message task in Add Task dialog tasks list
- Click Add button
- Click Close button
|
|
|
- Select task element in project tree view by clicking on it
- On Properties tab, set Text property to
"$(deleted)"
|
|
|
- Select project element in project tree view by clicking on it
- On Properties tab, set DefaultTargets property to "Target1"
|
|
|
- Click File->Save menu or Standard toolbar Save Project button
|
|
Upon completing the walkthrough, the following MSBuild project was created:
1 <Project
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Target1">
2
<PropertyGroup>
3
<Property1 Condition="'$(Property1)' == ''">$(MSBuildProjectDirectory)</Property1>
4
</PropertyGroup>
5
<ItemGroup>
6
<Item
Include="$(Property1)\**\*.obj;$(Property1)\**\*.pch" />
7
</ItemGroup>
8
<Target
Name="Target1">
9
<Delete
Files="@(Item)">
10
<Output TaskParameter="DeletedFiles" PropertyName="deleted"/>
11
</Delete>
12
<Message
Text="$(deleted)" />
13
</Target>
14 </Project>