Importing Files

MSBuild natively supports importing project files or targets. In fact, this is how Visual Studio builds your projects. In this section, we will see how this works and how you can take advantage of it in your build process. To reuse the contents of other files you must use the Import element. This element must be placed directly inside the Project element, at the same level as a Target. You specify the file that is to be imported by using the Project attribute. The only other attribute that can be placed on the Import element is the Condition attribute, as with most other MSBuild elements. These are the only two attributes that can be specified for the Import element. If you take a look at any C# project created by Visual Studio ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.