Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've never approached this problem from the solution level - you don't have a lot of control when calling msbuild against a solution file.</p> <p>Instead, I've typically approached this by having each project in the solution import another msbuild file that contains all the common targets. This gives you a lot of fine-grained control over what each project will do, since you were mentioning that each project in the solution does not need to do all the extra tasks.</p> <pre><code>&lt;Import Project="_pathToCommonTargets_" /&gt; </code></pre> <p>After importing the common targets, you can control what happens with hooks into the build project - i.e. overridable targets that occur at specific points when "Build" is called on that project. Additionally, you can create new targets in the common targets file that you can just call instead of the build target, for when you're building outside of Visual Studio.</p> <pre><code>&lt;Target Name="AfterBuild" &gt; &lt;!-- Other tasks here --&gt; &lt;!-- Calling a common target --&gt; &lt;CallTarget Target="_commonTargetName_" /&gt; &lt;/Target&gt; </code></pre> <p>Also, I wouldn't recommend using something like XPath to determine what nodes are in each project file. It would be much cleaner to use the functionalities incorporated in msbuild. For example, you can check whether properties are set (children of propertyGroup nodes) and perform operations against collections (children of itemGroup nodes.)</p> <ul> <li>Msbuild homepage: <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx</a></li> <li>Msbuild overridable custom targets: <a href="http://msdn.microsoft.com/en-us/library/aa337604.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa337604.aspx</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload