Skip to content

Instantly share code, notes, and snippets.

@wlgrd
Created September 28, 2014 10:48
Show Gist options
  • Save wlgrd/8b0b5023d30d32b7352f to your computer and use it in GitHub Desktop.
Save wlgrd/8b0b5023d30d32b7352f to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<!--
This files include my first example for MSBuild.
It includes some properties (with condition), items and one target.
Created mostly for future reference.
-->
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Metadata about build script -->
<PropertyGroup>
<ProductVersion>v1.0</ProductVersion>
<!-- By not setting the config string, it will be set to Debug in the next if()-->
<Configuration>Release</Configuration>
<!-- If Configuration == ''; Configuration = Debug -->
<Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
</PropertyGroup>
<!-- Needed project files -->
<PropertyGroup>
<mainFile>main.c</mainFile>
<headerFile>header.h</headerFile>
<compileOutput>program.exe</compileOutput>
</PropertyGroup>
<ItemGroup>
<!-- To differ between e.g. c-files, header files. Can also use wildcards for several files -->
<cFiles Include ="$(mainFile)" />
</ItemGroup>
<Target Name="Build">
<Message Text="====================================="></Message>
<Message Text="Christian's first MSBuild"></Message>
<Message Text="====================================="></Message>
<Message Text="Product version: $(ProductVersion)"></Message>
<Message Text="Configuration: $(Configuration)"></Message>
<Message Text="Msbuild bin path: $(MSBuildBinPath)"></Message>
<Message Text="====================================="></Message>
<!-- -->
<Message Text="Compiling @(cFiles, ', ')"></Message>
<Exec Command ="gcc @(cFiles) -o $(compileOutput)"></Exec>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment