| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> |
| 3 | |
| 4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
| 5 | <ItemGroup> |
| 6 | <!--Provide support for setting type (BuildAction) from VS--> |
| 7 | <AvailableItemName Include="XsdGenSource" /> |
| 8 | </ItemGroup> |
| 9 | |
| 10 | <PropertyGroup> |
| 11 | <!-- <XsdGenPath Condition=" '$(XsdGenPath)'=='' and '$(MSBuildRuntimeType)'=='Core' ">$(MSBuildThisFileDirectory)..\tools\core\</XsdGenPath> --> |
| 12 | <XsdGenPath Condition=" '$(XsdGenPath)'=='' ">$(MSBuildThisFileDirectory)..\tools\full\</XsdGenPath> |
| 13 | </PropertyGroup> |
| 14 | |
| 15 | <!-- |
| 16 | ================================================================================================ |
| 17 | XsdGen |
| 18 | |
| 19 | Generates a .cs class file from an .xsd file. |
| 20 | |
| 21 | [IN] |
| 22 | @(XsdGenSource) - The items to run through the XsdGen tool. |
| 23 | |
| 24 | [OUT] |
| 25 | $(IntermediateOutputPath)%(Filename).cs - The generated .cs files to include in the compilation. |
| 26 | ================================================================================================ |
| 27 | --> |
| 28 | <PropertyGroup> |
| 29 | <XsdGenDependsOn> |
| 30 | </XsdGenDependsOn> |
| 31 | <PrepareResourcesDependsOn> |
| 32 | XsdGen; |
| 33 | $(PrepareResourcesDependsOn) |
| 34 | </PrepareResourcesDependsOn> |
| 35 | </PropertyGroup> |
| 36 | <Target |
| 37 | Name="XsdGen" |
| 38 | BeforeTargets="PrepareResources" |
| 39 | DependsOnTargets="$(XsdGenDependsOn)" |
| 40 | Condition=" '@(XsdGenSource)' != '' " |
| 41 | Inputs="@(XsdGenSource)" |
| 42 | Outputs="$(IntermediateOutputPath)%(XsdGenSource.Filename).cs"> |
| 43 | |
| 44 | <PropertyGroup> |
| 45 | <XsdGenCsFile>$(IntermediateOutputPath)%(XsdGenSource.Filename).cs</XsdGenCsFile> |
| 46 | <XsdGenCommonNamespace>%(XsdGenSource.CommonNamespace)</XsdGenCommonNamespace> |
| 47 | </PropertyGroup> |
| 48 | |
| 49 | <Exec Command=""$(XsdGenPath)WixBuildTools.XsdGen.exe" "%(XsdGenSource.FullPath)" "$(XsdGenCsFile)" %(XsdGenSource.Namespace) $(XsdGenCommonNamespace)" |
| 50 | Outputs="$(XsdGenCsFile)" /> |
| 51 | |
| 52 | <ItemGroup> |
| 53 | <!-- This will tell MSBuild to clean up the .cs file during a Clean build --> |
| 54 | <FileWrites Include="$(XsdGenCsFile)" /> |
| 55 | |
| 56 | <!-- Add the generated .cs file to the list of source files to compile --> |
| 57 | <Compile Include="$(XsdGenCsFile)"> |
| 58 | <Link>%(XsdGenCsFile.Filename)%(XsdGenCsFile.Extension)</Link> |
| 59 | </Compile> |
| 60 | </ItemGroup> |
| 61 | </Target> |
| 62 | |
| 63 | </Project> |