aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2018-08-11 01:12:28 -0700
committerRob Mensching <rob@firegiant.com>2018-08-11 01:12:28 -0700
commitf34941825894d44059a560d9f95016ac97803504 (patch)
tree2d81fa80cefb53d8a41b335679196d046baff292 /src
parentc7d69b36789b6403f5b02a975afad80f6b23b48b (diff)
downloadwix-f34941825894d44059a560d9f95016ac97803504.tar.gz
wix-f34941825894d44059a560d9f95016ac97803504.tar.bz2
wix-f34941825894d44059a560d9f95016ac97803504.zip
Fix Build and Clean targets
Diffstat (limited to '')
-rw-r--r--src/WixToolset.BuildTasks/wix.signing.targets126
-rw-r--r--src/WixToolset.BuildTasks/wix.targets126
-rw-r--r--src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs33
-rw-r--r--src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs119
-rw-r--r--src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj14
-rw-r--r--src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs64
-rw-r--r--src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj1
7 files changed, 256 insertions, 227 deletions
diff --git a/src/WixToolset.BuildTasks/wix.signing.targets b/src/WixToolset.BuildTasks/wix.signing.targets
index 6351cc8b..7c25175f 100644
--- a/src/WixToolset.BuildTasks/wix.signing.targets
+++ b/src/WixToolset.BuildTasks/wix.signing.targets
@@ -1,18 +1,15 @@
1<?xml version="1.0" encoding="utf-8"?> 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. --> 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 3
4
5<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 4<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6
7 <!-- These properties can be overridden to support non-default installations. -->
8 <PropertyGroup> 5 <PropertyGroup>
9 <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildThisFileFullPath)</WixTargetsPath> 6 <SignedFileName Condition=" '$(SignedFileName)' == '' ">$(MSBuildProjectFile).Signed.txt</SignedFileName>
10 <WixTasksPath Condition=" '$(WixTasksPath)' == '' ">$(WixTargetsPath)WixTasks.dll</WixTasksPath> 7 <SignedFilePath>$(IntermediateOutputPath)$(SignedFileName)</SignedFilePath>
11
12 <SignedFile Condition=" '$(SignedFile)' == '' ">$(MSBuildProjectFile).Signed.txt</SignedFile>
13 </PropertyGroup> 8 </PropertyGroup>
14 9
15 <UsingTask TaskName="Insignia" AssemblyFile="$(WixTasksPath)" /> 10 <UsingTask TaskName="Insignia" AssemblyFile="$(WixTasksPath)" />
11 <UsingTask TaskName="GetCabList" AssemblyFile="$(WixTasksPath)" />
12 <UsingTask TaskName="GetLooseFileList" AssemblyFile="$(WixTasksPath)" />
16 13
17 <!-- Default Inscribe properties. --> 14 <!-- Default Inscribe properties. -->
18 <PropertyGroup> 15 <PropertyGroup>
@@ -51,49 +48,57 @@
51 </InternalSignDependsOn> 48 </InternalSignDependsOn>
52 49
53 <SigningDependsOn> 50 <SigningDependsOn>
54 CompileAndLink; 51 WixBuild;
52 CalculateSignTargetFiles;
55 BeforeSigning; 53 BeforeSigning;
56 $(InternalSignDependsOn); 54 $(InternalSignDependsOn);
57 AfterSigning 55 AfterSigning
58 </SigningDependsOn> 56 </SigningDependsOn>
59 </PropertyGroup> 57 </PropertyGroup>
60 <Target 58 <Target
61 Name="Signing" 59 Name="Signing"
62 DependsOnTargets="$(SigningDependsOn)" 60 DependsOnTargets="$(SigningDependsOn)"
63 Inputs="@(SignTargetPath)" 61 Inputs="$(TargetPath)"
64 Outputs="$(IntermediateOutputPath)$(SignedFile)" 62 Outputs="$(SignedFilePath)"
65 Condition=" '@(SignTargetPath)' != '' "> 63 Condition=" '$(SignOutput)' == 'true' ">
66 64
67 <CreateItem Include="$(IntermediateOutputPath)$(SignedFile)"> 65 <ItemGroup>
68 <Output TaskParameter="Include" ItemName="FileWrites" /> 66 <FileWrites Include="$(SignedFilePath)" />
69 </CreateItem> 67 </ItemGroup>
70 68
71 <WriteLinesToFile 69 <WriteLinesToFile
72 File="$(IntermediateOutputPath)$(SignedFile)" 70 File="$(SignedFilePath)"
73 Lines="^$(MSBuildProjectFullPath);@(SignMsm);@(SignCabs);@(SignMsi);@(SignContainers);@(SignBundleEngine);@(SignBundle)" 71 Lines="^$(MSBuildProjectFullPath);@(SignMsm);@(SignCabs);@(SignMsi);@(SignContainers);@(SignBundleEngine);@(SignBundle)"
74 Overwrite="true" /> 72 Overwrite="true" />
75 </Target> 73 </Target>
76 74
77 <!-- Internal targets so correct signing targets are called. --> 75 <!-- Internal targets so correct signing targets are called. -->
78 <Target 76 <Target
77 Name="CalculateSignTargetFiles">
78 <ItemGroup>
79 <SignTargetPath Include="$(TargetPath)" />
80 </ItemGroup>
81 </Target>
82
83 <Target
79 Name="GetMsmsToSign" 84 Name="GetMsmsToSign"
80 Inputs="@(SignTargetPath)" 85 Inputs="@(SignTargetPath)"
81 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 86 Outputs="$(SignedFilePath)">
82 <CreateItem Include="@(SignTargetPath)"> 87
83 <Output TaskParameter="Include" ItemName="SignMsm" /> 88 <ItemGroup>
84 <Output TaskParameter="Include" ItemName="FileWrites" /> 89 <SignMsm Include="@(SignTargetPath)" />
85 </CreateItem> 90 </ItemGroup>
86 </Target> 91 </Target>
87 92
88 <Target 93 <Target
89 Name="InternalSignMsm" 94 Name="InternalSignMsm"
90 DependsOnTargets="SignMsm" 95 DependsOnTargets="SignMsm"
91 Condition=" '@(SignMsm)' != '' " /> 96 Condition=" '@(SignMsm)' != '' " />
92 97
93 <Target 98 <Target
94 Name="GetCabsToSign" 99 Name="GetCabsToSign"
95 Inputs="@(SignTargetPath)" 100 Inputs="@(SignTargetPath)"
96 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 101 Outputs="$(SignedFilePath)">
97 <GetCabList Database="%(SignTargetPath.FullPath)"> 102 <GetCabList Database="%(SignTargetPath.FullPath)">
98 <Output TaskParameter="CabList" ItemName="SignCabs" /> 103 <Output TaskParameter="CabList" ItemName="SignCabs" />
99 <Output TaskParameter="CabList" ItemName="FileWrites" /> 104 <Output TaskParameter="CabList" ItemName="FileWrites" />
@@ -101,14 +106,14 @@
101 </Target> 106 </Target>
102 107
103 <Target 108 <Target
104 Name="InternalSignCabs" 109 Name="InternalSignCabs"
105 DependsOnTargets="SignCabs" 110 DependsOnTargets="SignCabs"
106 Condition=" '@(SignCabs)' != '' " /> 111 Condition=" '@(SignCabs)' != '' " />
107 112
108 <Target 113 <Target
109 Name="GetMsiToSign" 114 Name="GetMsiToSign"
110 Inputs="@(SignTargetPath)" 115 Inputs="@(SignTargetPath)"
111 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 116 Outputs="$(SignedFilePath)">
112 <CreateItemAvoidingInference InputProperties="@(SignTargetPath)"> 117 <CreateItemAvoidingInference InputProperties="@(SignTargetPath)">
113 <Output TaskParameter="OuputItems" ItemName="SignMsi" /> 118 <Output TaskParameter="OuputItems" ItemName="SignMsi" />
114 <Output TaskParameter="OuputItems" ItemName="FileWrites" /> 119 <Output TaskParameter="OuputItems" ItemName="FileWrites" />
@@ -116,33 +121,33 @@
116 </Target> 121 </Target>
117 122
118 <Target 123 <Target
119 Name="InternalSignMsi" 124 Name="InternalSignMsi"
120 DependsOnTargets="SignMsi" 125 DependsOnTargets="SignMsi"
121 Inputs="@(SignTargetPath)" 126 Inputs="@(SignTargetPath)"
122 Outputs="$(IntermediateOutputPath)$(SignedFile)" 127 Outputs="$(SignedFilePath)"
123 Condition=" '@(SignMsi)' != '' " /> 128 Condition=" '@(SignMsi)' != '' " />
124 129
125 <Target 130 <Target
126 Name="GetContainersToSign" 131 Name="GetContainersToSign"
127 Inputs="@(SignTargetPath)" 132 Inputs="@(SignTargetPath)"
128 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 133 Outputs="$(SignedFilePath)">
129 <!-- TODO: implement signing detached containers --> 134 <!-- TODO: implement signing detached containers -->
130 </Target> 135 </Target>
131 136
132 <Target 137 <Target
133 Name="InternalSignContainers" 138 Name="InternalSignContainers"
134 DependsOnTargets="SignContainers" 139 DependsOnTargets="SignContainers"
135 Condition=" '@(SignContainers)' != '' " /> 140 Condition=" '@(SignContainers)' != '' " />
136 141
137 <Target 142 <Target
138 Name="InternalSignBundleEngine" 143 Name="InternalSignBundleEngine"
139 DependsOnTargets="SignBundleEngine" 144 DependsOnTargets="SignBundleEngine"
140 Condition=" '@(SignBundleEngine)' != '' " /> 145 Condition=" '@(SignBundleEngine)' != '' " />
141 146
142 <Target 147 <Target
143 Name="InternalSignBundle" 148 Name="InternalSignBundle"
144 DependsOnTargets="SignBundle" 149 DependsOnTargets="SignBundle"
145 Condition=" '@(SignBundle)' != '' " /> 150 Condition=" '@(SignBundle)' != '' " />
146 151
147 <!-- 152 <!--
148 ================================================================================================ 153 ================================================================================================
@@ -160,17 +165,13 @@
160 --> 165 -->
161 <PropertyGroup> 166 <PropertyGroup>
162 <InscribeMsiDependsOn> 167 <InscribeMsiDependsOn>
163 PrepareForBuild;
164 ResolveWixExtensionReferences;
165 CompileAndLink;
166 InternalSignCabs
167 </InscribeMsiDependsOn> 168 </InscribeMsiDependsOn>
168 </PropertyGroup> 169 </PropertyGroup>
169 <Target 170 <Target
170 Name="InscribeMsi" 171 Name="InscribeMsi"
171 DependsOnTargets="$(InscribeMsiDependsOn)" 172 DependsOnTargets="$(InscribeMsiDependsOn)"
172 Inputs="@(SignTargetPath)" 173 Inputs="@(SignTargetPath)"
173 Outputs="$(IntermediateOutputPath)$(SignedFile)" 174 Outputs="$(SignedFilePath)"
174 Condition=" '@(SignCabs)' != '' "> 175 Condition=" '@(SignCabs)' != '' ">
175 176
176 <Insignia 177 <Insignia
@@ -203,17 +204,13 @@
203 --> 204 -->
204 <PropertyGroup> 205 <PropertyGroup>
205 <InscribeBundleEngineDependsOn> 206 <InscribeBundleEngineDependsOn>
206 PrepareForBuild;
207 ResolveWixExtensionReferences;
208 CompileAndLink;
209 InternalSignContainers
210 </InscribeBundleEngineDependsOn> 207 </InscribeBundleEngineDependsOn>
211 </PropertyGroup> 208 </PropertyGroup>
212 <Target 209 <Target
213 Name="InscribeBundleEngine" 210 Name="InscribeBundleEngine"
214 DependsOnTargets="$(InscribeBundleEngineDependsOn)" 211 DependsOnTargets="$(InscribeBundleEngineDependsOn)"
215 Inputs="@(SignTargetPath)" 212 Inputs="@(SignTargetPath)"
216 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 213 Outputs="$(SignedFilePath)">
217 214
218 <Insignia 215 <Insignia
219 BundleFile="@(SignTargetPath)" 216 BundleFile="@(SignTargetPath)"
@@ -230,11 +227,10 @@
230 <Output TaskParameter="Output" ItemName="SignBundleEngine" /> 227 <Output TaskParameter="Output" ItemName="SignBundleEngine" />
231 </Insignia> 228 </Insignia>
232 229
233 <!-- Explicitly add output to FileWrites to ensure even when the target is up to date. --> 230 <!-- Explicitly add output to FileWrites to ensure they are included even when the target is up to date. -->
234 <CreateItem Include="$(IntermediateOutputPath)%(SignTargetPath.Filename)%(SignTargetPath.Extension)"> 231 <ItemGroup>
235 <Output TaskParameter="Include" ItemName="FileWrites" /> 232 <FileWrites Include="$(IntermediateOutputPath)%(SignTargetPath.Filename)%(SignTargetPath.Extension)" />
236 </CreateItem> 233 </ItemGroup>
237
238 </Target> 234 </Target>
239 235
240 <!-- 236 <!--
@@ -252,17 +248,13 @@
252 --> 248 -->
253 <PropertyGroup> 249 <PropertyGroup>
254 <InscribeBundleDependsOn> 250 <InscribeBundleDependsOn>
255 PrepareForBuild;
256 ResolveWixExtensionReferences;
257 CompileAndLink;
258 InternalSignBundleEngine
259 </InscribeBundleDependsOn> 251 </InscribeBundleDependsOn>
260 </PropertyGroup> 252 </PropertyGroup>
261 <Target 253 <Target
262 Name="InscribeBundle" 254 Name="InscribeBundle"
263 DependsOnTargets="$(InscribeBundleDependsOn)" 255 DependsOnTargets="$(InscribeBundleDependsOn)"
264 Inputs="@(SignTargetPath)" 256 Inputs="@(SignTargetPath)"
265 Outputs="$(IntermediateOutputPath)$(SignedFile)"> 257 Outputs="$(SignedFilePath)">
266 258
267 <Insignia 259 <Insignia
268 BundleFile="@(SignBundleEngine)" 260 BundleFile="@(SignBundleEngine)"
diff --git a/src/WixToolset.BuildTasks/wix.targets b/src/WixToolset.BuildTasks/wix.targets
index ebd3fa90..da90226d 100644
--- a/src/WixToolset.BuildTasks/wix.targets
+++ b/src/WixToolset.BuildTasks/wix.targets
@@ -48,14 +48,13 @@
48 <PropertyGroup> 48 <PropertyGroup>
49 <DefaultLanguageSourceExtension>.wxs</DefaultLanguageSourceExtension> 49 <DefaultLanguageSourceExtension>.wxs</DefaultLanguageSourceExtension>
50 <Language>wix</Language> 50 <Language>wix</Language>
51 <TargetRuntime>Managed</TargetRuntime> 51 <TargetRuntime>wix</TargetRuntime>
52 52
53 <!-- Use OutputName to set the AssemblyName for Microsoft.Common.targets --> 53 <!-- Use OutputName to set the AssemblyName for Microsoft.Common.targets -->
54 <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName> 54 <OutputName Condition=" '$(OutputName)'=='' ">$(MSBuildProjectName)</OutputName>
55 <AssemblyName>$(OutputName)</AssemblyName> 55 <AssemblyName>$(OutputName)</AssemblyName>
56 56
57 <!-- Default the OutputType to a known WiX toolset TYPE. --> 57 <!-- Default the OutputType to a known WiX Toolset type. -->
58 <_OriginalOutputType>$(OutputType)</_OriginalOutputType>
59 <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType> 58 <OutputType Condition=" '$(OutputType)' == '' ">Package</OutputType>
60 </PropertyGroup> 59 </PropertyGroup>
61 60
@@ -70,28 +69,24 @@
70 <TargetExt Condition=" '$(OutputType)' == 'PatchCreation' ">.pcp</TargetExt> 69 <TargetExt Condition=" '$(OutputType)' == 'PatchCreation' ">.pcp</TargetExt>
71 <TargetExt Condition=" '$(OutputType)' == 'Library' ">.wixlib</TargetExt> 70 <TargetExt Condition=" '$(OutputType)' == 'Library' ">.wixlib</TargetExt>
72 <TargetExt Condition=" '$(OutputType)' == 'Bundle' ">.exe</TargetExt> 71 <TargetExt Condition=" '$(OutputType)' == 'Bundle' ">.exe</TargetExt>
72 <TargetExt Condition=" '$(OutputType)' == 'IntermediatePostLink' ">.wixipl</TargetExt>
73 </PropertyGroup> 73 </PropertyGroup>
74 74
75 <!-- Provide the correct output name for the .wixpdb -->
76 <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true'">
77 <_DebugSymbolsIntermediatePath Include="$(PdbOutputDir)$(TargetPdbName)" Condition=" '@(_DebugSymbolsIntermediatePath)' == '' " />
78 </ItemGroup>
79
80 <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" /> 75 <Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
81 76
82 <PropertyGroup> 77 <PropertyGroup>
83 <!-- Default pdb output path to the intermediate output directory --> 78 <!-- Default pdb output path to the intermediate output directory -->
84 <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(IntermediateOutputPath)</PdbOutputDir> 79 <PdbOutputDir Condition=" '$(PdbOutputDir)'=='' ">$(TargetDir)</PdbOutputDir>
85 <PdbOutputDir Condition=" '$(PdbOutputDir)' != '' and !HasTrailingSlash('$(PdbOutputDir)') ">$(PdbOutputDir)\</PdbOutputDir> 80 <PdbOutputDir Condition=" !HasTrailingSlash('$(PdbOutputDir)') ">$(PdbOutputDir)\</PdbOutputDir>
86 81
87 <!-- Example, C:\MyProjects\MyProject\bin\debug\ --> 82 <!-- Example, C:\MyProjects\MyProject\bin\debug\ -->
88 <TargetPdbDir Condition=" '$(PdbOutputDir)'!='' ">$([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`))</TargetPdbDir> 83 <TargetPdbDir Condition=" '$(PdbOutputDir)'!='' ">$([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`))</TargetPdbDir>
89 84
90 <!-- Example, MySetup.wixpdb" --> 85 <!-- Example, MySetup.wixpdb" -->
91 <TargetPdbName Condition=" '$(TargetPdbName)' == '' ">$(TargetName).wixpdb</TargetPdbName> 86 <TargetPdbFileName Condition=" '$(TargetPdbFileName)' == '' ">$(TargetName).wixpdb</TargetPdbFileName>
92 87
93 <!-- Example, C:\MyProjects\MyProject\bin\debug\MyPackage.wixpdb --> 88 <!-- Example, C:\MyProjects\MyProject\bin\debug\MyPackage.wixpdb -->
94 <TargetPdbPath Condition=" '$(TargetPdbPath)' == '' ">$(TargetPdbDir)$(TargetPdbName)</TargetPdbPath> 89 <TargetPdbPath Condition=" '$(TargetPdbPath)' == '' ">$(TargetPdbDir)$(TargetPdbFileName)</TargetPdbPath>
95 </PropertyGroup> 90 </PropertyGroup>
96 91
97 <!-- 92 <!--
@@ -111,8 +106,6 @@
111 <UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" /> 106 <UsingTask TaskName="WixAssignCulture" AssemblyFile="$(WixTasksPath)" />
112 <UsingTask TaskName="ResolveWixReferences" AssemblyFile="$(WixTasksPath)"/> 107 <UsingTask TaskName="ResolveWixReferences" AssemblyFile="$(WixTasksPath)"/>
113 <UsingTask TaskName="ReplaceString" AssemblyFile="$(WixTasksPath)"/> 108 <UsingTask TaskName="ReplaceString" AssemblyFile="$(WixTasksPath)"/>
114 <UsingTask TaskName="GetCabList" AssemblyFile="$(WixTasksPath)" />
115 <UsingTask TaskName="GetLooseFileList" AssemblyFile="$(WixTasksPath)" />
116 <UsingTask TaskName="GenerateCompileWithObjectPath" AssemblyFile="$(WixTasksPath)"/> 109 <UsingTask TaskName="GenerateCompileWithObjectPath" AssemblyFile="$(WixTasksPath)"/>
117 110
118 <PropertyGroup> 111 <PropertyGroup>
@@ -131,14 +124,6 @@
131 </PropertyGroup> 124 </PropertyGroup>
132 125
133 <!-- 126 <!--
134 Set the SignTargetPath item directly when output is a Bundle. The AssignCultures target
135 sets SignTargetPath item for other output types based on the cultures provided.
136 -->
137 <ItemGroup>
138 <SignTargetPath Include="$(TargetPath)" Condition=" '$(OutputType)' == 'Bundle' AND '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' " />
139 </ItemGroup>
140
141 <!--
142 ////////////////////////////////////////////////////////////////////////////////////////////////// 127 //////////////////////////////////////////////////////////////////////////////////////////////////
143 ////////////////////////////////////////////////////////////////////////////////////////////////// 128 //////////////////////////////////////////////////////////////////////////////////////////////////
144 Default Compiler, Linker, and Librarian Property Declarations 129 Default Compiler, Linker, and Librarian Property Declarations
@@ -219,32 +204,27 @@
219 204
220 [IN] 205 [IN]
221 $(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension) 206 $(OutputName) - The name of the MSI/MSM/wixlib to build (without the extension)
222 $(OutputType) - Possible values are 'package', 'PatchCreation', 'module', 'library', 'bundle' 207 $(OutputType) - Possible values are 'Package', 'PatchCreation', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'
223 ================================================================================================== 208 ==================================================================================================
224 --> 209 -->
225 <PropertyGroup> 210 <PropertyGroup>
226 <_PleaseSetThisInProjectFile>Please set this in the project file before the &lt;Import&gt; of the wix.targets file.</_PleaseSetThisInProjectFile> 211 <_PleaseSetThisInProjectFile>Please set this in the project file before the &lt;Import&gt; of the wix.targets file.</_PleaseSetThisInProjectFile>
227 <_OutputTypeDescription>The OutputType defines whether a Windows Installer package (.msi), PatchCreation (.pcp), merge module (.msm), wix library (.wixlib), or self-extracting executable (.exe) is being built. $(_PleaseSetThisInProjectFile) Possible values are 'Package', 'Module', 'Library', and 'Bundle'.</_OutputTypeDescription> 212 <_OutputTypeDescription>Possible values are: 'Package', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'. $(_PleaseSetThisInProjectFile)</_OutputTypeDescription>
228 </PropertyGroup> 213 </PropertyGroup>
229 <Target Name="_CheckRequiredProperties"> 214 <Target Name="_CheckRequiredProperties">
230 215
231 <Error 216 <Error
232 Code="WIXTARGETS100" 217 Code="WIX100"
233 Condition=" '$(OutputName)' == '' " 218 Condition=" '$(OutputName)' == '' "
234 Text="The OutputName property is not set in project &quot;$(MSBuildProjectFile)&quot;. The OutputName defines the name of the output without a file extension. $(_PleaseSetThisInProjectFile)" /> 219 Text="The OutputName property is not set in project &quot;$(MSBuildProjectFile)&quot;. The OutputName defines the name of the output without a file extension. $(_PleaseSetThisInProjectFile)" />
235 220
236 <Warning
237 Code="WIXTARGETS101"
238 Condition=" '$(_OriginalOutputType)' == '' "
239 Text="The OutputType property is not set in project &quot;$(MSBuildProjectFile)&quot;. Defaulting to '$(OutputType)'. $(_OutputTypeDescription)" />
240
241 <Error 221 <Error
242 Code="WIXTARGETS102" 222 Code="WIX101"
243 Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'PatchCreation' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' and '$(OutputType)' != 'Bundle' " 223 Condition=" '$(OutputType)' != 'Package' and '$(OutputType)' != 'PatchCreation' and '$(OutputType)' != 'Module' and '$(OutputType)' != 'Library' and '$(OutputType)' != 'Bundle' and '$(OutputType)' != 'IntermediatePostLink' "
244 Text="The OutputType property '$(OutputType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. $(_OutputTypeDescription)" /> 224 Text="The OutputType property '$(OutputType)' is not valid in project &quot;$(MSBuildProjectFile)&quot;. $(_OutputTypeDescription)" />
245 225
246 <Error 226 <Error
247 Code="WIXTARGETS103" 227 Code="WIX102"
248 Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' &lt; '4.0' " 228 Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' &lt; '4.0' "
249 Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project &quot;$(MSBuildProjectFile)&quot;. You must use MSBuild v4.0 or later." /> 229 Text="MSBuild v$(MSBuildToolsVersion) is not supported by the project &quot;$(MSBuildProjectFile)&quot;. You must use MSBuild v4.0 or later." />
250 230
@@ -272,7 +252,6 @@
272 BuildOnlySettings; 252 BuildOnlySettings;
273 PrepareForBuild; 253 PrepareForBuild;
274 PreBuildEvent; 254 PreBuildEvent;
275 ResolveReferences;
276 255
277 WixBuild; 256 WixBuild;
278 Signing; 257 Signing;
@@ -580,7 +559,7 @@
580 ================================================================================================ 559 ================================================================================================
581 --> 560 -->
582 <PropertyGroup> 561 <PropertyGroup>
583 <GetTargetPathDependsOn>AssignCultures</GetTargetPathDependsOn> 562 <GetTargetPathDependsOn>AssignTargetPaths</GetTargetPathDependsOn>
584 </PropertyGroup> 563 </PropertyGroup>
585 564
586 565
@@ -600,22 +579,22 @@
600 <PropertyGroup> 579 <PropertyGroup>
601 <WixBuildDependsOn> 580 <WixBuildDependsOn>
602 ResolveReferences; 581 ResolveReferences;
603 BeforeWixBuild; 582 BeforeCompile;
604 _TimeStampBeforeWixBuild; 583 _TimeStampBeforeCompile;
605 584
606 CalculateDefineConstants; 585 CalculateDefineConstants;
607 Harvest; 586 Harvest;
608 587
609 GenerateCompileWithObjectPath; 588 GenerateCompileWithObjectPath;
610 589
611 AssignCultures; 590 AssignTargetPaths;
612 ReadPreviousBindInputsAndBuiltOutputs; 591 ReadPreviousBindInputsAndBuiltOutputs;
613 592
614 CoreWixBuild; 593 CoreWixBuild;
615 594
616 UpdateLinkFileWrites; 595 UpdateLinkFileWrites;
617 _TimeStampAfterWixBuild; 596 _TimeStampAfterCompile;
618 AfterWixBuild 597 AfterCompile
619 </WixBuildDependsOn> 598 </WixBuildDependsOn>
620 </PropertyGroup> 599 </PropertyGroup>
621 <Target 600 <Target
@@ -623,23 +602,24 @@
623 DependsOnTargets="$(WixBuildDependsOn)" /> 602 DependsOnTargets="$(WixBuildDependsOn)" />
624 603
625 <Target 604 <Target
626 Name="CoreWixBuild" 605 Name="CoreWixBuild"
627 606 Inputs="@(Compile);
628 Inputs="@(Compile); 607 @(Content);
629 @(Content); 608 @(EmbeddedResource);
630 @(EmbeddedResource); 609 @(WixObject);
631 @(WixObject); 610 @(_ResolvedProjectReferencePaths);
632 @(_ResolvedProjectReferencePaths); 611 @(_ResolvedWixLibraryPaths);
633 @(_ResolvedWixLibraryPaths); 612 @(_ResolvedWixExtensionPaths);
634 @(_ResolvedWixExtensionPaths); 613 @(_BindInputs);
635 @(_BindInputs); 614 $(MSBuildAllProjects)"
636 $(MSBuildAllProjects)" 615 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)"
637 Outputs="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile);@(_BindBuiltOutputs)" 616 Condition=" '@(Compile)' != '' ">
638 Condition=" '@(Compile)' != '' ">
639 617
640 <PropertyGroup> 618 <PropertyGroup>
641 <OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)))</OutputFile> 619 <!--<OutputFile>$([System.IO.Path]::GetFullPath($(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)))</OutputFile>-->
642 <PdbOutputFile>$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)</PdbOutputFile> 620 <OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetFileName)))</OutputFile>
621 <!--<OutputFile>$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)))</OutputFile>-->
622 <PdbOutputFile>$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName)</PdbOutputFile>
643 </PropertyGroup> 623 </PropertyGroup>
644 624
645 <DoIt 625 <DoIt
@@ -780,7 +760,7 @@
780 760
781 <!-- 761 <!--
782 ================================================================================================ 762 ================================================================================================
783 AssignCultures 763 AssignTargetPaths - OVERRIDE Target
784 764
785 Determines the final list of culture groups to build based on either the Cultures property or 765 Determines the final list of culture groups to build based on either the Cultures property or
786 those specified in .wxl files. 766 those specified in .wxl files.
@@ -811,37 +791,27 @@
811 @(CultureGroup) - The list of culture group strings with OutputFolder metadata 791 @(CultureGroup) - The list of culture group strings with OutputFolder metadata
812 $(TargetPath) - Property list of target link output MSIs/MSMs 792 $(TargetPath) - Property list of target link output MSIs/MSMs
813 $(TargetPdbPath) - Property list of target output pdbs 793 $(TargetPdbPath) - Property list of target output pdbs
814 @(SignTargetPath) - The list of target to be signed
815 794
816 ================================================================================================ 795 ================================================================================================
817 --> 796 -->
818 <Target 797 <Target
819 Name="AssignCultures" 798 Name="AssignTargetPaths"
820 Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' "> 799 Condition=" '$(OutputType)' == 'Package' or '$(OutputType)' == 'PatchCreation' or '$(OutputType)' == 'Module' ">
821 800
822 <WixAssignCulture 801 <WixAssignCulture Cultures="$(Cultures)" Files="@(EmbeddedResource)">
823 Cultures="$(Cultures)"
824 Files="@(EmbeddedResource)">
825
826 <Output TaskParameter="CultureGroups" ItemName="CultureGroup" /> 802 <Output TaskParameter="CultureGroups" ItemName="CultureGroup" />
827 </WixAssignCulture> 803 </WixAssignCulture>
828 804
829 <!-- Build an itemgroup of outputs --> 805 <!-- Expand the culture groups then put them back into the appropriate property -->
830 <ItemGroup> 806 <ItemGroup>
831 <_TargetPathItems Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetName)$(TargetExt)" /> 807 <_CulturedTargetPath Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)" />
832 <_TargetPdbPathItems Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbName)" /> 808 <_CulturedTargetPdbPath Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbFileName)" />
833 </ItemGroup> 809 </ItemGroup>
834 810
835 <!-- Convert the itemgroup to a semicolon-delimited property -->
836 <PropertyGroup> 811 <PropertyGroup>
837 <TargetPath>@(_TargetPathItems)</TargetPath> 812 <TargetPath>@(_CulturedTargetPath)</TargetPath>
838 <TargetPdbPath>@(_TargetPdbPathItems)</TargetPdbPath> 813 <TargetPdbPath>@(_CulturedTargetPdbPath)</TargetPdbPath>
839 </PropertyGroup> 814 </PropertyGroup>
840
841 <!-- Set the sign target items, if we're signing output. -->
842 <ItemGroup Condition=" '$(SignOutput)' == 'true' AND '$(SuppressLayout)' != 'true' ">
843 <SignTargetPath Include="@(_TargetPathItems)" />
844 </ItemGroup>
845 </Target> 815 </Target>
846 816
847 <!-- 817 <!--
@@ -957,7 +927,7 @@
957 ================================================================================================== 927 ==================================================================================================
958 --> 928 -->
959 <PropertyGroup> 929 <PropertyGroup>
960 <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignCultures</BuiltProjectOutputGroupDependsOn> 930 <BuiltProjectOutputGroupDependsOn>PrepareForBuild;AssignTargetPaths</BuiltProjectOutputGroupDependsOn>
961 </PropertyGroup> 931 </PropertyGroup>
962 <Target 932 <Target
963 Name="BuiltProjectOutputGroup" 933 Name="BuiltProjectOutputGroup"
@@ -967,7 +937,7 @@
967 <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below --> 937 <!-- Don't add BuiltProjectOutputGroupKeyOutput - to avoid duplicates, we only want to get the updated list of TargetPaths from the TargetPath property below -->
968 938
969 <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from linker. --> 939 <!-- Try to read the outputs from the bind outputs text file since that's the output list straight from linker. -->
970 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"> 940 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)">
971 <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/> 941 <Output TaskParameter="Lines" ItemName="_BuiltProjectOutputGroupOutputIntermediate"/>
972 </ReadLinesFromFile> 942 </ReadLinesFromFile>
973 943
@@ -993,14 +963,14 @@
993 ================================================================================================== 963 ==================================================================================================
994 --> 964 -->
995 <PropertyGroup> 965 <PropertyGroup>
996 <DebugSymbolsProjectOutputGroupDependsOn>AssignCultures</DebugSymbolsProjectOutputGroupDependsOn> 966 <DebugSymbolsProjectOutputGroupDependsOn>AssignTargetPaths</DebugSymbolsProjectOutputGroupDependsOn>
997 </PropertyGroup> 967 </PropertyGroup>
998 <Target 968 <Target
999 Name="DebugSymbolsProjectOutputGroup" 969 Name="DebugSymbolsProjectOutputGroup"
1000 Outputs="@(DebugSymbolsProjectOutputGroupOutput)" 970 Outputs="@(DebugSymbolsProjectOutputGroupOutput)"
1001 DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)"> 971 DependsOnTargets="$(DebugSymbolsProjectOutputGroupDependsOn)">
1002 972
1003 <!-- Include build output pdb(s). Different than predefined itemgroup since AssignCultures target may change --> 973 <!-- Include build output pdb(s). Different than predefined itemgroup since AssignTargetPaths target may change -->
1004 <ItemGroup> 974 <ItemGroup>
1005 <DebugSymbolsProjectOutputGroupOutput Include="$(TargetPdbPath)" Condition=" '$(SuppressPdbOutput)' != 'true' "/> 975 <DebugSymbolsProjectOutputGroupOutput Include="$(TargetPdbPath)" Condition=" '$(SuppressPdbOutput)' != 'true' "/>
1006 </ItemGroup> 976 </ItemGroup>
@@ -1029,7 +999,7 @@
1029 </PropertyGroup> 999 </PropertyGroup>
1030 1000
1031 <!-- Copy the bound files. --> 1001 <!-- Copy the bound files. -->
1032 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindOutputsFile)"> 1002 <ReadLinesFromFile File="$(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(BindBuiltOutputsFile)">
1033 <Output TaskParameter="Lines" ItemName="_FullPathToCopy"/> 1003 <Output TaskParameter="Lines" ItemName="_FullPathToCopy"/>
1034 </ReadLinesFromFile> 1004 </ReadLinesFromFile>
1035 1005
diff --git a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs b/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs
deleted file mode 100644
index 8fd69414..00000000
--- a/src/test/WixToolsetTest.BuildTasks/FakeBuildEngine.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1// 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.
2
3namespace WixToolsetTest.BuildTasks
4{
5 using System.Collections;
6 using System.Text;
7 using Microsoft.Build.Framework;
8
9 internal class FakeBuildEngine : IBuildEngine
10 {
11 private StringBuilder output = new StringBuilder();
12
13 public int ColumnNumberOfTaskNode => 0;
14
15 public bool ContinueOnError => false;
16
17 public int LineNumberOfTaskNode => 0;
18
19 public string ProjectFileOfTaskNode => "fake_wix.targets";
20
21 public string Output => this.output.ToString();
22
23 public bool BuildProjectFile(string projectFileName, string[] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => throw new System.NotImplementedException();
24
25 public void LogCustomEvent(CustomBuildEventArgs e) => this.output.AppendLine(e.Message);
26
27 public void LogErrorEvent(BuildErrorEventArgs e) => this.output.AppendLine(e.Message);
28
29 public void LogMessageEvent(BuildMessageEventArgs e) => this.output.AppendLine(e.Message);
30
31 public void LogWarningEvent(BuildWarningEventArgs e) => this.output.AppendLine(e.Message);
32 }
33}
diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
index a27928d5..95b727ad 100644
--- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
+++ b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs
@@ -2,62 +2,103 @@
2 2
3namespace WixToolsetTest.BuildTasks 3namespace WixToolsetTest.BuildTasks
4{ 4{
5 using System;
5 using System.IO; 6 using System.IO;
6 using System.Linq; 7 using System.Linq;
7 using Microsoft.Build.Utilities;
8 using WixBuildTools.TestSupport; 8 using WixBuildTools.TestSupport;
9 using WixToolset.BuildTasks; 9 using WixToolset.BuildTasks;
10 using WixToolset.Data;
11 using WixToolset.Data.Tuples;
12 using Xunit; 10 using Xunit;
13 11
14 public partial class MsbuildFixture 12 public class MsbuildFixture
15 { 13 {
14 private static readonly string WixTargetsPath = Path.Combine(Path.GetDirectoryName(new Uri(typeof(DoIt).Assembly.CodeBase).AbsolutePath), "wix.targets");
15
16 public MsbuildFixture()
17 {
18 this.MsbuildRunner = new MsbuildRunner();
19 }
20
21 private MsbuildRunner MsbuildRunner { get; }
22
16 [Fact] 23 [Fact]
17 public void CanBuildSimpleMsiPackage() 24 public void CanBuildSimpleMsiPackage()
18 { 25 {
19 var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage"); 26 var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj");
20 27
21 using (var fs = new DisposableFileSystem()) 28 using (var fs = new DisposableFileSystem())
22 { 29 {
23 var baseFolder = fs.GetFolder(); 30 var baseFolder = fs.GetFolder();
24 var intermediateFolder = Path.Combine(baseFolder, "obj"); 31 var binFolder = Path.Combine(baseFolder, @"bin\");
32 var intermediateFolder = Path.Combine(baseFolder, @"obj\");
25 33
26 var engine = new FakeBuildEngine(); 34 var result = this.MsbuildRunner.Execute(projectPath, new[]
35 {
36 $"-p:WixTargetsPath={WixTargetsPath}",
37 $"-p:IntermediateOutputPath={intermediateFolder}",
38 $"-p:OutputPath={binFolder}"
39 });
40 result.AssertSuccess();
27 41
28 var task = new DoIt 42 var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories)
43 .Select(s => s.Substring(baseFolder.Length + 1))
44 .OrderBy(s => s)
45 .ToArray();
46 Assert.Equal(new[]
29 { 47 {
30 BuildEngine = engine, 48 @"bin\en-US\cab1.cab",
31 SourceFiles = new[] 49 @"bin\en-US\MsiPackage.msi",
32 { 50 @"bin\en-US\MsiPackage.wixpdb",
33 new TaskItem(Path.Combine(folder, "Package.wxs")), 51 }, paths);
34 new TaskItem(Path.Combine(folder, "PackageComponents.wxs")), 52 }
35 }, 53 }
36 LocalizationFiles = new[] 54
37 { 55 [Fact]
38 new TaskItem(Path.Combine(folder, "Package.en-us.wxl")), 56 public void CanBuildAndCleanSimpleMsiPackage()
39 }, 57 {
40 BindInputPaths = new[] 58 var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj");
41 { 59
42 new TaskItem(Path.Combine(folder, "data")), 60 using (var fs = new DisposableFileSystem())
43 }, 61 {
44 IntermediateDirectory = new TaskItem(intermediateFolder), 62 var baseFolder = fs.GetFolder();
45 OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")), 63 var binFolder = Path.Combine(baseFolder, @"bin\");
46 }; 64 var intermediateFolder = Path.Combine(baseFolder, @"obj\");
47 65
48 var result = task.Execute(); 66 // Build
49 Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}"); 67 var result = this.MsbuildRunner.Execute(projectPath, new[]
50 68 {
51 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi"))); 69 $"-p:WixTargetsPath={WixTargetsPath}",
52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb"))); 70 $"-p:IntermediateOutputPath={intermediateFolder}",
53 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab"))); 71 $"-p:OutputPath={binFolder}",
54 72 "-v:diag"
55 var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wir")); 73 });
56 var section = intermediate.Sections.Single(); 74 result.AssertSuccess();
57 75
58 var wixFile = section.Tuples.OfType<WixFileTuple>().Single(); 76 var buildOutput = String.Join("\r\n", result.Output);
59 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path); 77
60 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path); 78 var createdPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories)
79 .Select(s => s.Substring(baseFolder.Length + 1))
80 .OrderBy(s => s)
81 .ToArray();
82 Assert.NotEmpty(createdPaths);
83
84 // Clean
85 result = this.MsbuildRunner.Execute(projectPath, new[]
86 {
87 $"-p:WixTargetsPath={WixTargetsPath}",
88 $"-p:IntermediateOutputPath={intermediateFolder}",
89 $"-p:OutputPath={binFolder}",
90 "-t:Clean",
91 "-v:diag"
92 });
93 result.AssertSuccess();
94
95 var cleanOutput = String.Join("\r\n", result.Output);
96
97 var remainingPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories)
98 .Select(s => s.Substring(baseFolder.Length + 1))
99 .OrderBy(s => s)
100 .ToArray();
101 Assert.Empty(remainingPaths);
61 } 102 }
62 } 103 }
63 } 104 }
diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
index 31c3ec9c..d5cac8d8 100644
--- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
+++ b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj
@@ -1,18 +1,12 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 2<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup> 3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform> 5 <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6 <ProductVersion>0.9</ProductVersion>
7 <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid>
8 <OutputName>MsiPackage</OutputName>
9 <OutputType>Package</OutputType>
10 <Name>MsiPackage</Name>
11 <RootNamespace>MsiPackage</RootNamespace>
12 </PropertyGroup> 6 </PropertyGroup>
13 7
14 <PropertyGroup> 8 <PropertyGroup>
15 <WixTargetsPath>..\..\..\..\..\..\build\Release\publish\wix.targets</WixTargetsPath> 9 <ProjectGuid>7fb77005-c6e0-454f-8c2d-0a4a79c918ba</ProjectGuid>
16 </PropertyGroup> 10 </PropertyGroup>
17 11
18 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 12 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
@@ -48,8 +42,8 @@
48 </ItemGroup> 42 </ItemGroup>
49 43
50 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> 44 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
51 <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " /> 45 <Import Project="$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\WixToolset\v4.x\wix.targets') " />
52 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> 46 <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
53 <Error Text="WiX Toolset build tools (v3.11 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." /> 47 <Error Text="WiX Toolset build tools (v4.0 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
54 </Target> 48 </Target>
55</Project> \ No newline at end of file 49</Project> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs
new file mode 100644
index 00000000..c4a69cdd
--- /dev/null
+++ b/src/test/WixToolsetTest.BuildTasks/WixBuildTaskFixture.cs
@@ -0,0 +1,64 @@
1// 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.
2
3namespace WixToolsetTest.BuildTasks
4{
5 using System.IO;
6 using System.Linq;
7 using Microsoft.Build.Utilities;
8 using WixBuildTools.TestSupport;
9 using WixToolset.BuildTasks;
10 using WixToolset.Data;
11 using WixToolset.Data.Tuples;
12 using Xunit;
13
14 public class WixBuildTaskFixture
15 {
16 [Fact]
17 public void CanBuildSimpleMsiPackage()
18 {
19 var folder = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage");
20
21 using (var fs = new DisposableFileSystem())
22 {
23 var baseFolder = fs.GetFolder();
24 var intermediateFolder = Path.Combine(baseFolder, "obj");
25
26 var engine = new FakeBuildEngine();
27
28 var task = new DoIt
29 {
30 BuildEngine = engine,
31 SourceFiles = new[]
32 {
33 new TaskItem(Path.Combine(folder, "Package.wxs")),
34 new TaskItem(Path.Combine(folder, "PackageComponents.wxs")),
35 },
36 LocalizationFiles = new[]
37 {
38 new TaskItem(Path.Combine(folder, "Package.en-us.wxl")),
39 },
40 BindInputPaths = new[]
41 {
42 new TaskItem(Path.Combine(folder, "data")),
43 },
44 IntermediateDirectory = new TaskItem(intermediateFolder),
45 OutputFile = new TaskItem(Path.Combine(baseFolder, @"bin\test.msi")),
46 };
47
48 var result = task.Execute();
49 Assert.True(result, $"MSBuild task failed unexpectedly. Output:\r\n{engine.Output}");
50
51 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
52 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
53 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\cab1.cab")));
54
55 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
56 var section = intermediate.Sections.Single();
57
58 var wixFile = section.Tuples.OfType<WixFileTuple>().Single();
59 Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
60 Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
61 }
62 }
63 }
64}
diff --git a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
index 99da83cd..edab8a67 100644
--- a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
+++ b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj
@@ -9,6 +9,7 @@
9 </PropertyGroup> 9 </PropertyGroup>
10 10
11 <ItemGroup> 11 <ItemGroup>
12 <Content Include="TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj" CopyToOutputDirectory="PreserveNewest" />
12 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 13 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
13 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 14 <Content Include="TestData\SimpleMsiPackage\MsiPackage\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
14 <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 15 <Content Include="TestData\SimpleMsiPackage\MsiPackage\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />