Reputation: 1404
Class Library compiles into debug folder with their dependencies.How can i automate this project with this scenario:
1.Compile project
2.Delete some additional file such as .pdb in debug folder
3.Modify some aspx file in root (Optional)(removing MasterPage
property in webforms)
4.Zip entire debug folder into a file with some other extension(for example: .foo) apart from usual files.
Upvotes: 0
Views: 340
Reputation: 5636
I assume you do not need assistance with creating the MSBuild
task to satisfy your first criteria.
To delete files and zip, try something like this:
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Target Name="SomeTarget">
<ItemGroup>
<FilesToDelete Include="Path\To\Debug\*.pdb"/>
<DebugApplicationFiles Include="Path\To\Debug\*.*"/>
</ItemGroup>
<Delete Files="@(FilesToDelete)" />
<Zip Files="@(DebugApplicationFiles)"
WorkingDirectory="Path\To\Debug"
ZipFileName="Where\To\Store\Zip\Foo.zip"
ZipLevel="9" />
</Target>
You can obviously store any of these values ("Where\To\Store\Zip" and "Path\To\Debug") in variables defined in a <PropertyGroup>
element, but I omitted those for brevity.
You'd have to give more details on what you mean by modifying an aspx page, but that is generally doable via MSBuild.
The zip task is available via the msbuildtasks project that can be installed via nuget: Install-Package MSBuildTasks
.
Upvotes: 1