Monday, July 8, 2019

Common project files and custom task creation

General files in a project:
===============
args.rsp
Common.props
Common.targets
DoSomething.proj


Common.targets -- default targets when we invoke proj file.
similarly .properties

In the common targets, we have
<Import Project="Common.props"/>

In the .proj file.
<Import Project="Common.targets"/>

to build a solution (.sln) file.
msbuild <.sln file>


the msbuild will convert vs sln file to msbuild script at runtime.
---
Custom tasks:
we can create our own or use shared by many people(on MSDN).
some tasks can be downloaded 3rd party also.
MSBuild Extension pack in codeplex (msbuildextensionpack.codeplex.com) contains tasks like zipping,vm handling,etc
we need to import the tasks file downloaded into our project file .proj.
<Import Project=".tasks file path"/>



msbuild dosomething.proj /t:PackageStuff

Custom task creation:
----------------
Create a class lirary project in C#.
add reference: Microsoft.Build.Framework (v4) so that we can use ITask.



No comments:

Post a Comment