diff options
Diffstat (limited to 'src/internal/WixBuildTools.MsgGen/build/WixBuildTools.MsgGen.targets')
-rw-r--r-- | src/internal/WixBuildTools.MsgGen/build/WixBuildTools.MsgGen.targets | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/internal/WixBuildTools.MsgGen/build/WixBuildTools.MsgGen.targets b/src/internal/WixBuildTools.MsgGen/build/WixBuildTools.MsgGen.targets new file mode 100644 index 00000000..dfa7bcbe --- /dev/null +++ b/src/internal/WixBuildTools.MsgGen/build/WixBuildTools.MsgGen.targets | |||
@@ -0,0 +1,102 @@ | |||
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="MsgGenSource" /> | ||
12 | </ItemGroup> | ||
13 | |||
14 | <PropertyGroup> | ||
15 | <MsgGenPath Condition=" '$(MsgGenPath)'=='' ">$(MSBuildThisFileDirectory)..\tools\</MsgGenPath> | ||
16 | </PropertyGroup> | ||
17 | |||
18 | <!-- | ||
19 | ================================================================================================ | ||
20 | MsgGen | ||
21 | |||
22 | Generates a .cs class file and a .resx file from an XML file. | ||
23 | |||
24 | [IN] | ||
25 | @(MsgGenSource) - The items to run through the MsgGen tool. | ||
26 | |||
27 | [OUT] | ||
28 | $(IntermediateOutputPath)%(Filename).cs - The generated .cs files to include in the compilation. | ||
29 | $(IntermediateOutputPath)%(MsgGenSource.ResourcesLogicalName) - The generated .resources file to embed in the assembly. | ||
30 | ================================================================================================ | ||
31 | --> | ||
32 | <PropertyGroup> | ||
33 | <MsgGenDependsOn> | ||
34 | PrepareMsgGen | ||
35 | </MsgGenDependsOn> | ||
36 | <PrepareResourcesDependsOn> | ||
37 | MsgGen; | ||
38 | $(PrepareResourcesDependsOn) | ||
39 | </PrepareResourcesDependsOn> | ||
40 | </PropertyGroup> | ||
41 | <Target | ||
42 | Name="MsgGen" | ||
43 | BeforeTargets="PrepareResources" | ||
44 | DependsOnTargets="$(MsgGenDependsOn)" | ||
45 | Condition=" '@(MsgGenSource)' != '' " | ||
46 | Inputs="@(MsgGenSource)" | ||
47 | Outputs="$(IntermediateOutputPath)%(MsgGenSource.Filename).cs; | ||
48 | $(IntermediateOutputPath)%(MsgGenSource.ResourcesLogicalName)"> | ||
49 | |||
50 | <Exec Command=""$(MsgGenPath)WixBuildTools.MsgGen.exe" -nologo "%(MsgGenSource.FullPath)" "$(MsgGenCsFile)" "$(MsgGenResourcesFile)"" | ||
51 | Outputs="$(MsgGenCsFile);$(MsgGenResourcesFile)" /> | ||
52 | |||
53 | <ItemGroup> | ||
54 | <!-- This will tell MSBuild to clean up the .cs and .resources file during a Clean build --> | ||
55 | <FileWrites Include="$(MsgGenCsFile);$(MsgGenResourcesFile)" /> | ||
56 | </ItemGroup> | ||
57 | </Target> | ||
58 | |||
59 | <!-- | ||
60 | ================================================================================================ | ||
61 | PrepareMsgGen | ||
62 | |||
63 | Creates properties and Include items for MsgGen. This must be separate from the MsgGen target | ||
64 | to workaround an MSBuild bug: AdditionalMetadata is ignored when the target is up-to-date. | ||
65 | |||
66 | ================================================================================================ | ||
67 | --> | ||
68 | <Target | ||
69 | Name="PrepareMsgGen" | ||
70 | Condition=" '@(MsgGenSource)' != '' "> | ||
71 | |||
72 | <CreateProperty Value="$(IntermediateOutputPath)%(MsgGenSource.Filename).cs"> | ||
73 | <Output TaskParameter="Value" PropertyName="MsgGenCsFile" /> | ||
74 | </CreateProperty> | ||
75 | |||
76 | <CreateProperty | ||
77 | Value="$(IntermediateOutputPath)%(MsgGenSource.ResourcesLogicalName)" | ||
78 | Condition=" '%(MsgGenSource.ResourcesLogicalName)' != '' "> | ||
79 | |||
80 | <Output TaskParameter="Value" PropertyName="MsgGenResourcesFile" /> | ||
81 | </CreateProperty> | ||
82 | |||
83 | <!-- Add the generated .cs file to the list of source files to compile --> | ||
84 | <CreateItem | ||
85 | Include="$(MsgGenCsFile)" | ||
86 | AdditionalMetadata="Link=%(MsgGenCsFile.Filename)%(MsgGenCsFile.Extension)"> | ||
87 | |||
88 | <Output TaskParameter="Include" ItemName="Compile" /> | ||
89 | </CreateItem> | ||
90 | |||
91 | <!-- Add the generated .resources file to the list of resources to embed --> | ||
92 | <CreateItem | ||
93 | Include="$(MsgGenResourcesFile)" | ||
94 | AdditionalMetadata="Link=%(MsgGenResourcesFile.Filename)%(MsgGenResourcesFile.Extension); | ||
95 | LogicalName=%(MsgGenSource.ResourcesLogicalName)" | ||
96 | Condition=" '$(MsgGenResourcesFile)' != '' "> | ||
97 | |||
98 | <Output TaskParameter="Include" ItemName="EmbeddedResource" /> | ||
99 | </CreateItem> | ||
100 | </Target> | ||
101 | |||
102 | </Project> | ||