diff options
Diffstat (limited to 'src/internal/WixBuildTools.XsdGen/build/WixBuildTools.XsdGen.targets')
-rw-r--r-- | src/internal/WixBuildTools.XsdGen/build/WixBuildTools.XsdGen.targets | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/internal/WixBuildTools.XsdGen/build/WixBuildTools.XsdGen.targets b/src/internal/WixBuildTools.XsdGen/build/WixBuildTools.XsdGen.targets new file mode 100644 index 00000000..ca1b89f6 --- /dev/null +++ b/src/internal/WixBuildTools.XsdGen/build/WixBuildTools.XsdGen.targets | |||
@@ -0,0 +1,67 @@ | |||
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 | <PropertyGroup> | ||
6 | <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> | ||
7 | </PropertyGroup> | ||
8 | |||
9 | <ItemGroup> | ||
10 | <!--Provide support for setting type (BuildAction) from VS--> | ||
11 | <AvailableItemName Include="XsdGenSource" /> | ||
12 | </ItemGroup> | ||
13 | |||
14 | <PropertyGroup> | ||
15 | <!-- <XsdGenPath Condition=" '$(XsdGenPath)'=='' and '$(MSBuildRuntimeType)'=='Core' ">$(MSBuildThisFileDirectory)..\tools\core\</XsdGenPath> --> | ||
16 | <XsdGenPath Condition=" '$(XsdGenPath)'=='' ">$(MSBuildThisFileDirectory)..\tools\full\</XsdGenPath> | ||
17 | </PropertyGroup> | ||
18 | |||
19 | <!-- | ||
20 | ================================================================================================ | ||
21 | XsdGen | ||
22 | |||
23 | Generates a .cs class file from an .xsd file. | ||
24 | |||
25 | [IN] | ||
26 | @(XsdGenSource) - The items to run through the XsdGen tool. | ||
27 | |||
28 | [OUT] | ||
29 | $(IntermediateOutputPath)%(Filename).cs - The generated .cs files to include in the compilation. | ||
30 | ================================================================================================ | ||
31 | --> | ||
32 | <PropertyGroup> | ||
33 | <XsdGenDependsOn> | ||
34 | </XsdGenDependsOn> | ||
35 | <PrepareResourcesDependsOn> | ||
36 | XsdGen; | ||
37 | $(PrepareResourcesDependsOn) | ||
38 | </PrepareResourcesDependsOn> | ||
39 | </PropertyGroup> | ||
40 | <Target | ||
41 | Name="XsdGen" | ||
42 | BeforeTargets="PrepareResources" | ||
43 | DependsOnTargets="$(XsdGenDependsOn)" | ||
44 | Condition=" '@(XsdGenSource)' != '' " | ||
45 | Inputs="$(MSBuildAllProjects);@(XsdGenSource)" | ||
46 | Outputs="$(IntermediateOutputPath)%(XsdGenSource.Filename).cs"> | ||
47 | |||
48 | <PropertyGroup> | ||
49 | <XsdGenCsFile>$(IntermediateOutputPath)%(XsdGenSource.Filename).cs</XsdGenCsFile> | ||
50 | <XsdGenCommonNamespace>%(XsdGenSource.CommonNamespace)</XsdGenCommonNamespace> | ||
51 | </PropertyGroup> | ||
52 | |||
53 | <Exec Command=""$(XsdGenPath)WixBuildTools.XsdGen.exe" "%(XsdGenSource.FullPath)" "$(XsdGenCsFile)" %(XsdGenSource.Namespace) $(XsdGenCommonNamespace)" | ||
54 | Outputs="$(XsdGenCsFile)" /> | ||
55 | |||
56 | <ItemGroup> | ||
57 | <!-- This will tell MSBuild to clean up the .cs file during a Clean build --> | ||
58 | <FileWrites Include="$(XsdGenCsFile)" /> | ||
59 | |||
60 | <!-- Add the generated .cs file to the list of source files to compile --> | ||
61 | <Compile Include="$(XsdGenCsFile)"> | ||
62 | <Link>%(XsdGenCsFile.Filename)%(XsdGenCsFile.Extension)</Link> | ||
63 | </Compile> | ||
64 | </ItemGroup> | ||
65 | </Target> | ||
66 | |||
67 | </Project> | ||