c# - MSBuild How to pass same task to multiple projects -


i wanting run same task on multiple projects 1 build file without having copy task each project file.

i getting project files in solution and:

<itemgroup>     <projectstobuild include="..\modules\**\*csproj"/> </itemgroup> 

i calling msbuild task on each projecttobuild

<msbuild projects ="@(projectstobuild)"               targets="dostuff"              continueonerror ="false"               properties="configuration=$(configuration)">     <output itemname="outputfiles" taskparameter="targetoutputs"/> </msbuild> 

this doesn't work, target must exist in project building.

from msdn

the targets must occur in project files. if not, build error occurs.

is there way can pass dostuff task projects being passed msbuild task?

would msbuild import element help?

https://msdn.microsoft.com/en-us/library/92x05xfs.aspx

just put tasks common task file, , import each of projects.

i not believe there way "inject" task other projects.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -