From 64fe8bccc329ac5dc0d510bfbd73054d478ddc37 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 30 May 2020 18:55:10 +1000 Subject: Move most tests into the new WixToolsetTest.MSBuild project. This project relies on all of the projects being published in order to properly test wix.targets. --- Tools.sln | 10 + appveyor.cmd | 30 +- src/ThmViewerPackage/ThmViewerPackage.wixproj | 3 +- src/WixToolset.MSBuild/WixToolset.MSBuild.csproj | 7 + src/WixToolset.MSBuild/WixToolset.MSBuild.nuspec | 7 +- src/WixToolset.MSBuild/tools/wix.ca.targets | 123 +++ src/WixToolset.MSBuild/tools/wix.harvest.targets | 499 +++++++++ src/WixToolset.MSBuild/tools/wix.signing.targets | 370 +++++++ src/WixToolset.MSBuild/tools/wix.targets | 1060 ++++++++++++++++++++ src/WixToolset.MSBuild/wix.ca.targets | 123 --- src/WixToolset.MSBuild/wix.harvest.targets | 499 --------- src/WixToolset.MSBuild/wix.signing.targets | 370 ------- src/WixToolset.MSBuild/wix.targets | 1060 -------------------- .../WixToolsetTest.BuildTasks/MsbuildFixture.cs | 304 ------ .../MsbuildHeatFixture.cs | 155 --- .../HeatFileMultpleFilesSameFileName.wixproj | 61 -- .../MyProgram.json | 1 - .../HeatFileMultpleFilesSameFileName/MyProgram.txt | 1 - .../HeatFileMultpleFilesSameFileName/Package.wxs | 22 - .../HeatFilePackage/HeatFilePackage.wixproj | 56 -- .../TestData/HeatFilePackage/Package.wxs | 21 - .../MsiPackage/MsiPackage.wixproj | 57 -- .../MsiPackage/Package.de-de.wxl | 11 - .../MsiPackage/Package.en-us.wxl | 11 - .../MultiCulturalMsiPackage/MsiPackage/Package.wxs | 21 - .../MsiPackage/PackageComponents.wxs | 10 - .../MsiPackage/data/test.txt | 1 - .../MultiCulturalMsiPackage.sln | 31 - .../SimpleMsiPackage/MsiPackage/MsiPackage.wixproj | 49 - .../SimpleMsiPackage/MsiPackage/Package.en-us.wxl | 11 - .../SimpleMsiPackage/MsiPackage/Package.wxs | 25 - .../MsiPackage/PackageComponents.wxs | 10 - .../SimpleMsiPackage/MsiPackage/data/test.txt | 1 - .../SimpleMsiPackage/SimpleBundle/Bundle.wxs | 10 - .../SimpleBundle/SimpleBundle.wixproj | 45 - .../TestData/SimpleMsiPackage/SimpleMsiPackage.sln | 39 - .../WixToolsetTest.BuildTasks.csproj | 29 +- src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs | 293 ++++++ .../WixToolsetTest.MSBuild/MsbuildHeatFixture.cs | 151 +++ src/test/WixToolsetTest.MSBuild/README.md | 5 + .../HeatFileMultipleFilesSameFileName.wixproj | 61 ++ .../MyProgram.json | 1 + .../MyProgram.txt | 1 + .../HeatFileMultipleFilesSameFileName/Package.wxs | 22 + .../HeatFilePackage/HeatFilePackage.wixproj | 56 ++ .../TestData/HeatFilePackage/Package.wxs | 21 + .../MsiPackage/MsiPackage.wixproj | 57 ++ .../MsiPackage/Package.de-de.wxl | 11 + .../MsiPackage/Package.en-us.wxl | 11 + .../MultiCulturalMsiPackage/MsiPackage/Package.wxs | 21 + .../MsiPackage/PackageComponents.wxs | 10 + .../MsiPackage/data/test.txt | 1 + .../MultiCulturalMsiPackage.sln | 31 + .../SimpleMsiPackage/MsiPackage/MsiPackage.wixproj | 49 + .../SimpleMsiPackage/MsiPackage/Package.en-us.wxl | 11 + .../SimpleMsiPackage/MsiPackage/Package.wxs | 25 + .../MsiPackage/PackageComponents.wxs | 10 + .../SimpleMsiPackage/MsiPackage/data/test.txt | 1 + .../SimpleMsiPackage/SimpleBundle/Bundle.wxs | 10 + .../SimpleBundle/SimpleBundle.wixproj | 45 + .../TestData/SimpleMsiPackage/SimpleMsiPackage.sln | 39 + .../WixToolsetTest.MSBuild.csproj | 43 + .../WixToolsetTest.MSBuild.v3.ncrunchproject | 5 + 63 files changed, 3084 insertions(+), 3050 deletions(-) create mode 100644 src/WixToolset.MSBuild/tools/wix.ca.targets create mode 100644 src/WixToolset.MSBuild/tools/wix.harvest.targets create mode 100644 src/WixToolset.MSBuild/tools/wix.signing.targets create mode 100644 src/WixToolset.MSBuild/tools/wix.targets delete mode 100644 src/WixToolset.MSBuild/wix.ca.targets delete mode 100644 src/WixToolset.MSBuild/wix.harvest.targets delete mode 100644 src/WixToolset.MSBuild/wix.signing.targets delete mode 100644 src/WixToolset.MSBuild/wix.targets delete mode 100644 src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs delete mode 100644 src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/HeatFileMultpleFilesSameFileName.wixproj delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.json delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.txt delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/Package.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj delete mode 100644 src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln create mode 100644 src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs create mode 100644 src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs create mode 100644 src/test/WixToolsetTest.MSBuild/README.md create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/HeatFileMultipleFilesSameFileName.wixproj create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.json create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.txt create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/Package.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/HeatFilePackage.wixproj create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/Package.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/data/test.txt create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj create mode 100644 src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleMsiPackage.sln create mode 100644 src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.csproj create mode 100644 src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.v3.ncrunchproject diff --git a/Tools.sln b/Tools.sln index 5a108710..c9bf5a38 100644 --- a/Tools.sln +++ b/Tools.sln @@ -28,6 +28,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "thmviewer", "src\thmviewer\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "heat", "src\heat\heat.csproj", "{B1F18B6F-FBD8-4911-B3BF-40D801DA77D7}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.MSBuild", "src\test\WixToolsetTest.MSBuild\WixToolsetTest.MSBuild.csproj", "{7B610B7B-C69D-4A4C-9D65-F304C44479E7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -114,6 +116,14 @@ Global {B1F18B6F-FBD8-4911-B3BF-40D801DA77D7}.Release|Any CPU.Build.0 = Release|Any CPU {B1F18B6F-FBD8-4911-B3BF-40D801DA77D7}.Release|x86.ActiveCfg = Release|Any CPU {B1F18B6F-FBD8-4911-B3BF-40D801DA77D7}.Release|x86.Build.0 = Release|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Debug|x86.ActiveCfg = Debug|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Debug|x86.Build.0 = Debug|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Release|Any CPU.Build.0 = Release|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Release|x86.ActiveCfg = Release|Any CPU + {7B610B7B-C69D-4A4C-9D65-F304C44479E7}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/appveyor.cmd b/appveyor.cmd index 0071045f..e04f0de2 100644 --- a/appveyor.cmd +++ b/appveyor.cmd @@ -1,27 +1,27 @@ @setlocal @pushd %~dp0 -@set _P=%~dp0build\Release\publish +@set _C=Release +@set _P=%~dp0build\%_C%\publish nuget restore -dotnet test -c Release src\test\WixToolsetTest.BuildTasks -dotnet test -c Release src\test\WixToolsetTest.WixCop +dotnet test -c %_C% src\test\WixToolsetTest.BuildTasks +dotnet test -c %_C% src\test\WixToolsetTest.WixCop -dotnet publish -c Release -o %_P%\dotnet-wix\ -f netcoreapp2.1 src\wix -@rem dotnet publish -c Release -o %_P%\netfx-heat\ -f net461 src\heat -@rem dotnet publish -c Release -o %_P%\netfx-wix\ -f net461 src\wix -@rem dotnet publish -c Release -o %_P%\netfx-wixcop\ -f net461 src\wixcop -dotnet publish -c Release -o %_P%\WixToolset.MSBuild\net461\ -f net461 src\WixToolset.BuildTasks -dotnet publish -c Release -o %_P%\WixToolset.MSBuild\netcoreapp2.1\ -f netcoreapp2.1 src\WixToolset.BuildTasks +dotnet publish -c %_C% -o %_P%\dotnet-wix\ -f netcoreapp2.1 src\wix +@rem dotnet publish -c %_C% -o %_P%\netfx-heat\ -f net461 src\heat +@rem dotnet publish -c %_C% -o %_P%\netfx-wix\ -f net461 src\wix +@rem dotnet publish -c %_C% -o %_P%\netfx-wixcop\ -f net461 src\wixcop +dotnet publish -c %_C% -o %_P%\WixToolset.MSBuild\tools\net461\ -f net461 src\WixToolset.BuildTasks +dotnet publish -c %_C% -o %_P%\WixToolset.MSBuild\tools\netcoreapp2.1\ -f netcoreapp2.1 src\WixToolset.BuildTasks +dotnet publish -c %_C% -o %_P%\WixToolset.MSBuild\ src\WixToolset.MSBuild -@rem dotnet publish -c Release -o %_P%\netcoreapp2.1 -r win-x86 src\wix -@rem dotnet publish -c Release -o %_P%\net461 -r win-x86 src\light -@rem dotnet publish -c Release -o %_P%\net461 -r win-x86 src\WixToolset.BuildTasks +dotnet pack -c %_C% src\dotnet-wix +dotnet pack -c %_C% src\WixToolset.MSBuild -dotnet pack -c Release src\dotnet-wix -dotnet pack -c Release src\WixToolset.MSBuild +dotnet test -c %_C% src\test\WixToolsetTest.MSBuild -msbuild -p:Configuration=Release .\src\ThmViewerPackage\ThmViewerPackage.wixproj +msbuild -p:Configuration=%_C% .\src\ThmViewerPackage\ThmViewerPackage.wixproj @popd @endlocal diff --git a/src/ThmViewerPackage/ThmViewerPackage.wixproj b/src/ThmViewerPackage/ThmViewerPackage.wixproj index 07014065..212d1bae 100644 --- a/src/ThmViewerPackage/ThmViewerPackage.wixproj +++ b/src/ThmViewerPackage/ThmViewerPackage.wixproj @@ -6,7 +6,6 @@ 59c4b122-5167-445b-8fc4-09dcd4eced89 thmviewer Package - $(OutputPath)\net461\win-x86\ @@ -24,7 +23,7 @@ - + diff --git a/src/WixToolset.MSBuild/WixToolset.MSBuild.csproj b/src/WixToolset.MSBuild/WixToolset.MSBuild.csproj index 5a9633ae..2d5ea01b 100644 --- a/src/WixToolset.MSBuild/WixToolset.MSBuild.csproj +++ b/src/WixToolset.MSBuild/WixToolset.MSBuild.csproj @@ -11,6 +11,13 @@ Id=$(MSBuildThisFileName);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description) + + + + + + + diff --git a/src/WixToolset.MSBuild/WixToolset.MSBuild.nuspec b/src/WixToolset.MSBuild/WixToolset.MSBuild.nuspec index 6171a911..ff0d74ee 100644 --- a/src/WixToolset.MSBuild/WixToolset.MSBuild.nuspec +++ b/src/WixToolset.MSBuild/WixToolset.MSBuild.nuspec @@ -12,11 +12,6 @@ - - - - - - + diff --git a/src/WixToolset.MSBuild/tools/wix.ca.targets b/src/WixToolset.MSBuild/tools/wix.ca.targets new file mode 100644 index 00000000..4578c2d8 --- /dev/null +++ b/src/WixToolset.MSBuild/tools/wix.ca.targets @@ -0,0 +1,123 @@ + + + + + + + + + + true + + $(TargetName).CA$(TargetExt) + + $(MSBuildThisFileDirectory) + $(WixSdkPath)x86\ + $(WixSdkPath)x64\ + + $(WixSdkPath)MakeSfxCA.exe + $(WixSdkX64Path)SfxCA.dll + $(WixSdkX86Path)SfxCA.dll + + + + + + + + + + + + + + + + + + + @(CustomActionReferenceContents);@(Content->'%(FullPath)');$(CustomActionContents) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.MSBuild/tools/wix.harvest.targets b/src/WixToolset.MSBuild/tools/wix.harvest.targets new file mode 100644 index 00000000..e4d866ea --- /dev/null +++ b/src/WixToolset.MSBuild/tools/wix.harvest.targets @@ -0,0 +1,499 @@ + + + + + + + + + + + + + + + + + $(NoLogo) + $(SuppressAllWarnings) + $(SuppressSpecificWarnings) + $(TreatWarningsAsErrors) + $(TreatSpecificWarningsAsErrors) + $(VerboseOutput) + true + false + true + false + + + + + + false + + $(HarvestNoLogo) + $(HarvestSuppressAllWarnings) + $(HarvestSuppressSpecificWarnings) + $(HarvestTreatWarningsAsErrors) + $(HarvestTreatSpecificWarningsAsErrors) + $(HarvestVerboseOutput) + $(HarvestAutogenerateGuids) + $(HarvestGenerateGuidsNow) + $(HarvestSuppressFragments) + $(HarvestSuppressUniqueIds) + $(HarvestTransforms) + $(IntermediateOutputPath)Product.Generated.wxs + $(IntermediateOutputPath)Bundle.Generated.wxs + + + + + $(HarvestNoLogo) + $(HarvestSuppressAllWarnings) + $(HarvestSuppressSpecificWarnings) + $(HarvestTreatWarningsAsErrors) + $(HarvestTreatSpecificWarningsAsErrors) + $(HarvestVerboseOutput) + $(HarvestAutogenerateGuids) + $(HarvestGenerateGuidsNow) + $(HarvestSuppressFragments) + $(HarvestSuppressUniqueIds) + $(HarvestTransforms) + + + + + $(HarvestNoLogo) + $(HarvestSuppressAllWarnings) + $(HarvestSuppressSpecificWarnings) + $(HarvestTreatWarningsAsErrors) + $(HarvestTreatSpecificWarningsAsErrors) + $(HarvestVerboseOutput) + $(HarvestAutogenerateGuids) + $(HarvestGenerateGuidsNow) + $(HarvestSuppressFragments) + $(HarvestSuppressUniqueIds) + $(HarvestTransforms) + + + + + + ConvertReferences; + ConvertBundleReferences; + HarvestProjects; + HarvestDirectory; + HarvestFile; + GenerateCode; + + + + + + + + RefreshGeneratedFile; + RefreshBundleGeneratedFile + + + + + + + + + <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' "> + %(_MSBuildProjectReferenceExistent.RefTargetDir) + Binaries;Symbols;Sources;Content;Satellites;Documents + %(_MSBuildProjectReferenceExistent.Name) + $(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs + + + + + + + + + + <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" /> + + + + + + + + + <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' "> + Binaries;Symbols;Sources;Content;Satellites;Documents + payloadgroup + $(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs + + + + + + + + + + <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(HarvestProjectsTransforms) + $(HarvestProjectsProjectOutputGroups) + $(HarvestProjectsDirectoryIds) + + + $(HarvestProjectsTransforms) + $(HarvestProjectsProjectOutputGroups) + $(HarvestProjectsDirectoryIds) + + + + + CombineHarvestProjects + + + + + + + + + + + + + + + + + $(HarvestDirectoryTransforms) + $(HarvestDirectoryComponentGroupName) + $(HarvestDirectoryDirectoryRefId) + $(HarvestDirectoryKeepEmptyDirectories) + $(HarvestDirectoryPreprocessorVariable) + $(HarvestDirectorySuppressCom) + $(HarvestDirectorySuppressRootDirectory) + $(HarvestDirectorySuppressRegistry) + + + + + + GetHarvestDirectoryContent + + + + + + + + + + + + + + + + + + + + + + + + + + $(HarvestFileTransforms) + $(HarvestFileComponentGroupName) + $(HarvestFileDirectoryRefId) + $(HarvestFilePreprocessorVariable) + $(HarvestFileSuppressCom) + $(HarvestFileSuppressRegistry) + $(HarvestFileSuppressRootDirectory) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.MSBuild/tools/wix.signing.targets b/src/WixToolset.MSBuild/tools/wix.signing.targets new file mode 100644 index 00000000..7c25175f --- /dev/null +++ b/src/WixToolset.MSBuild/tools/wix.signing.targets @@ -0,0 +1,370 @@ + + + + + + $(MSBuildProjectFile).Signed.txt + $(IntermediateOutputPath)$(SignedFileName) + + + + + + + + + $(NoLogo) + $(SuppressAllWarnings) + $(SuppressSpecificWarnings) + $(TreatWarningsAsErrors) + $(TreatSpecificWarningsAsErrors) + $(VerboseOutput) + + + + + + GetMsmsToSign; + InternalSignMsm; + + + GetCabsToSign; + GetMsiToSign; + InternalSignCabs; + InscribeMsi; + InternalSignMsi; + + + GetContainersToSign; + InternalSignContainers; + InscribeBundleEngine; + InternalSignBundleEngine; + InscribeBundle; + InternalSignBundle; + + + + WixBuild; + CalculateSignTargetFiles; + BeforeSigning; + $(InternalSignDependsOn); + AfterSigning + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.MSBuild/tools/wix.targets b/src/WixToolset.MSBuild/tools/wix.targets new file mode 100644 index 00000000..b35d18c7 --- /dev/null +++ b/src/WixToolset.MSBuild/tools/wix.targets @@ -0,0 +1,1060 @@ + + + + + + true + + + + + + + + + + $(MSBuildThisFileDirectory)netcoreapp2.1\ + $(MSBuildThisFileDirectory)net461\ + $(WixBinDir)WixToolset.BuildTasks.dll + $(MSBuildThisFileDirectory)wix.harvest.targets + $(MSBuildThisFileDirectory)wix.signing.targets + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + $(MSBuildAllProjects);$(WixHarvestTargetsPath) + $(MSBuildAllProjects);$(WixSigningTargetsPath) + $(MSBuildAllProjects);$(CustomBeforeWixTargets) + $(MSBuildAllProjects);$(CustomAfterWixTargets) + + + + + + .wxs + wix + wix + + + $(MSBuildProjectName) + $(OutputName) + + + Package + + + full + + + + + .msi + .msm + .pcp + .wixlib + .exe + .wixipl + + + + + + + $(TargetDir) + $(PdbOutputDir)\ + + + $([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`)) + + + $(TargetName).wixpdb + + + $(TargetPdbDir)$(TargetPdbFileName) + + + + + + + + + + + + + + + + + $(MSBuildProjectFile).BindContentsFileList.txt + $(MSBuildProjectFile).BindOutputsFileList.txt + $(MSBuildProjectFile).BindBuiltOutputsFileList.txt + + + + $(IntermediateOutputPath)cabcache\ + + + + $(WixBinDir) + + + + + + + + + + + + $(NoLogo) + $(SuppressAllWarnings) + $(SuppressSpecificWarnings) + $(TreatWarningsAsErrors) + $(TreatSpecificWarningsAsErrors) + $(VerboseOutput) + + $(Platform) + + + + + $(NoLogo) + $(BindFiles) + $(Pedantic) + $(SuppressAllWarnings) + $(SuppressSpecificWarnings) + $(SuppressSchemaValidation) + $(SuppressIntermediateFileVersionMatching) + $(TreatWarningsAsErrors) + $(TreatSpecificWarningsAsErrors) + $(VerboseOutput) + + + + + $(NoLogo) + $(BindFiles) + $(Pedantic) + $(SuppressAllWarnings) + $(SuppressSpecificWarnings) + $(SuppressSchemaValidation) + $(SuppressIntermediateFileVersionMatching) + $(TreatWarningsAsErrors) + $(TreatSpecificWarningsAsErrors) + $(VerboseOutput) + + + + + + + + + + + + + + + + + + <_PleaseSetThisInProjectFile>Please set this in the project file before the <Import> of the wix.targets file. + <_OutputTypeDescription>Possible values are: 'Package', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'. $(_PleaseSetThisInProjectFile) + + + + + + + + + + + + + + + + + + + BuildOnlySettings; + PrepareForBuild; + PreBuildEvent; + + WixBuild; + Signing; + + GetTargetPath; + PrepareForRun; + IncrementalClean; + PostBuildEvent + + + + + + + + + + BeforeResolveReferences; + AssignProjectConfiguration; + ResolveProjectReferences; + ResolveWixLibraryReferences; + ResolveWixExtensionReferences; + AfterResolveReferences + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AssignTargetPaths + + + + + + + + + ResolveReferences; + BeforeCompile; + _TimeStampBeforeCompile; + + CalculateDefineConstants; + Harvest; + + GenerateCompileWithObjectPath; + + AssignTargetPaths; + ReadPreviousBindInputsAndBuiltOutputs; + + CoreWixBuild; + + UpdateLinkFileWrites; + _TimeStampAfterCompile; + AfterCompile + + + + + + + + + $([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetFileName))) + + $(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName) + + + + + + + + + + + ResolveReferences + + + + + + Configuration=$(ConfigurationName); + OutDir=$(OutDir); + Platform=$(PlatformName); + ProjectDir=$(ProjectDir); + ProjectExt=$(ProjectExt); + ProjectFileName=$(ProjectFileName); + ProjectName=$(ProjectName); + ProjectPath=$(ProjectPath); + TargetDir=$(TargetDir); + TargetExt=$(TargetExt); + TargetFileName=$(TargetFileName); + TargetName=$(TargetName); + TargetPath=$(TargetPath); + + + + + $(SolutionDefineConstants);DevEnvDir=$(DevEnvDir) + $(SolutionDefineConstants);SolutionDir=$(SolutionDir) + $(SolutionDefineConstants);SolutionExt=$(SolutionExt) + $(SolutionDefineConstants);SolutionFileName=$(SolutionFileName) + $(SolutionDefineConstants);SolutionName=$(SolutionName) + $(SolutionDefineConstants);SolutionPath=$(SolutionPath) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_CulturedTargetPath Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)" /> + <_CulturedTargetPdbPath Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbFileName)" /> + + + + @(_CulturedTargetPath) + @(_CulturedTargetPdbPath) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(TargetPath) + $(TargetFileName) + + + + + + PrepareForBuild;AssignTargetPaths + + + + + + + + + + + + + <_BuiltProjectOutputGroupOutputIntermediate Include="$(TargetPath)" /> + + + + + + + %(_BuiltProjectOutputGroupOutputIntermediate.FullPath) + + + + + + + AssignTargetPaths + + + + + + + + + + + + + + + + true + + + + true + true + $([System.IO.Path]::GetFullPath($(IntermediateOutputPath))) + + + + + + + + + <_FullPathToCopy Include="$(OutputFile)" Condition=" '@(_FullPathToCopy)'=='' " /> + <_RelativePath Include="$([MSBuild]::MakeRelative($(FullIntermediateOutputPath), %(_FullPathToCopy.Identity)))" /> + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WixToolset.MSBuild/wix.ca.targets b/src/WixToolset.MSBuild/wix.ca.targets deleted file mode 100644 index 4578c2d8..00000000 --- a/src/WixToolset.MSBuild/wix.ca.targets +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - true - - $(TargetName).CA$(TargetExt) - - $(MSBuildThisFileDirectory) - $(WixSdkPath)x86\ - $(WixSdkPath)x64\ - - $(WixSdkPath)MakeSfxCA.exe - $(WixSdkX64Path)SfxCA.dll - $(WixSdkX86Path)SfxCA.dll - - - - - - - - - - - - - - - - - - - @(CustomActionReferenceContents);@(Content->'%(FullPath)');$(CustomActionContents) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/WixToolset.MSBuild/wix.harvest.targets b/src/WixToolset.MSBuild/wix.harvest.targets deleted file mode 100644 index e4d866ea..00000000 --- a/src/WixToolset.MSBuild/wix.harvest.targets +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - - - - - - - - - - - - $(NoLogo) - $(SuppressAllWarnings) - $(SuppressSpecificWarnings) - $(TreatWarningsAsErrors) - $(TreatSpecificWarningsAsErrors) - $(VerboseOutput) - true - false - true - false - - - - - - false - - $(HarvestNoLogo) - $(HarvestSuppressAllWarnings) - $(HarvestSuppressSpecificWarnings) - $(HarvestTreatWarningsAsErrors) - $(HarvestTreatSpecificWarningsAsErrors) - $(HarvestVerboseOutput) - $(HarvestAutogenerateGuids) - $(HarvestGenerateGuidsNow) - $(HarvestSuppressFragments) - $(HarvestSuppressUniqueIds) - $(HarvestTransforms) - $(IntermediateOutputPath)Product.Generated.wxs - $(IntermediateOutputPath)Bundle.Generated.wxs - - - - - $(HarvestNoLogo) - $(HarvestSuppressAllWarnings) - $(HarvestSuppressSpecificWarnings) - $(HarvestTreatWarningsAsErrors) - $(HarvestTreatSpecificWarningsAsErrors) - $(HarvestVerboseOutput) - $(HarvestAutogenerateGuids) - $(HarvestGenerateGuidsNow) - $(HarvestSuppressFragments) - $(HarvestSuppressUniqueIds) - $(HarvestTransforms) - - - - - $(HarvestNoLogo) - $(HarvestSuppressAllWarnings) - $(HarvestSuppressSpecificWarnings) - $(HarvestTreatWarningsAsErrors) - $(HarvestTreatSpecificWarningsAsErrors) - $(HarvestVerboseOutput) - $(HarvestAutogenerateGuids) - $(HarvestGenerateGuidsNow) - $(HarvestSuppressFragments) - $(HarvestSuppressUniqueIds) - $(HarvestTransforms) - - - - - - ConvertReferences; - ConvertBundleReferences; - HarvestProjects; - HarvestDirectory; - HarvestFile; - GenerateCode; - - - - - - - - RefreshGeneratedFile; - RefreshBundleGeneratedFile - - - - - - - - - <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' "> - %(_MSBuildProjectReferenceExistent.RefTargetDir) - Binaries;Symbols;Sources;Content;Satellites;Documents - %(_MSBuildProjectReferenceExistent.Name) - $(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs - - - - - - - - - - <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" /> - - - - - - - - - <_HeatProjectReference Include="@(_MSBuildProjectReferenceExistent)" Condition=" '%(_MSBuildProjectReferenceExistent.DoNotHarvest)' == '' "> - Binaries;Symbols;Sources;Content;Satellites;Documents - payloadgroup - $(IntermediateOutputPath)_%(_MSBuildProjectReferenceExistent.Filename).wxs - - - - - - - - - - <_GeneratedFiles Include="$(HarvestProjectsGeneratedFile)" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(HarvestProjectsTransforms) - $(HarvestProjectsProjectOutputGroups) - $(HarvestProjectsDirectoryIds) - - - $(HarvestProjectsTransforms) - $(HarvestProjectsProjectOutputGroups) - $(HarvestProjectsDirectoryIds) - - - - - CombineHarvestProjects - - - - - - - - - - - - - - - - - $(HarvestDirectoryTransforms) - $(HarvestDirectoryComponentGroupName) - $(HarvestDirectoryDirectoryRefId) - $(HarvestDirectoryKeepEmptyDirectories) - $(HarvestDirectoryPreprocessorVariable) - $(HarvestDirectorySuppressCom) - $(HarvestDirectorySuppressRootDirectory) - $(HarvestDirectorySuppressRegistry) - - - - - - GetHarvestDirectoryContent - - - - - - - - - - - - - - - - - - - - - - - - - - $(HarvestFileTransforms) - $(HarvestFileComponentGroupName) - $(HarvestFileDirectoryRefId) - $(HarvestFilePreprocessorVariable) - $(HarvestFileSuppressCom) - $(HarvestFileSuppressRegistry) - $(HarvestFileSuppressRootDirectory) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/WixToolset.MSBuild/wix.signing.targets b/src/WixToolset.MSBuild/wix.signing.targets deleted file mode 100644 index 7c25175f..00000000 --- a/src/WixToolset.MSBuild/wix.signing.targets +++ /dev/null @@ -1,370 +0,0 @@ - - - - - - $(MSBuildProjectFile).Signed.txt - $(IntermediateOutputPath)$(SignedFileName) - - - - - - - - - $(NoLogo) - $(SuppressAllWarnings) - $(SuppressSpecificWarnings) - $(TreatWarningsAsErrors) - $(TreatSpecificWarningsAsErrors) - $(VerboseOutput) - - - - - - GetMsmsToSign; - InternalSignMsm; - - - GetCabsToSign; - GetMsiToSign; - InternalSignCabs; - InscribeMsi; - InternalSignMsi; - - - GetContainersToSign; - InternalSignContainers; - InscribeBundleEngine; - InternalSignBundleEngine; - InscribeBundle; - InternalSignBundle; - - - - WixBuild; - CalculateSignTargetFiles; - BeforeSigning; - $(InternalSignDependsOn); - AfterSigning - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/WixToolset.MSBuild/wix.targets b/src/WixToolset.MSBuild/wix.targets deleted file mode 100644 index b35d18c7..00000000 --- a/src/WixToolset.MSBuild/wix.targets +++ /dev/null @@ -1,1060 +0,0 @@ - - - - - - true - - - - - - - - - - $(MSBuildThisFileDirectory)netcoreapp2.1\ - $(MSBuildThisFileDirectory)net461\ - $(WixBinDir)WixToolset.BuildTasks.dll - $(MSBuildThisFileDirectory)wix.harvest.targets - $(MSBuildThisFileDirectory)wix.signing.targets - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - $(MSBuildAllProjects);$(WixHarvestTargetsPath) - $(MSBuildAllProjects);$(WixSigningTargetsPath) - $(MSBuildAllProjects);$(CustomBeforeWixTargets) - $(MSBuildAllProjects);$(CustomAfterWixTargets) - - - - - - .wxs - wix - wix - - - $(MSBuildProjectName) - $(OutputName) - - - Package - - - full - - - - - .msi - .msm - .pcp - .wixlib - .exe - .wixipl - - - - - - - $(TargetDir) - $(PdbOutputDir)\ - - - $([System.IO.Path]::GetFullPath(`$([System.IO.Path]::Combine(`$(MSBuildProjectDirectory)`, `$(PdbOutputDir)`))`)) - - - $(TargetName).wixpdb - - - $(TargetPdbDir)$(TargetPdbFileName) - - - - - - - - - - - - - - - - - $(MSBuildProjectFile).BindContentsFileList.txt - $(MSBuildProjectFile).BindOutputsFileList.txt - $(MSBuildProjectFile).BindBuiltOutputsFileList.txt - - - - $(IntermediateOutputPath)cabcache\ - - - - $(WixBinDir) - - - - - - - - - - - - $(NoLogo) - $(SuppressAllWarnings) - $(SuppressSpecificWarnings) - $(TreatWarningsAsErrors) - $(TreatSpecificWarningsAsErrors) - $(VerboseOutput) - - $(Platform) - - - - - $(NoLogo) - $(BindFiles) - $(Pedantic) - $(SuppressAllWarnings) - $(SuppressSpecificWarnings) - $(SuppressSchemaValidation) - $(SuppressIntermediateFileVersionMatching) - $(TreatWarningsAsErrors) - $(TreatSpecificWarningsAsErrors) - $(VerboseOutput) - - - - - $(NoLogo) - $(BindFiles) - $(Pedantic) - $(SuppressAllWarnings) - $(SuppressSpecificWarnings) - $(SuppressSchemaValidation) - $(SuppressIntermediateFileVersionMatching) - $(TreatWarningsAsErrors) - $(TreatSpecificWarningsAsErrors) - $(VerboseOutput) - - - - - - - - - - - - - - - - - - <_PleaseSetThisInProjectFile>Please set this in the project file before the <Import> of the wix.targets file. - <_OutputTypeDescription>Possible values are: 'Package', 'Module', 'Library', 'Bundle', 'IntermediatePostLink'. $(_PleaseSetThisInProjectFile) - - - - - - - - - - - - - - - - - - - BuildOnlySettings; - PrepareForBuild; - PreBuildEvent; - - WixBuild; - Signing; - - GetTargetPath; - PrepareForRun; - IncrementalClean; - PostBuildEvent - - - - - - - - - - BeforeResolveReferences; - AssignProjectConfiguration; - ResolveProjectReferences; - ResolveWixLibraryReferences; - ResolveWixExtensionReferences; - AfterResolveReferences - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AssignTargetPaths - - - - - - - - - ResolveReferences; - BeforeCompile; - _TimeStampBeforeCompile; - - CalculateDefineConstants; - Harvest; - - GenerateCompileWithObjectPath; - - AssignTargetPaths; - ReadPreviousBindInputsAndBuiltOutputs; - - CoreWixBuild; - - UpdateLinkFileWrites; - _TimeStampAfterCompile; - AfterCompile - - - - - - - - - $([System.IO.Path]::GetFullPath($(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetFileName))) - - $(IntermediateOutputPath)%(CultureGroup.OutputFolder)$(TargetPdbFileName) - - - - - - - - - - - ResolveReferences - - - - - - Configuration=$(ConfigurationName); - OutDir=$(OutDir); - Platform=$(PlatformName); - ProjectDir=$(ProjectDir); - ProjectExt=$(ProjectExt); - ProjectFileName=$(ProjectFileName); - ProjectName=$(ProjectName); - ProjectPath=$(ProjectPath); - TargetDir=$(TargetDir); - TargetExt=$(TargetExt); - TargetFileName=$(TargetFileName); - TargetName=$(TargetName); - TargetPath=$(TargetPath); - - - - - $(SolutionDefineConstants);DevEnvDir=$(DevEnvDir) - $(SolutionDefineConstants);SolutionDir=$(SolutionDir) - $(SolutionDefineConstants);SolutionExt=$(SolutionExt) - $(SolutionDefineConstants);SolutionFileName=$(SolutionFileName) - $(SolutionDefineConstants);SolutionName=$(SolutionName) - $(SolutionDefineConstants);SolutionPath=$(SolutionPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_CulturedTargetPath Include="$(TargetDir)%(CultureGroup.OutputFolder)$(TargetFileName)" /> - <_CulturedTargetPdbPath Include="$(TargetPdbDir)%(CultureGroup.OutputFolder)$(TargetPdbFileName)" /> - - - - @(_CulturedTargetPath) - @(_CulturedTargetPdbPath) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(TargetPath) - $(TargetFileName) - - - - - - PrepareForBuild;AssignTargetPaths - - - - - - - - - - - - - <_BuiltProjectOutputGroupOutputIntermediate Include="$(TargetPath)" /> - - - - - - - %(_BuiltProjectOutputGroupOutputIntermediate.FullPath) - - - - - - - AssignTargetPaths - - - - - - - - - - - - - - - - true - - - - true - true - $([System.IO.Path]::GetFullPath($(IntermediateOutputPath))) - - - - - - - - - <_FullPathToCopy Include="$(OutputFile)" Condition=" '@(_FullPathToCopy)'=='' " /> - <_RelativePath Include="$([MSBuild]::MakeRelative($(FullIntermediateOutputPath), %(_FullPathToCopy.Identity)))" /> - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs deleted file mode 100644 index 0768f863..00000000 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildFixture.cs +++ /dev/null @@ -1,304 +0,0 @@ -// 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. - -namespace WixToolsetTest.BuildTasks -{ - using System; - using System.IO; - using System.Linq; - using WixBuildTools.TestSupport; - using WixToolset.BuildTasks; - using Xunit; - - public class MsbuildFixture - { - private static readonly string WixBinPath = Path.GetDirectoryName(new Uri(typeof(WixBuild).Assembly.CodeBase).AbsolutePath) + "\\"; - private static readonly string WixTargetsPath = Path.Combine(WixBinPath, "wix.targets"); - - [Fact] - public void CanBuildSimpleBundle() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); - Assert.Single(platformSwitches); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - - var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .OrderBy(s => s) - .ToArray(); - Assert.Equal(new[] - { - @"bin\SimpleBundle.exe", - @"bin\SimpleBundle.wixpdb", - }, paths); - } - } - - [Fact] - public void CanBuildSimpleMsiPackage() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); - Assert.Single(platformSwitches); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Equal(4, warnings.Count()); - - var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .OrderBy(s => s) - .ToArray(); - Assert.Equal(new[] - { - @"bin\en-US\cab1.cab", - @"bin\en-US\MsiPackage.msi", - @"bin\en-US\MsiPackage.wixpdb", - }, paths); - } - } - - [Fact] - public void CanBuildWithDefaultAndExplicitlyFullWixpdbs() - { - var expectedOutputs = new[] - { - @"bin\en-US\cab1.cab", - @"bin\en-US\MsiPackage.msi", - @"bin\en-US\MsiPackage.wixpdb", - }; - - this.AssertWixpdb(null, expectedOutputs); - this.AssertWixpdb("Full", expectedOutputs); - } - - [Fact] - public void CanBuildWithNoWixpdb() - { - this.AssertWixpdb("NONE", new[] - { - @"bin\en-US\cab1.cab", - @"bin\en-US\MsiPackage.msi", - }); - } - - private void AssertWixpdb(string wixpdbType, string[] expectedOutputFiles) - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}", - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - }); - result.AssertSuccess(); - - var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .OrderBy(s => s) - .ToArray(); - Assert.Equal(expectedOutputFiles, paths); - } - } - - [Fact] - public void CanBuild64BitMsiPackage() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - $"-p:InstallerPlatform=x64", - }); - result.AssertSuccess(); - - var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x64")); - Assert.Single(platformSwitches); - } - } - - [Fact(Skip = "Currently fails")] - public void CanBuildSimpleMsiPackageWithIceSuppressions() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - "-p:SuppressIces=\"ICE45;ICE46\"" - }); - result.AssertSuccess(); - } - } - - [Fact] - public void CanBuildSimpleMsiPackageWithWarningSuppressions() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - "-p:SuppressSpecificWarnings=\"1118;1102\"" - }); - result.AssertSuccess(); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - } - } - - [Fact] - public void CanBuildSimpleMsiPackageAsWixipl() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - "-p:OutputType=IntermediatePostLink" - }); - result.AssertSuccess(); - - var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .Single(); - Assert.Equal(@"bin\MsiPackage.wixipl", path); - } - } - - [Fact] - public void CanBuildAndCleanSimpleMsiPackage() - { - var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - // Build - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - "-v:diag" - }); - result.AssertSuccess(); - - var buildOutput = String.Join("\r\n", result.Output); - - var createdPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .OrderBy(s => s) - .ToArray(); - Assert.NotEmpty(createdPaths); - - // Clean - result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}", - "-t:Clean", - "-v:diag" - }); - result.AssertSuccess(); - - var cleanOutput = String.Join("\r\n", result.Output); - - // Clean is only expected to delete the files listed in {Project}.FileListAbsolute.txt, - // so this is not quite right but close enough. - var remainingPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories) - .Select(s => s.Substring(baseFolder.Length + 1)) - .Where(s => s != "obj\\MsiPackage.wixproj.FileListAbsolute.txt") - .OrderBy(s => s) - .ToArray(); - Assert.Empty(remainingPaths); - } - } - } -} diff --git a/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs deleted file mode 100644 index 95805658..00000000 --- a/src/test/WixToolsetTest.BuildTasks/MsbuildHeatFixture.cs +++ /dev/null @@ -1,155 +0,0 @@ -// 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. - -namespace WixToolsetTest.BuildTasks -{ - using System; - using System.IO; - using System.Linq; - using WixBuildTools.TestSupport; - using WixToolset.BuildTasks; - using WixToolset.Core.TestPackage; - using WixToolset.Data; - using WixToolset.Data.Tuples; - using Xunit; - - public class MsbuildHeatFixture - { - private static readonly string WixBinPath = Path.GetDirectoryName(new Uri(typeof(WixBuild).Assembly.CodeBase).AbsolutePath) + "\\"; - private static readonly string WixTargetsPath = Path.Combine(WixBinPath, "wix.targets"); - - [Fact] - public void CanBuildHeatFilePackage() - { - var projectPath = TestData.Get(@"TestData\HeatFilePackage\HeatFilePackage.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); - Assert.Single(heatCommandLines); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - - var generatedFilePath = Path.Combine(intermediateFolder, @"_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - var generatedContents = File.ReadAllText(generatedFilePath); - var testXml = generatedContents.GetTestXml(); - Assert.Equal(@"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - var pdbPath = Path.Combine(binFolder, "HeatFilePackage.wixpdb"); - Assert.True(File.Exists(pdbPath)); - - var intermediate = Intermediate.Load(pdbPath); - var section = intermediate.Sections.Single(); - - var fileTuple = section.Tuples.OfType().Single(); - Assert.Equal(@"SourceDir\HeatFilePackage.wixproj", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); - } - } - - [Fact] - public void CanBuildHeatFileWithMultipleFilesPackage() - { - var projectPath = TestData.Get(@"TestData\HeatFileMultpleFilesSameFileName\HeatFileMultpleFilesSameFileName.wixproj"); - - using (var fs = new DisposableFileSystem()) - { - var baseFolder = fs.GetFolder(); - var binFolder = Path.Combine(baseFolder, @"bin\"); - var intermediateFolder = Path.Combine(baseFolder, @"obj\"); - - var result = MsbuildRunner.Execute(projectPath, new[] - { - $"-p:WixTargetsPath={WixTargetsPath}", - $"-p:WixBinDir={WixBinPath}", - $"-p:IntermediateOutputPath={intermediateFolder}", - $"-p:OutputPath={binFolder}" - }); - result.AssertSuccess(); - - var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); - Assert.Equal(2, heatCommandLines.Count()); - - var warnings = result.Output.Where(line => line.Contains(": warning")); - Assert.Empty(warnings); - - var generatedFilePath = Path.Combine(intermediateFolder, @"_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - var generatedContents = File.ReadAllText(generatedFilePath); - var testXml = generatedContents.GetTestXml(); - Assert.Equal("" + - "" + - "" + - "" + - @"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - generatedFilePath = Path.Combine(intermediateFolder, @"_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); - Assert.True(File.Exists(generatedFilePath)); - - generatedContents = File.ReadAllText(generatedFilePath); - testXml = generatedContents.GetTestXml(); - Assert.Equal("" + - "" + - "" + - "" + - @"" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "", testXml); - - var pdbPath = Path.Combine(binFolder, "HeatFileMultpleFilesSameFileName.wixpdb"); - Assert.True(File.Exists(pdbPath)); - - var intermediate = Intermediate.Load(pdbPath); - var section = intermediate.Sections.Single(); - - var fileTuples = section.Tuples.OfType().ToArray(); - Assert.Equal(@"SourceDir\MyProgram.txt", fileTuples[0][FileTupleFields.Source].PreviousValue.AsPath().Path); - Assert.Equal(@"SourceDir\MyProgram.json", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); - } - } - } -} diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/HeatFileMultpleFilesSameFileName.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/HeatFileMultpleFilesSameFileName.wixproj deleted file mode 100644 index 860fc2dd..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/HeatFileMultpleFilesSameFileName.wixproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - Debug - x86 - - - - 7fb77005-c6e0-454f-8c2d-0a4a79c918ba - - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - - - true - - - - - TxtProductComponents - INSTALLFOLDER - true - - - JsonProductComponents - INSTALLFOLDER - true - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.json b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.json deleted file mode 100644 index 5f282702..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.json +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.txt b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.txt deleted file mode 100644 index 5f282702..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/MyProgram.txt +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/Package.wxs deleted file mode 100644 index 884da274..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFileMultpleFilesSameFileName/Package.wxs +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj deleted file mode 100644 index 87f4388a..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/HeatFilePackage.wixproj +++ /dev/null @@ -1,56 +0,0 @@ - - - - Debug - x86 - - - - 7fb77005-c6e0-454f-8c2d-0a4a79c918ba - - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - - - true - - - - - ProductComponents - INSTALLFOLDER - true - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs deleted file mode 100644 index e509c464..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/HeatFilePackage/Package.wxs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj deleted file mode 100644 index e04ea43d..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - Debug - x86 - 0.9 - 7fb77005-c6e0-454f-8c2d-0a4a79c918ba - MsiPackage - Package - MsiPackage - MsiPackage - en-US,en;de-DE - - - - ..\..\..\..\..\..\build\Release\publish\net461\wix.targets - - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl deleted file mode 100644 index 23493ace..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - German DowngradeError - German FeatureTitle - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl deleted file mode 100644 index 38c12ac1..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - A newer version of [ProductName] is already installed. - MsiPackage - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs deleted file mode 100644 index d5a5a40d..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs deleted file mode 100644 index e26c4509..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt deleted file mode 100644 index cd0db0e1..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt +++ /dev/null @@ -1 +0,0 @@ -This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln b/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln deleted file mode 100644 index 2c88704e..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.8 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5} - EndGlobalSection -EndGlobal diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj deleted file mode 100644 index d5cac8d8..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj +++ /dev/null @@ -1,49 +0,0 @@ - - - - Debug - x86 - - - - 7fb77005-c6e0-454f-8c2d-0a4a79c918ba - - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl deleted file mode 100644 index 38c12ac1..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - A newer version of [ProductName] is already installed. - MsiPackage - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs deleted file mode 100644 index f7998fff..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/Package.wxs +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs deleted file mode 100644 index ddb95faf..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt deleted file mode 100644 index cd0db0e1..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/MsiPackage/data/test.txt +++ /dev/null @@ -1 +0,0 @@ -This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs deleted file mode 100644 index 6cd04712..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj deleted file mode 100644 index 4c837936..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj +++ /dev/null @@ -1,45 +0,0 @@ - - - - Debug - x86 - - - - 6670d5c9-bbec-4828-ab60-4a1c0ffeb97d - Bundle - - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - Debug - - - $(Platform) - bin\$(Platform)\$(Configuration)\ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln b/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln deleted file mode 100644 index dd21489d..00000000 --- a/src/test/WixToolsetTest.BuildTasks/TestData/SimpleMsiPackage/SimpleMsiPackage.sln +++ /dev/null @@ -1,39 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30011.22 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" -EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SimpleBundle", "SimpleBundle\SimpleBundle.wixproj", "{6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 - {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x64.ActiveCfg = Debug|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.ActiveCfg = Debug|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.Build.0 = Debug|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x64.ActiveCfg = Release|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.ActiveCfg = Release|x86 - {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5} - EndGlobalSection -EndGlobal diff --git a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj index 9fb2bc82..22d421de 100644 --- a/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj +++ b/src/test/WixToolsetTest.BuildTasks/WixToolsetTest.BuildTasks.csproj @@ -10,31 +10,16 @@ - - - - - - - - - - - - - - - - - - - + + + + - - - + + + diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs new file mode 100644 index 00000000..85f111a9 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/MsbuildFixture.cs @@ -0,0 +1,293 @@ +// 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. + +namespace WixToolsetTest.MSBuild +{ + using System; + using System.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using Xunit; + + public class MsbuildFixture + { + private static readonly string WixTargetsPath = Path.Combine(new Uri(typeof(MsbuildFixture).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "tools", "wix.targets"); + + [Fact] + public void CanBuildSimpleBundle() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\SimpleBundle\SimpleBundle.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}" + }); + result.AssertSuccess(); + + var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); + Assert.Single(platformSwitches); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .OrderBy(s => s) + .ToArray(); + Assert.Equal(new[] + { + @"bin\SimpleBundle.exe", + @"bin\SimpleBundle.wixpdb", + }, paths); + } + } + + [Fact] + public void CanBuildSimpleMsiPackage() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}" + }); + result.AssertSuccess(); + + var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x86")); + Assert.Single(platformSwitches); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Equal(4, warnings.Count()); + + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .OrderBy(s => s) + .ToArray(); + Assert.Equal(new[] + { + @"bin\en-US\cab1.cab", + @"bin\en-US\MsiPackage.msi", + @"bin\en-US\MsiPackage.wixpdb", + }, paths); + } + } + + [Fact] + public void CanBuildWithDefaultAndExplicitlyFullWixpdbs() + { + var expectedOutputs = new[] + { + @"bin\en-US\cab1.cab", + @"bin\en-US\MsiPackage.msi", + @"bin\en-US\MsiPackage.wixpdb", + }; + + this.AssertWixpdb(null, expectedOutputs); + this.AssertWixpdb("Full", expectedOutputs); + } + + [Fact] + public void CanBuildWithNoWixpdb() + { + this.AssertWixpdb("NONE", new[] + { + @"bin\en-US\cab1.cab", + @"bin\en-US\MsiPackage.msi", + }); + } + + private void AssertWixpdb(string wixpdbType, string[] expectedOutputFiles) + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + wixpdbType == null ? String.Empty : $"-p:WixPdbType={wixpdbType}", + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + }); + result.AssertSuccess(); + + var paths = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .OrderBy(s => s) + .ToArray(); + Assert.Equal(expectedOutputFiles, paths); + } + } + + [Fact] + public void CanBuild64BitMsiPackage() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + $"-p:InstallerPlatform=x64", + }); + result.AssertSuccess(); + + var platformSwitches = result.Output.Where(line => line.TrimStart().StartsWith("wix.exe build -platform x64")); + Assert.Single(platformSwitches); + } + } + + [Fact(Skip = "Currently fails")] + public void CanBuildSimpleMsiPackageWithIceSuppressions() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-p:SuppressIces=\"ICE45;ICE46\"" + }); + result.AssertSuccess(); + } + } + + [Fact] + public void CanBuildSimpleMsiPackageWithWarningSuppressions() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-p:SuppressSpecificWarnings=\"1118;1102\"" + }); + result.AssertSuccess(); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + } + } + + [Fact] + public void CanBuildSimpleMsiPackageAsWixipl() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-p:OutputType=IntermediatePostLink" + }); + result.AssertSuccess(); + + var path = Directory.EnumerateFiles(binFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .Single(); + Assert.Equal(@"bin\MsiPackage.wixipl", path); + } + } + + [Fact] + public void CanBuildAndCleanSimpleMsiPackage() + { + var projectPath = TestData.Get(@"TestData\SimpleMsiPackage\MsiPackage\MsiPackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + // Build + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-v:diag" + }); + result.AssertSuccess(); + + var buildOutput = String.Join("\r\n", result.Output); + + var createdPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .OrderBy(s => s) + .ToArray(); + Assert.NotEmpty(createdPaths); + + // Clean + result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}", + "-t:Clean", + "-v:diag" + }); + result.AssertSuccess(); + + var cleanOutput = String.Join("\r\n", result.Output); + + // Clean is only expected to delete the files listed in {Project}.FileListAbsolute.txt, + // so this is not quite right but close enough. + var remainingPaths = Directory.EnumerateFiles(baseFolder, @"*.*", SearchOption.AllDirectories) + .Select(s => s.Substring(baseFolder.Length + 1)) + .Where(s => s != "obj\\MsiPackage.wixproj.FileListAbsolute.txt") + .OrderBy(s => s) + .ToArray(); + Assert.Empty(remainingPaths); + } + } + } +} diff --git a/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs new file mode 100644 index 00000000..fa8acb81 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/MsbuildHeatFixture.cs @@ -0,0 +1,151 @@ +// 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. + +namespace WixToolsetTest.MSBuild +{ + using System; + using System.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using WixToolset.Data.Tuples; + using Xunit; + + public class MsbuildHeatFixture + { + private static readonly string WixTargetsPath = Path.Combine(new Uri(typeof(MsbuildHeatFixture).Assembly.CodeBase).AbsolutePath, "..", "..", "publish", "WixToolset.MSBuild", "tools", "wix.targets"); + + [Fact] + public void CanBuildHeatFilePackage() + { + var projectPath = TestData.Get(@"TestData\HeatFilePackage\HeatFilePackage.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}" + }); + result.AssertSuccess(); + + var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); + Assert.Single(heatCommandLines); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + + var generatedFilePath = Path.Combine(intermediateFolder, @"_ProductComponents_INSTALLFOLDER_HeatFilePackage.wixproj_file.wxs"); + Assert.True(File.Exists(generatedFilePath)); + + var generatedContents = File.ReadAllText(generatedFilePath); + var testXml = generatedContents.GetTestXml(); + Assert.Equal(@"" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "", testXml); + + var pdbPath = Path.Combine(binFolder, "HeatFilePackage.wixpdb"); + Assert.True(File.Exists(pdbPath)); + + var intermediate = Intermediate.Load(pdbPath); + var section = intermediate.Sections.Single(); + + var fileTuple = section.Tuples.OfType().Single(); + Assert.Equal(@"SourceDir\HeatFilePackage.wixproj", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); + } + } + + [Fact] + public void CanBuildHeatFileWithMultipleFilesPackage() + { + var projectPath = TestData.Get(@"TestData\HeatFileMultipleFilesSameFileName\HeatFileMultipleFilesSameFileName.wixproj"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var binFolder = Path.Combine(baseFolder, @"bin\"); + var intermediateFolder = Path.Combine(baseFolder, @"obj\"); + + var result = MsbuildRunner.Execute(projectPath, new[] + { + $"-p:WixTargetsPath={WixTargetsPath}", + $"-p:IntermediateOutputPath={intermediateFolder}", + $"-p:OutputPath={binFolder}" + }); + result.AssertSuccess(); + + var heatCommandLines = result.Output.Where(line => line.TrimStart().StartsWith("heat.exe file")); + Assert.Equal(2, heatCommandLines.Count()); + + var warnings = result.Output.Where(line => line.Contains(": warning")); + Assert.Empty(warnings); + + var generatedFilePath = Path.Combine(intermediateFolder, @"_TxtProductComponents_INSTALLFOLDER_MyProgram.txt_file.wxs"); + Assert.True(File.Exists(generatedFilePath)); + + var generatedContents = File.ReadAllText(generatedFilePath); + var testXml = generatedContents.GetTestXml(); + Assert.Equal("" + + "" + + "" + + "" + + @"" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "", testXml); + + generatedFilePath = Path.Combine(intermediateFolder, @"_JsonProductComponents_INSTALLFOLDER_MyProgram.json_file.wxs"); + Assert.True(File.Exists(generatedFilePath)); + + generatedContents = File.ReadAllText(generatedFilePath); + testXml = generatedContents.GetTestXml(); + Assert.Equal("" + + "" + + "" + + "" + + @"" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "", testXml); + + var pdbPath = Path.Combine(binFolder, "HeatFileMultipleFilesSameFileName.wixpdb"); + Assert.True(File.Exists(pdbPath)); + + var intermediate = Intermediate.Load(pdbPath); + var section = intermediate.Sections.Single(); + + var fileTuples = section.Tuples.OfType().ToArray(); + Assert.Equal(@"SourceDir\MyProgram.txt", fileTuples[0][FileTupleFields.Source].PreviousValue.AsPath().Path); + Assert.Equal(@"SourceDir\MyProgram.json", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); + } + } + } +} diff --git a/src/test/WixToolsetTest.MSBuild/README.md b/src/test/WixToolsetTest.MSBuild/README.md new file mode 100644 index 00000000..7faf34b9 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/README.md @@ -0,0 +1,5 @@ +In order to properly test wix.targets, +all of the supported architectures for WixToolset.BuildTasks need to be available in the layout used in the Nuget package. +Making this happen on every build for the solution takes too long, +so this project relies on manually running appveyor.cmd to publish everything before the tests can be run. +appveyor.cmd needs to be ran again every time changes are made in other projects, including the targets themselves. \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/HeatFileMultipleFilesSameFileName.wixproj b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/HeatFileMultipleFilesSameFileName.wixproj new file mode 100644 index 00000000..860fc2dd --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/HeatFileMultipleFilesSameFileName.wixproj @@ -0,0 +1,61 @@ + + + + Debug + x86 + + + + 7fb77005-c6e0-454f-8c2d-0a4a79c918ba + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + true + + + + + TxtProductComponents + INSTALLFOLDER + true + + + JsonProductComponents + INSTALLFOLDER + true + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.json b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.json new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.json @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.txt b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.txt new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/MyProgram.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/Package.wxs b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/Package.wxs new file mode 100644 index 00000000..884da274 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFileMultipleFilesSameFileName/Package.wxs @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/HeatFilePackage.wixproj b/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/HeatFilePackage.wixproj new file mode 100644 index 00000000..87f4388a --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/HeatFilePackage.wixproj @@ -0,0 +1,56 @@ + + + + Debug + x86 + + + + 7fb77005-c6e0-454f-8c2d-0a4a79c918ba + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + true + + + + + ProductComponents + INSTALLFOLDER + true + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/Package.wxs b/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/Package.wxs new file mode 100644 index 00000000..e509c464 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/HeatFilePackage/Package.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj new file mode 100644 index 00000000..e04ea43d --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/MsiPackage.wixproj @@ -0,0 +1,57 @@ + + + + Debug + x86 + 0.9 + 7fb77005-c6e0-454f-8c2d-0a4a79c918ba + MsiPackage + Package + MsiPackage + MsiPackage + en-US,en;de-DE + + + + ..\..\..\..\..\..\build\Release\publish\net461\wix.targets + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl new file mode 100644 index 00000000..23493ace --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.de-de.wxl @@ -0,0 +1,11 @@ + + + + + + German DowngradeError + German FeatureTitle + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs new file mode 100644 index 00000000..d5a5a40d --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/Package.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs new file mode 100644 index 00000000..e26c4509 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/PackageComponents.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MsiPackage/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln new file mode 100644 index 00000000..2c88704e --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/MultiCulturalMsiPackage/MultiCulturalMsiPackage.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5} + EndGlobalSection +EndGlobal diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj new file mode 100644 index 00000000..d5cac8d8 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/MsiPackage.wixproj @@ -0,0 +1,49 @@ + + + + Debug + x86 + + + + 7fb77005-c6e0-454f-8c2d-0a4a79c918ba + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.wxs b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.wxs new file mode 100644 index 00000000..f7998fff --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/Package.wxs @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs new file mode 100644 index 00000000..ddb95faf --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/PackageComponents.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/data/test.txt b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/MsiPackage/data/test.txt @@ -0,0 +1 @@ +This is test.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs new file mode 100644 index 00000000..6cd04712 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/Bundle.wxs @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj new file mode 100644 index 00000000..4c837936 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleBundle/SimpleBundle.wixproj @@ -0,0 +1,45 @@ + + + + Debug + x86 + + + + 6670d5c9-bbec-4828-ab60-4a1c0ffeb97d + Bundle + + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + Debug + + + $(Platform) + bin\$(Platform)\$(Configuration)\ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleMsiPackage.sln b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleMsiPackage.sln new file mode 100644 index 00000000..dd21489d --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/TestData/SimpleMsiPackage/SimpleMsiPackage.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "MsiPackage", "MsiPackage\MsiPackage.wixproj", "{7FB77005-C6E0-454F-8C2D-0A4A79C918BA}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "SimpleBundle", "SimpleBundle\SimpleBundle.wixproj", "{6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.ActiveCfg = Debug|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x64.Build.0 = Debug|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.ActiveCfg = Debug|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Debug|x86.Build.0 = Debug|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.ActiveCfg = Release|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x64.Build.0 = Release|x64 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.ActiveCfg = Release|x86 + {7FB77005-C6E0-454F-8C2D-0A4A79C918BA}.Release|x86.Build.0 = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x64.ActiveCfg = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.ActiveCfg = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Debug|x86.Build.0 = Debug|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x64.ActiveCfg = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.ActiveCfg = Release|x86 + {6670D5C9-BBEC-4828-AB60-4A1C0FFEB97D}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {585B0599-4EB5-4AB6-BC66-819CC78B63D5} + EndGlobalSection +EndGlobal diff --git a/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.csproj b/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.csproj new file mode 100644 index 00000000..bb109557 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.csproj @@ -0,0 +1,43 @@ + + + + + + net461 + false + embedded + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.v3.ncrunchproject b/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.v3.ncrunchproject new file mode 100644 index 00000000..cf22dfa9 --- /dev/null +++ b/src/test/WixToolsetTest.MSBuild/WixToolsetTest.MSBuild.v3.ncrunchproject @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file -- cgit v1.2.3-55-g6feb