From d2f21865933c11b8af80b8383e1dbf611a175133 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 3 Feb 2019 13:19:02 -0600 Subject: Initial commit --- .gitattributes | 2 + .gitignore | 341 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.TXT | 28 +++++ README.md | 2 + 4 files changed, 373 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE.TXT create mode 100644 README.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..dfe07704 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3e8a1553 --- /dev/null +++ b/.gitignore @@ -0,0 +1,341 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb diff --git a/LICENSE.TXT b/LICENSE.TXT new file mode 100644 index 00000000..d4d316ef --- /dev/null +++ b/LICENSE.TXT @@ -0,0 +1,28 @@ +Copyright (c) .NET Foundation and contributors. +This software is released under the Microsoft Reciprocal License (MS-RL) (the "License"); you may not use the software except in compliance with the License. + +The text of the Microsoft Reciprocal License (MS-RL) can be found online at: + http://opensource.org/licenses/ms-rl + + +Microsoft Reciprocal License (MS-RL) + +This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. + +1. Definitions + The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. + A "contribution" is the original software, or any additions or changes to the software. + A "contributor" is any person that distributes its contribution under this license. + "Licensed patents" are a contributor's patent claims that read directly on its contribution. + +2. Grant of Rights + (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. + (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. + +3. Conditions and Limitations + (A) Reciprocal Grants- For any file you distribute that contains code from the software (in source code or binary format), you must provide recipients the source code to that file along with a copy of this license, which license will govern that file. You may license other files that are entirely your own work and do not contain code from the software under any terms you choose. + (B) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. + (C) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. + (D) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. + (E) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. + (F) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. diff --git a/README.md b/README.md new file mode 100644 index 00000000..09feba68 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Dependency.wixext +WixToolset.Dependency.wixext - Dependency WiX Toolset Extension -- cgit v1.2.3-55-g6feb From 72f3dceefa2e3893b061e074380794bc60b67b6f Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 3 Feb 2019 13:20:43 -0600 Subject: Import code from old v4 repo --- src/ca/dllmain.cpp | 27 ++ src/ca/precomp.h | 18 + src/ca/wixdepca.cpp | 516 +++++++++++++++++++++++ src/ca/wixdepca.def | 8 + src/ca/wixdepca.vcxproj | 57 +++ src/ca/wixdepca.vcxproj.filters | 40 ++ src/wixext/Dependency.xsd | 226 ++++++++++ src/wixext/DependencyBinder.cs | 169 ++++++++ src/wixext/DependencyCommon.cs | 26 ++ src/wixext/DependencyCompiler.cs | 615 ++++++++++++++++++++++++++++ src/wixext/DependencyDecompiler.cs | 345 ++++++++++++++++ src/wixext/DependencyExtension.csproj | 50 +++ src/wixext/DependencyExtensionData.cs | 64 +++ src/wixext/messages.xml | 60 +++ src/wixext/tables.xml | 38 ++ src/wixlib/DependencyExtension.wixproj | 27 ++ src/wixlib/DependencyExtension.wxs | 22 + src/wixlib/DependencyExtension_Platform.wxi | 26 ++ src/wixlib/DependencyExtension_x86.wxs | 8 + src/wixlib/en-us.wxl | 8 + 20 files changed, 2350 insertions(+) create mode 100644 src/ca/dllmain.cpp create mode 100644 src/ca/precomp.h create mode 100644 src/ca/wixdepca.cpp create mode 100644 src/ca/wixdepca.def create mode 100644 src/ca/wixdepca.vcxproj create mode 100644 src/ca/wixdepca.vcxproj.filters create mode 100644 src/wixext/Dependency.xsd create mode 100644 src/wixext/DependencyBinder.cs create mode 100644 src/wixext/DependencyCommon.cs create mode 100644 src/wixext/DependencyCompiler.cs create mode 100644 src/wixext/DependencyDecompiler.cs create mode 100644 src/wixext/DependencyExtension.csproj create mode 100644 src/wixext/DependencyExtensionData.cs create mode 100644 src/wixext/messages.xml create mode 100644 src/wixext/tables.xml create mode 100644 src/wixlib/DependencyExtension.wixproj create mode 100644 src/wixlib/DependencyExtension.wxs create mode 100644 src/wixlib/DependencyExtension_Platform.wxi create mode 100644 src/wixlib/DependencyExtension_x86.wxs create mode 100644 src/wixlib/en-us.wxl diff --git a/src/ca/dllmain.cpp b/src/ca/dllmain.cpp new file mode 100644 index 00000000..7d299feb --- /dev/null +++ b/src/ca/dllmain.cpp @@ -0,0 +1,27 @@ +// 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. + +#include "precomp.h" + +/******************************************************************** +DllMain - standard entry point for all WiX custom actions. + +********************************************************************/ +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN ULONG ulReason, + IN LPVOID) +{ + switch(ulReason) + { + case DLL_PROCESS_ATTACH: + WcaGlobalInitialize(hInstance); + ::DisableThreadLibraryCalls(hInstance); + break; + + case DLL_PROCESS_DETACH: + WcaGlobalFinalize(); + break; + } + + return TRUE; +} diff --git a/src/ca/precomp.h b/src/ca/precomp.h new file mode 100644 index 00000000..5fd06cff --- /dev/null +++ b/src/ca/precomp.h @@ -0,0 +1,18 @@ +#pragma once +// 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. + + +#include +#include +#include +#include + +#include "wcautil.h" +#include "fileutil.h" +#include "strutil.h" +#include "memutil.h" +#include "regutil.h" +#include "dictutil.h" +#include "deputil.h" + +#include "CustomMsiErrors.h" diff --git a/src/ca/wixdepca.cpp b/src/ca/wixdepca.cpp new file mode 100644 index 00000000..154b73f2 --- /dev/null +++ b/src/ca/wixdepca.cpp @@ -0,0 +1,516 @@ +// 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. + +#include "precomp.h" + +#define IDNOACTION 0 +#define INITIAL_STRINGDICT_SIZE 4 + +LPCWSTR vcsDependencyProviderQuery = + L"SELECT `WixDependencyProvider`.`WixDependencyProvider`, `WixDependencyProvider`.`Component_`, `WixDependencyProvider`.`ProviderKey`, `WixDependencyProvider`.`Attributes` " + L"FROM `WixDependencyProvider`"; +enum eDependencyProviderQuery { dpqId = 1, dpqComponent, dpqProviderKey, dpqAttributes }; + +LPCWSTR vcsDependencyQuery = + L"SELECT `WixDependency`.`WixDependency`, `WixDependencyProvider`.`Component_`, `WixDependency`.`ProviderKey`, `WixDependency`.`MinVersion`, `WixDependency`.`MaxVersion`, `WixDependency`.`Attributes` " + L"FROM `WixDependencyProvider`, `WixDependency`, `WixDependencyRef` " + L"WHERE `WixDependency`.`WixDependency` = `WixDependencyRef`.`WixDependency_` AND `WixDependencyProvider`.`WixDependencyProvider` = `WixDependencyRef`.`WixDependencyProvider_`"; +enum eDependencyComponentQuery { dqId = 1, dqComponent, dqProviderKey, dqMinVersion, dqMaxVersion, dqAttributes }; + +static HRESULT EnsureRequiredDependencies( + __in MSIHANDLE hInstall, + __in BOOL fMachineContext + ); + +static HRESULT EnsureAbsentDependents( + __in MSIHANDLE hInstall, + __in BOOL fMachineContext + ); + +static HRESULT SplitIgnoredDependents( + __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents + ); + +static HRESULT CreateDependencyRecord( + __in int iMessageId, + __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, + __in UINT cDependencies, + __out MSIHANDLE *phRecord + ); + +static LPCWSTR LogDependencyName( + __in_z LPCWSTR wzName + ); + +/*************************************************************************** + WixDependencyRequire - Checks that all required dependencies are installed. + +***************************************************************************/ +extern "C" UINT __stdcall WixDependencyRequire( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + BOOL fMachineContext = FALSE; + + hr = WcaInitialize(hInstall, "WixDependencyRequire"); + ExitOnFailure(hr, "Failed to initialize."); + + hr = RegInitialize(); + ExitOnFailure(hr, "Failed to initialize the registry functions."); + + // Determine whether we're installing per-user or per-machine. + fMachineContext = WcaIsPropertySet("ALLUSERS"); + + // Check for any provider components being (re)installed that their requirements are already installed. + hr = EnsureRequiredDependencies(hInstall, fMachineContext); + ExitOnFailure(hr, "Failed to ensure required dependencies for (re)installing components."); + +LExit: + RegUninitialize(); + + er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; + return WcaFinalize(er); +} + +/*************************************************************************** + WixDependencyCheck - Check dependencies based on component state. + + Note: may return ERROR_NO_MORE_ITEMS to terminate the session early. +***************************************************************************/ +extern "C" UINT __stdcall WixDependencyCheck( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + BOOL fMachineContext = FALSE; + + hr = WcaInitialize(hInstall, "WixDependencyCheck"); + ExitOnFailure(hr, "Failed to initialize."); + + hr = RegInitialize(); + ExitOnFailure(hr, "Failed to initialize the registry functions."); + + // Determine whether we're installing per-user or per-machine. + fMachineContext = WcaIsPropertySet("ALLUSERS"); + + // Check for any dependents of provider components being uninstalled. + hr = EnsureAbsentDependents(hInstall, fMachineContext); + ExitOnFailure(hr, "Failed to ensure absent dependents for uninstalling components."); + +LExit: + RegUninitialize(); + + er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; + return WcaFinalize(er); +} + +/*************************************************************************** + EnsureRequiredDependencies - Check that dependencies are installed for + any provider component that is being installed or reinstalled. + + Note: Skipped if DISABLEDEPENDENCYCHECK is set. +***************************************************************************/ +static HRESULT EnsureRequiredDependencies( + __in MSIHANDLE /*hInstall*/, + __in BOOL fMachineContext + ) +{ + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + STRINGDICT_HANDLE sdDependencies = NULL; + HKEY hkHive = NULL; + PMSIHANDLE hView = NULL; + PMSIHANDLE hRec = NULL; + LPWSTR sczId = NULL; + LPWSTR sczComponent = NULL; + LPWSTR sczProviderKey = NULL; + LPWSTR sczMinVersion = NULL; + LPWSTR sczMaxVersion = NULL; + int iAttributes = 0; + WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; + DEPENDENCY* rgDependencies = NULL; + UINT cDependencies = 0; + PMSIHANDLE hDependencyRec = NULL; + + // Skip the dependency check if the WixDependency table is missing (no dependencies to check for). + hr = WcaTableExists(L"WixDependency"); + if (S_FALSE == hr) + { + WcaLog(LOGMSG_STANDARD, "Skipping the dependency check since no dependencies are authored."); + ExitFunction1(hr = S_OK); + } + + // If the table exists but not the others, the database was not authored correctly. + ExitOnFailure(hr, "Failed to check if the WixDependency table exists."); + + // Initialize the dictionary to keep track of unique dependency keys. + hr = DictCreateStringList(&sdDependencies, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); + ExitOnFailure(hr, "Failed to initialize the unique dependency string list."); + + // Set the registry hive to use depending on install context. + hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + + // Loop over the provider components. + hr = WcaOpenExecuteView(vcsDependencyQuery, &hView); + ExitOnFailure(hr, "Failed to open the query view for dependencies."); + + while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) + { + hr = WcaGetRecordString(hRec, dqId, &sczId); + ExitOnFailure(hr, "Failed to get WixDependency.WixDependency."); + + hr = WcaGetRecordString(hRec, dqComponent, &sczComponent); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component_."); + + // Skip the current component if its not being installed or reinstalled. + tComponentAction = WcaGetComponentToDo(sczComponent); + if (WCA_TODO_INSTALL != tComponentAction && WCA_TODO_REINSTALL != tComponentAction) + { + WcaLog(LOGMSG_STANDARD, "Skipping dependency check for %ls because the component %ls is not being (re)installed.", sczId, sczComponent); + continue; + } + + hr = WcaGetRecordString(hRec, dqProviderKey, &sczProviderKey); + ExitOnFailure(hr, "Failed to get WixDependency.ProviderKey."); + + hr = WcaGetRecordString(hRec, dqMinVersion, &sczMinVersion); + ExitOnFailure(hr, "Failed to get WixDependency.MinVersion."); + + hr = WcaGetRecordString(hRec, dqMaxVersion, &sczMaxVersion); + ExitOnFailure(hr, "Failed to get WixDependency.MaxVersion."); + + hr = WcaGetRecordInteger(hRec, dqAttributes, &iAttributes); + ExitOnFailure(hr, "Failed to get WixDependency.Attributes."); + + // Check the registry to see if the required providers (dependencies) exist. + hr = DepCheckDependency(hkHive, sczProviderKey, sczMinVersion, sczMaxVersion, iAttributes, sdDependencies, &rgDependencies, &cDependencies); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed dependency check for %ls.", sczId); + } + } + + if (E_NOMOREITEMS != hr) + { + ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency query view."); + } + else + { + hr = S_OK; + } + + // If we collected any dependencies in the previous check, pump a message and prompt the user. + if (0 < cDependencies) + { + hr = CreateDependencyRecord(msierrDependencyMissingDependencies, rgDependencies, cDependencies, &hDependencyRec); + ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyMissingDependencies); + + // Send a yes/no message with a warning icon since continuing could be detrimental. + // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding + // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); + switch (er) + { + // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. + case IDYES: + ExitFunction1(hr = S_OK); + + // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. + case IDNO: + WcaSetReturnValue(ERROR_INSTALL_USEREXIT); + ExitFunction1(hr = S_OK); + + // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. + case IDCANCEL: + __fallthrough; + + // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. + case IDOK: + __fallthrough; + + // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. + case IDNOACTION: + WcaSetReturnValue(ERROR_INSTALL_FAILURE); + ExitFunction1(hr = S_OK); + + default: + ExitOnFailure(hr = E_UNEXPECTED, "Unexpected message response %d from user or bootstrapper application.", er); + } + } + +LExit: + ReleaseDependencyArray(rgDependencies, cDependencies); + ReleaseStr(sczId); + ReleaseStr(sczComponent); + ReleaseStr(sczProviderKey); + ReleaseStr(sczMinVersion); + ReleaseStr(sczMaxVersion); + ReleaseDict(sdDependencies); + + return hr; +} + +/*************************************************************************** + EnsureAbsentDependents - Checks that there are no dependents + registered for providers that are being uninstalled. + + Note: Skipped if UPGRADINGPRODUCTCODE is set. +***************************************************************************/ +static HRESULT EnsureAbsentDependents( + __in MSIHANDLE /*hInstall*/, + __in BOOL fMachineContext + ) +{ + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + STRINGDICT_HANDLE sdIgnoredDependents = NULL; + HKEY hkHive = NULL; + PMSIHANDLE hView = NULL; + PMSIHANDLE hRec = NULL; + LPWSTR sczId = NULL; + LPWSTR sczComponent = NULL; + LPWSTR sczProviderKey = NULL; + int iAttributes = 0; + WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; + DEPENDENCY* rgDependents = NULL; + UINT cDependents = 0; + PMSIHANDLE hDependencyRec = NULL; + + // Split the IGNOREDEPENDENCIES property for use below if set. If it is "ALL", then quit now. + hr = SplitIgnoredDependents(&sdIgnoredDependents); + ExitOnFailure(hr, "Failed to get the ignored dependents."); + + hr = DictKeyExists(sdIgnoredDependents, L"ALL"); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed to check if \"ALL\" was set in IGNOREDEPENDENCIES."); + + // Otherwise... + WcaLog(LOGMSG_STANDARD, "Skipping the dependencies check since IGNOREDEPENDENCIES contains \"ALL\"."); + ExitFunction(); + } + else + { + // Key was not found, so proceed. + hr = S_OK; + } + + // Skip the dependent check if the WixDependencyProvider table is missing (no dependency providers). + hr = WcaTableExists(L"WixDependencyProvider"); + if (S_FALSE == hr) + { + WcaLog(LOGMSG_STANDARD, "Skipping the dependents check since no dependency providers are authored."); + ExitFunction(); + } + + ExitOnFailure(hr, "Failed to check if the WixDependencyProvider table exists."); + + // Set the registry hive to use depending on install context. + hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + + // Loop over the provider components. + hr = WcaOpenExecuteView(vcsDependencyProviderQuery, &hView); + ExitOnFailure(hr, "Failed to open the query view for dependency providers."); + + while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) + { + hr = WcaGetRecordString(hRec, dpqId, &sczId); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.WixDependencyProvider."); + + hr = WcaGetRecordString(hRec, dpqComponent, &sczComponent); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component."); + + // Skip the current component if its not being uninstalled. + tComponentAction = WcaGetComponentToDo(sczComponent); + if (WCA_TODO_UNINSTALL != tComponentAction) + { + WcaLog(LOGMSG_STANDARD, "Skipping dependents check for %ls because the component %ls is not being uninstalled.", sczId, sczComponent); + continue; + } + + hr = WcaGetRecordString(hRec, dpqProviderKey, &sczProviderKey); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.ProviderKey."); + + hr = WcaGetRecordInteger(hRec, dpqAttributes, &iAttributes); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Attributes."); + + // Check the registry to see if the provider has any dependents registered. + hr = DepCheckDependents(hkHive, sczProviderKey, iAttributes, sdIgnoredDependents, &rgDependents, &cDependents); + ExitOnFailure(hr, "Failed dependents check for %ls.", sczId); + } + + if (E_NOMOREITEMS != hr) + { + ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency provider query view."); + } + else + { + hr = S_OK; + } + + // If we collected any providers with dependents in the previous check, pump a message and prompt the user. + if (0 < cDependents) + { + hr = CreateDependencyRecord(msierrDependencyHasDependents, rgDependents, cDependents, &hDependencyRec); + ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyHasDependents); + + // Send a yes/no message with a warning icon since continuing could be detrimental. + // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding + // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); + switch (er) + { + // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. + case IDYES: + ExitFunction1(hr = S_OK); + + // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. + case IDNO: + __fallthrough; + + // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. + case IDOK: + __fallthrough; + + // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. + case IDNOACTION: + WcaSetReturnValue(ERROR_NO_MORE_ITEMS); + ExitFunction1(hr = S_OK); + + // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. + case IDCANCEL: + WcaSetReturnValue(ERROR_INSTALL_FAILURE); + ExitFunction1(hr = S_OK); + + default: + hr = E_UNEXPECTED; + ExitOnFailure(hr, "Unexpected message response %d from user or bootstrapper application.", er); + } + } + +LExit: + ReleaseDependencyArray(rgDependents, cDependents); + ReleaseStr(sczId); + ReleaseStr(sczComponent); + ReleaseStr(sczProviderKey); + + return hr; +} + +/*************************************************************************** + SplitIgnoredDependents - Splits the IGNOREDEPENDENCIES property into a map. + +***************************************************************************/ +static HRESULT SplitIgnoredDependents( + __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents + ) +{ + HRESULT hr = S_OK; + LPWSTR sczIgnoreDependencies = NULL; + LPCWSTR wzDelim = L";"; + LPWSTR wzContext = NULL; + + hr = WcaGetProperty(L"IGNOREDEPENDENCIES", &sczIgnoreDependencies); + ExitOnFailure(hr, "Failed to get the string value of the IGNOREDEPENDENCIES property."); + + hr = DictCreateStringList(psdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); + ExitOnFailure(hr, "Failed to create the string dictionary."); + + // Parse through the semicolon-delimited tokens and add to the string dictionary. + for (LPCWSTR wzToken = ::wcstok_s(sczIgnoreDependencies, wzDelim, &wzContext); wzToken; wzToken = ::wcstok_s(NULL, wzDelim, &wzContext)) + { + hr = DictAddKey(*psdIgnoredDependents, wzToken); + ExitOnFailure(hr, "Failed to ignored dependency \"%ls\" to the string dictionary.", wzToken); + } + +LExit: + ReleaseStr(sczIgnoreDependencies); + + return hr; +} + +/*************************************************************************** + CreateDependencyRecord - Creates a record containing the message template + and records to send to the UI handler. + + Notes: Callers should call WcaProcessMessage and handle return codes. +***************************************************************************/ +static HRESULT CreateDependencyRecord( + __in int iMessageId, + __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, + __in UINT cDependencies, + __out MSIHANDLE *phRecord + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + UINT cParams = 0; + UINT iParam = 0; + + // Should not be PMSIHANDLE. + MSIHANDLE hRec = NULL; + + // Calculate the number of parameters based on the format: + // msgId, count, key1, name1, key2, name2, etc. + cParams = 2 + 2 * cDependencies; + + hRec = ::MsiCreateRecord(cParams); + ExitOnNull(hRec, hr, E_OUTOFMEMORY, "Not enough memory to create the message record."); + + er = ::MsiRecordSetInteger(hRec, ++iParam, iMessageId); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the message identifier into the message record."); + + er = ::MsiRecordSetInteger(hRec, ++iParam, cDependencies); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the number of dependencies into the message record."); + + // Now loop through each dependency and add the key and name to the record. + for (UINT i = 0; i < cDependencies; i++) + { + const DEPENDENCY* pDependency = &rgDependencies[i]; + + // Log message type-specific information. + switch (iMessageId) + { + // Send a user message when installing a component that is missing some dependencies. + case msierrDependencyMissingDependencies: + WcaLog(LOGMSG_VERBOSE, "The dependency \"%ls\" is missing or is not the required version.", pDependency->sczKey); + break; + + // Send a user message when uninstalling a component that still has registered dependents. + case msierrDependencyHasDependents: + WcaLog(LOGMSG_VERBOSE, "Found dependent \"%ls\", name: \"%ls\".", pDependency->sczKey, LogDependencyName(pDependency->sczName)); + break; + } + + er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczKey); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency key \"%ls\" into the message record.", pDependency->sczKey); + + er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczName); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency name \"%ls\" into the message record.", pDependency->sczName); + } + + // Only assign the out parameter if successful to this point. + *phRecord = hRec; + hRec = NULL; + +LExit: + if (hRec) + { + ::MsiCloseHandle(hRec); + } + + return hr; +} + +/*************************************************************************** + LogDependencyName - Returns the dependency name or "Unknown" if null. + +***************************************************************************/ +static LPCWSTR LogDependencyName( + __in_z LPCWSTR wzName + ) +{ + return wzName ? wzName : L"Unknown"; +} diff --git a/src/ca/wixdepca.def b/src/ca/wixdepca.def new file mode 100644 index 00000000..df50e992 --- /dev/null +++ b/src/ca/wixdepca.def @@ -0,0 +1,8 @@ +; 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. + + +LIBRARY "wixdepca" + +EXPORTS + WixDependencyRequire + WixDependencyCheck diff --git a/src/ca/wixdepca.vcxproj b/src/ca/wixdepca.vcxproj new file mode 100644 index 00000000..b757a35f --- /dev/null +++ b/src/ca/wixdepca.vcxproj @@ -0,0 +1,57 @@ + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + + Debug + ARM + + + Release + ARM + + + + + {B86AF46C-0F90-49CC-923F-A800B088D015} + DynamicLibrary + Unicode + WixDepCA + wixdepca.def + + + + + + $(WixRoot)src\libs\dutil\inc;$(WixRoot)src\libs\wcautil;$(WixRoot)src\libs\deputil\inc + msi.lib;dutil.lib;deputil.lib;wcautil.lib + + + + + + + + + + + + + + + + + + diff --git a/src/ca/wixdepca.vcxproj.filters b/src/ca/wixdepca.vcxproj.filters new file mode 100644 index 00000000..1fdb0236 --- /dev/null +++ b/src/ca/wixdepca.vcxproj.filters @@ -0,0 +1,40 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Resource Files + + + + + Source Files + + + \ No newline at end of file diff --git a/src/wixext/Dependency.xsd b/src/wixext/Dependency.xsd new file mode 100644 index 00000000..0c36cb88 --- /dev/null +++ b/src/wixext/Dependency.xsd @@ -0,0 +1,226 @@ + + + + + + + + The source code schema for the WiX Toolset Dependency Extension. + + + + + + Describes the information for this product or feature that serves as a dependency of other products or features. + + + + + + + + + + This element is required for any product, feature, or bundle that will use the Dependency feature to properly reference count + other products or features. It should be authored into a component that is always installed and removed with the + product or features that contain it. This guarantees that product dependencies are not removed before those products that + depend on them. + + + The @Key attribute should identify a version range for your product that you guarantee will be backward compatible. + This key is designed to persist throughout compatible upgrades so that dependent products do not have to be reinstalled + and will not prevent your product from being upgraded. If this attribute is not authored, the value is the ProductCode + and will not automatically support upgrades. + + + By default this uses the Product/@Id attribute value, which may be automatically generated. + + + How To: Author product dependencies + + + + + + + + + + + Dependency provider identity. If this attribute is not specified, an identifier will be generated automatically. + + + + + + + Optional unique registry key name that identifies a product version range on which other products can depend. + This attribute is required in package authoring, but optional for components. + + + + + + + The version of the package. For MSI packages, the ProductVersion will be used by default + and this attribute should not be specified. + + + + + + + Optional display name of the package. For MSI packages, the ProductName will be used by default. + + + + + + + + + Describes a dependency on a provider for the current component or package. + + + + + + + + + This element declares a dependency on any product that uses the Provides element. If that product is uninstalled + before a product that requires it, the uninstall will err or warn the user that other products are installed + which depend on that product. This behavior can be modified by changing the attribute values on the Requires element. + + + If you do not nest this element under a Provides element, you must specify the @Id attribute + so that it can be referenced by a RequiresRef element nested under a Provides element. + + + + How To: Author product dependencies + + + + + + + Dependency requirement identity. If this attribute is not specified, an identifier will be generated automatically. + If this element is not authored under a Provides element, this attribute is required. + + + + + + + The unique registry key name for the dependency provider to require during installation of this product. + + + + + + + The minimum version of the dependency provider required to be installed. The default is unbound. + + + + + + + The maximum version of the dependency provider required to be installed. The default is unbound. + + + + + + + Set to "yes" to make the range of dependency provider versions required include the value specified in Minimum. + + + + + + + Set to "yes" to make the range of dependency provider versions required include the value specified in Maximum. + + + + + + + + + References existing authoring for a dependency on a provider for the current component or package. + + + + + This element references a dependency on any product that uses the Provides element. If that product is uninstalled + before a product that requires it, the uninstall will err or warn the user that other products are installed + which depend on that product. This behavior can be modified by changing the attribute values on the Requires element. + + + + How To: Author product dependencies + + + + + + + The identifier of the Requires element to reference. + + + + + + + + + Optional attribute to explicitly author the provider key for the entire bundle. + + + + + + This provider key is designed to persist throughout compatible upgrades so that dependent bundles do not have to be reinstalled + and will not prevent your product from being upgraded. If this attribute is not authored, the value is the + automatically-generated bundle ID and will not automatically support upgrades. + + + Only a single provider key is supported for bundles. To author that your bundle provides additional features via + packages, author different provider keys for your packages. + + + + + + + + + + Values of this type will look like: "x.x.x.x" where x is an integer from 0 to 65534. + This can also be a preprocessor, binder, or WiX variable. + + + + + + + + + + Values of this type will either be "yes" or "no". + + + + + + + + diff --git a/src/wixext/DependencyBinder.cs b/src/wixext/DependencyBinder.cs new file mode 100644 index 00000000..13fea203 --- /dev/null +++ b/src/wixext/DependencyBinder.cs @@ -0,0 +1,169 @@ +// 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 WixToolset.Extensions +{ + using System; + using System.Collections.ObjectModel; + using System.Globalization; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The compiler for the WiX toolset dependency extension. + /// + public sealed class DependencyBinder : BinderExtension + { + private Output output; + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + public override void Finish(Output output) + { + // Only process MSI packages. + if (OutputType.Product != output.Type) + { + return; + } + + this.output = output; + + Table wixDependencyTable = output.Tables["WixDependency"]; + Table wixDependencyProviderTable = output.Tables["WixDependencyProvider"]; + Table wixDependencyRefTable = output.Tables["WixDependencyRef"]; + + // Make sure there's something to do. + if (null != wixDependencyRefTable) + { + KeyedRowCollection wixDependencyRows = new KeyedRowCollection(wixDependencyTable); + KeyedRowCollection wixDependencyProviderRows = new KeyedRowCollection(wixDependencyProviderTable); + + // For each relationship, get the provides and requires rows to generate registry values. + foreach (Row wixDependencyRefRow in wixDependencyRefTable.Rows) + { + string providesId = (string)wixDependencyRefRow[0]; + string requiresId = (string)wixDependencyRefRow[1]; + + Row wixDependencyRow = null; + if (wixDependencyRows.Contains(requiresId)) + { + wixDependencyRow = wixDependencyRows[requiresId]; + } + + Row wixDependencyProviderRow = null; + if (wixDependencyProviderRows.Contains(providesId)) + { + wixDependencyProviderRow = wixDependencyProviderRows[providesId]; + } + + // If we found both rows, generate the registry values. + if (null != wixDependencyRow && null != wixDependencyProviderRow) + { + // Format the root registry key using the required provider key and the current provider key. + string requiresKey = (string)wixDependencyRow[1]; + string providesKey = (string)wixDependencyProviderRow[2]; + string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); + + // Get the component ID from the provider. + string componentId = (string)wixDependencyProviderRow[1]; + + Row row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "(Default)"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "*"; + row[4] = null; + row[5] = componentId; + + string minVersion = (string)wixDependencyRow[2]; + if (!String.IsNullOrEmpty(minVersion)) + { + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MinVersion"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "MinVersion"; + row[4] = minVersion; + row[5] = componentId; + } + + string maxVersion = (string)wixDependencyRow[3]; + if (!String.IsNullOrEmpty(minVersion)) + { + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MaxVersion"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "MaxVersion"; + row[4] = maxVersion; + row[5] = componentId; + } + + if (null != wixDependencyRow[4]) + { + int attributes = (int)wixDependencyRow[4]; + + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "Attributes"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "Attributes"; + row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); + row[5] = componentId; + } + } + } + } + } + + /// + /// Creates a registry row using source information from the given . + /// + /// The from which the section and source line information are retrieved. + /// A new Registry row. + private Row CreateRegistryRow(Row referenceRow) + { + TableDefinition tableDefinition = this.Core.TableDefinitions["Registry"]; + + // Create the row from the main tables, which were populated during link anyway. + // We still associate the table with the dependency row's section to maintain servicing. + Table table = this.output.EnsureTable(tableDefinition, referenceRow.Table.Section); + Row row = table.CreateRow(referenceRow.SourceLineNumbers); + + // Set the section ID for patching and return the new row. + row.SectionId = referenceRow.SectionId; + return row; + } + + /// + /// A keyed collection of instances for O(1) lookup. + /// + private sealed class KeyedRowCollection : KeyedCollection + { + /// + /// Initializes the class with all rows from the specified . + /// + /// The containing rows to index. + internal KeyedRowCollection(Table table) + { + if (null != table) + { + foreach (Row row in table.Rows) + { + this.Add(row); + } + } + } + + /// + /// Gets the primary key for the . + /// + /// The to index. + /// The primary key for the . + protected override string GetKeyForItem(Row row) + { + return row.GetPrimaryKey('/'); + } + } + } +} diff --git a/src/wixext/DependencyCommon.cs b/src/wixext/DependencyCommon.cs new file mode 100644 index 00000000..4826d8b0 --- /dev/null +++ b/src/wixext/DependencyCommon.cs @@ -0,0 +1,26 @@ +// 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 WixToolset.Extensions +{ + using System; + using WixToolset; + + internal static class DependencyCommon + { + // Bundle attributes are in the upper 32-bits. + internal const int ProvidesAttributesBundle = 0x10000; + + // Same values as for the Upgrade table in Windows Installer. + internal const int RequiresAttributesMinVersionInclusive = 256; + internal const int RequiresAttributesMaxVersionInclusive = 512; + + // The root registry key for the dependency extension. We write to Software\Classes explicitly + // based on the current security context instead of HKCR. See + // http://msdn.microsoft.com/en-us/library/ms724475(VS.85).aspx for more information. + internal static readonly string RegistryRoot = @"Software\Classes\Installer\Dependencies\"; + internal static readonly string RegistryDependents = "Dependents"; + + // The following characters cannot be used in a provider key. + internal static readonly char[] InvalidCharacters = new char[] { ' ', '\"', ';', '\\' }; + } +} diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs new file mode 100644 index 00000000..a138c047 --- /dev/null +++ b/src/wixext/DependencyCompiler.cs @@ -0,0 +1,615 @@ +// 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 WixToolset.Extensions +{ + using System; + using System.Collections.Generic; + using System.Globalization; + using System.Text; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The compiler for the WiX toolset dependency extension. + /// + public sealed class DependencyCompiler : CompilerExtension + { + /// + /// Package type when parsing the Provides element. + /// + private enum PackageType + { + None, + ExePackage, + MsiPackage, + MspPackage, + MsuPackage + } + + public DependencyCompiler() + { + this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/dependency"; + } + + /// + /// Processes an attribute for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of attribute. + /// Attribute to process. + public override void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); + switch (parentElement.Name.LocalName) + { + case "Bundle": + switch (attribute.Name.LocalName) + { + case "ProviderKey": + this.ParseProviderKeyAttribute(sourceLineNumbers, parentElement, attribute); + break; + default: + this.Core.UnexpectedAttribute(parentElement, attribute); + break; + } + break; + default: + this.Core.UnexpectedAttribute(parentElement, attribute); + break; + } + } + + /// + /// Processes an element for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + public override void ParseElement(XElement parentElement, XElement element, IDictionary context) + { + PackageType packageType = PackageType.None; + + switch (parentElement.Name.LocalName) + { + case "Bundle": + case "Fragment": + case "Module": + case "Product": + switch (element.Name.LocalName) + { + case "Requires": + this.ParseRequiresElement(element, null, false); + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + break; + case "ExePackage": + packageType = PackageType.ExePackage; + break; + case "MsiPackage": + packageType = PackageType.MsiPackage; + break; + case "MspPackage": + packageType = PackageType.MspPackage; + break; + case "MsuPackage": + packageType = PackageType.MsuPackage; + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + + if (PackageType.None != packageType) + { + string packageId = context["PackageId"]; + + switch (element.Name.LocalName) + { + case "Provides": + this.ParseProvidesElement(element, packageType, packageId); + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + } + } + + /// + /// Processes a child element of a Component for the Compiler. + /// + /// Parent element of element to process. + /// Element to process. + /// Extra information about the context in which this element is being parsed. + /// The component key path type if set. + public override ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); + ComponentKeyPath keyPath = null; + + switch (parentElement.Name.LocalName) + { + case "Component": + string componentId = context["ComponentId"]; + + // 64-bit components may cause issues downlevel. + bool win64 = false; + Boolean.TryParse(context["Win64"], out win64); + + switch (element.Name.LocalName) + { + case "Provides": + if (win64) + { + this.Core.OnMessage(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); + } + + keyPath = this.ParseProvidesElement(element, PackageType.None, componentId); + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + break; + default: + this.Core.UnexpectedElement(parentElement, element); + break; + } + + return keyPath; + } + + /// + /// Processes the ProviderKey bundle attribute. + /// + /// Source line number for the parent element. + /// Parent element of attribute. + /// The XML attribute for the ProviderKey attribute. + private void ParseProviderKeyAttribute(SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) + { + Identifier id = null; + string providerKey = null; + int illegalChar = -1; + + switch (attribute.Name.LocalName) + { + case "ProviderKey": + providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attribute); + break; + default: + this.Core.UnexpectedAttribute(parentElement, attribute); + break; + } + + // Make sure the key does not contain any illegal characters or values. + if (String.IsNullOrEmpty(providerKey)) + { + this.Core.OnMessage(WixErrors.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); + } + else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) + { + StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); + + this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); + } + else if ("ALL" == providerKey) + { + this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); + } + + // Generate the primary key for the row. + id = this.Core.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); + + if (!this.Core.EncounteredError) + { + // Create the provider row for the bundle. The Component_ field is required + // in the table definition but unused for bundles, so just set it to the valid ID. + Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); + row[1] = id.Id; + row[2] = providerKey; + row[5] = DependencyCommon.ProvidesAttributesBundle; + } + } + + /// + /// Processes the Provides element. + /// + /// The XML node for the Provides element. + /// The type of the package being chained into a bundle, or "None" if building an MSI package. + /// Explicit key path. + /// The identifier of the parent component or package. + /// The type of key path if set. + private ComponentKeyPath ParseProvidesElement(XElement node, PackageType packageType, string parentId) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + ComponentKeyPath keyPath = null; + Identifier id = null; + string key = null; + string version = null; + string displayName = null; + int attributes = 0; + int illegalChar = -1; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + break; + case "Key": + key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Version": + version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + break; + case "DisplayName": + displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + // Make sure the key is valid. The key will default to the ProductCode for MSI packages + // and the package code for MSP packages in the binder if not specified. + if (!String.IsNullOrEmpty(key)) + { + // Make sure the key does not contain any illegal characters or values. + if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters))) + { + StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); + + this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); + } + else if ("ALL" == key) + { + this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); + } + } + else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType) + { + // Must specify the provider key when authored for a package. + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + } + else if (PackageType.None == packageType) + { + // Make sure the ProductCode is authored and set the key. + this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "ProductCode"); + key = "!(bind.property.ProductCode)"; + } + + // The Version attribute should not be authored in or for an MSI package. + if (!String.IsNullOrEmpty(version)) + { + switch (packageType) + { + case PackageType.None: + this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); + break; + case PackageType.MsiPackage: + this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); + break; + } + } + else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType) + { + // Must specify the Version when authored for packages that do not contain a version. + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + } + + // Need the element ID for child element processing, so generate now if not authored. + if (null == id) + { + id = this.Core.CreateIdentifier("dep", node.Name.LocalName, parentId, key); + } + + foreach (XElement child in node.Elements()) + { + if (this.Namespace == child.Name.Namespace) + { + switch (child.Name.LocalName) + { + case "Requires": + this.ParseRequiresElement(child, id.Id, PackageType.None == packageType); + break; + case "RequiresRef": + this.ParseRequiresRefElement(child, id.Id, PackageType.None == packageType); + break; + default: + this.Core.UnexpectedElement(node, child); + break; + } + } + else + { + this.Core.ParseExtensionElement(node, child); + } + } + + if (!this.Core.EncounteredError) + { + // Create the row in the provider table. + Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); + row[1] = parentId; + row[2] = key; + + if (!String.IsNullOrEmpty(version)) + { + row[3] = version; + } + + if (!String.IsNullOrEmpty(displayName)) + { + row[4] = displayName; + } + + if (0 != attributes) + { + row[5] = attributes; + } + + if (PackageType.None == packageType) + { + // Reference the Check custom action to check for dependencies on the current provider. + if (Platform.ARM == this.Core.CurrentPlatform) + { + // Ensure the ARM version of the CA is referenced. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); + } + else + { + // All other supported platforms use x86. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck"); + } + + // Generate registry rows for the provider using binder properties. + string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); + + row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "(Default)")); + row[1] = -1; + row[2] = keyProvides; + row[3] = null; + row[4] = "[ProductCode]"; + row[5] = parentId; + + // Use the Version registry value and use that as a potential key path. + Identifier idVersion = this.Core.CreateIdentifier("reg", id.Id, "Version"); + keyPath = new ComponentKeyPath() { Id = idVersion.Id, Explicit = false, Type = ComponentKeyPathType.Registry }; + + row = this.Core.CreateRow(sourceLineNumbers, "Registry", idVersion); + row[1] = -1; + row[2] = keyProvides; + row[3] = "Version"; + row[4] = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; + row[5] = parentId; + + row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "DisplayName")); + row[1] = -1; + row[2] = keyProvides; + row[3] = "DisplayName"; + row[4] = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; + row[5] = parentId; + + if (0 != attributes) + { + row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "Attributes")); + row[1] = -1; + row[2] = keyProvides; + row[3] = "Attributes"; + row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); + row[5] = parentId; + } + } + } + + return keyPath; + } + + /// + /// Processes the Requires element. + /// + /// The XML node for the Requires element. + /// The parent provider identifier. + /// Whether the Requires custom action should be referenced. + private void ParseRequiresElement(XElement node, string providerId, bool requiresAction) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + Identifier id = null; + string providerKey = null; + string minVersion = null; + string maxVersion = null; + int attributes = 0; + int illegalChar = -1; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + break; + case "ProviderKey": + providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + break; + case "Minimum": + minVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + break; + case "Maximum": + maxVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + break; + case "IncludeMinimum": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= DependencyCommon.RequiresAttributesMinVersionInclusive; + } + break; + case "IncludeMaximum": + if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + { + attributes |= DependencyCommon.RequiresAttributesMaxVersionInclusive; + } + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + this.Core.ParseForExtensionElements(node); + + if (null == id) + { + // Generate an ID only if this element is authored under a Provides element; otherwise, a RequiresRef + // element will be necessary and the Id attribute will be required. + if (!String.IsNullOrEmpty(providerId)) + { + id = this.Core.CreateIdentifier("dep", node.Name.LocalName, providerKey); + } + else + { + this.Core.OnMessage(WixErrors.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); + id = Identifier.Invalid; + } + } + + if (String.IsNullOrEmpty(providerKey)) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); + } + // Make sure the key does not contain any illegal characters. + else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) + { + StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); + + this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); + } + + + if (!this.Core.EncounteredError) + { + // Reference the Require custom action if required. + if (requiresAction) + { + if (Platform.ARM == this.Core.CurrentPlatform) + { + // Ensure the ARM version of the CA is referenced. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); + } + else + { + // All other supported platforms use x86. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); + } + } + + Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependency", id); + row[1] = providerKey; + row[2] = minVersion; + row[3] = maxVersion; + + if (0 != attributes) + { + row[4] = attributes; + } + + // Create the relationship between this WixDependency row and the WixDependencyProvider row. + if (!String.IsNullOrEmpty(providerId)) + { + // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. + row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); + row[0] = providerId; + row[1] = id.Id; + } + } + } + + /// + /// Processes the RequiresRef element. + /// + /// The XML node for the RequiresRef element. + /// The parent provider identifier. + /// Whether the Requires custom action should be referenced. + private void ParseRequiresRefElement(XElement node, string providerId, bool requiresAction) + { + SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + string id = null; + + foreach (XAttribute attrib in node.Attributes()) + { + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) + { + switch (attrib.Name.LocalName) + { + case "Id": + id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + break; + default: + this.Core.UnexpectedAttribute(node, attrib); + break; + } + } + else + { + this.Core.ParseExtensionAttribute(node, attrib); + } + } + + this.Core.ParseForExtensionElements(node); + + if (String.IsNullOrEmpty(id)) + { + this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + } + + if (!this.Core.EncounteredError) + { + // Reference the Require custom action if required. + if (requiresAction) + { + if (Platform.ARM == this.Core.CurrentPlatform) + { + // Ensure the ARM version of the CA is referenced. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); + } + else + { + // All other supported platforms use x86. + this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); + } + } + + // Create a link dependency on the row that contains information we'll need during bind. + this.Core.CreateSimpleReference(sourceLineNumbers, "WixDependency", id); + + // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. + Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); + row[0] = providerId; + row[1] = id; + } + } + } +} diff --git a/src/wixext/DependencyDecompiler.cs b/src/wixext/DependencyDecompiler.cs new file mode 100644 index 00000000..3013cf7c --- /dev/null +++ b/src/wixext/DependencyDecompiler.cs @@ -0,0 +1,345 @@ +// 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 WixToolset.Extensions +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using WixToolset; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensions.Serialize.Dependency; + using Dependency = WixToolset.Extensions.Serialize.Dependency; + using Wix = WixToolset.Data.Serialize; + + /// + /// The decompiler for the WiX toolset dependency extension. + /// + public sealed class DependencyDecompiler : DecompilerExtension + { + private RegistryKeyValueCollection registryValues; + private Dictionary keyCache; + + /// + /// Creates a new instance of the class. + /// + public DependencyDecompiler() + { + this.registryValues = new RegistryKeyValueCollection(); + this.keyCache = new Dictionary(); + + this.TableDefinitions = DependencyExtensionData.GetExtensionTableDefinitions(); + } + + /// + /// Get the extensions library to be removed. + /// + /// Table definitions for library. + /// Library to remove from decompiled output. + public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + public override void DecompileTable(Table table) + { + switch (table.Name) + { + case "WixDependencyProvider": + this.DecompileWixDependencyProviderTable(table); + break; + + case "WixDependency": + this.DecompileWixDependencyTable(table); + break; + + case "WixDependencyRef": + this.DecompileWixDependencyRefTable(table); + break; + + default: + base.DecompileTable(table); + break; + } + } + + /// + /// Finalize decompilation by removing registry values that the compiler writes. + /// + /// The collection of all tables. + public override void Finish(TableIndexedCollection tables) + { + // Remove generated registry rows. + this.FinalizeRegistryTable(tables); + + // Remove extension properties. + this.FinalizeProperties(); + } + + /// + /// Decompiles the WixDependencyProvider table. + /// + /// The table to decompile. + private void DecompileWixDependencyProviderTable(Table table) + { + foreach (Row row in table.Rows) + { + Provides provides = new Provides(); + + provides.Id = (string)row[0]; + provides.Key = (string)row[2]; + + if (null != row[3]) + { + provides.Version = (string)row[3]; + } + + if (null != row[4]) + { + provides.DisplayName = (string)row[4]; + } + + // Nothing to parse for attributes currently. + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); + if (null != component) + { + component.AddChild(provides); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); + } + + // Index the provider to parent the RequiresRef elements. + this.Core.IndexElement(row, provides); + + // Add the provider-specific registry keys to be removed during finalization. + // Only remove specific keys that the compiler writes. + string keyProvides = String.Concat(DependencyCommon.RegistryRoot, provides.Key); + + this.registryValues.Add(keyProvides, null); + this.registryValues.Add(keyProvides, "Version"); + this.registryValues.Add(keyProvides, "DisplayName"); + this.registryValues.Add(keyProvides, "Attributes"); + + // Cache the provider key. + this.keyCache[provides.Id] = provides.Key; + } + } + + /// + /// Decompiles the WixDependency table. + /// + /// The table to decompile. + private void DecompileWixDependencyTable(Table table) + { + foreach (Row row in table.Rows) + { + Requires requires = new Requires(); + + requires.Id = (string)row[0]; + requires.ProviderKey = (string)row[1]; + + if (null != row[2]) + { + requires.Minimum = (string)row[2]; + } + + if (null != row[3]) + { + requires.Maximum = (string)row[3]; + } + + if (null != row[4]) + { + int attributes = (int)row[4]; + + if (0 != (attributes & DependencyCommon.RequiresAttributesMinVersionInclusive)) + { + requires.IncludeMinimum = Dependency.YesNoType.yes; + } + + if (0 != (attributes & DependencyCommon.RequiresAttributesMaxVersionInclusive)) + { + requires.IncludeMaximum = Dependency.YesNoType.yes; + } + } + + this.Core.RootElement.AddChild(requires); + + // Cache the requires key. + this.keyCache[requires.Id] = requires.ProviderKey; + } + } + + /// + /// Decompiles the WixDependencyRef table. + /// + /// The table to decompile. + private void DecompileWixDependencyRefTable(Table table) + { + foreach (Row row in table.Rows) + { + RequiresRef requiresRef = new RequiresRef(); + + requiresRef.Id = (string)row[1]; + + Provides provides = (Provides)this.Core.GetIndexedElement("WixDependencyProvider", (string)row[0]); + if (null != provides) + { + provides.AddChild(requiresRef); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "WixDependencyProvider_", (string)row[0], "WixDependencyProvider")); + } + + // Get the cached keys for the provider and dependency IDs and generate registry rows. + string providesKey = null; + string requiresKey = null; + + if (null != provides && this.keyCache.ContainsKey(provides.Id)) + { + providesKey = this.keyCache[provides.Id]; + } + else + { + this.Core.OnMessage(DependencyWarnings.ProvidesKeyNotFound(row.SourceLineNumbers, provides.Id)); + } + + if (this.keyCache.ContainsKey(requiresRef.Id)) + { + requiresKey = this.keyCache[requiresRef.Id]; + } + else + { + this.Core.OnMessage(DependencyWarnings.RequiresKeyNotFound(row.SourceLineNumbers, requiresRef.Id)); + } + + if (!this.Core.EncounteredError) + { + // Add the dependency-specific registry keys to be removed during finalization. + // Only remove specific keys that the compiler writes. + string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); + + this.registryValues.Add(keyRequires, "*"); + this.registryValues.Add(keyRequires, "MinVersion"); + this.registryValues.Add(keyRequires, "MaxVersion"); + this.registryValues.Add(keyRequires, "Attributes"); + } + } + } + + /// + /// Removes rows from the Registry table that are generated by this extension. + /// + /// The collection of tables. + private void FinalizeRegistryTable(TableIndexedCollection tables) + { + Table registryTable = tables["Registry"]; + if (null != registryTable) + { + foreach (Row registryRow in registryTable.Rows) + { + // Check if the compiler writes this registry value; if so, it should be removed. + if (this.registryValues.Contains(registryRow)) + { + Wix.ISchemaElement elem = this.Core.GetIndexedElement(registryRow); + + // If the registry row was found, remove it from its parent. + if (null != elem && null != elem.ParentElement) + { + Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; + if (null != elemParent) + { + elemParent.RemoveChild(elem); + } + } + } + } + } + } + + /// + /// Removes properties defined by this extension. + /// + /// The collection of tables. + private void FinalizeProperties() + { + string[] properties = new string[] { "DISABLEDEPENDENCYCHECK", "IGNOREDEPENDENCIES" }; + foreach (string property in properties) + { + Wix.Property elem = this.Core.GetIndexedElement("Property", property) as Wix.Property; + if (null != elem) + { + // If a value is defined, log a warning we're removing it. + if (!String.IsNullOrEmpty(elem.Value)) + { + this.Core.OnMessage(DependencyWarnings.PropertyRemoved(elem.Id)); + } + + // If the property row was found, remove it from its parent. + if (null != elem.ParentElement) + { + Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; + if (null != elemParent) + { + elemParent.RemoveChild(elem); + } + } + } + } + } + + /// + /// Provides an O(1) lookup for registry key and value name pairs for use in the decompiler. + /// + private sealed class RegistryKeyValueCollection : KeyedCollection> + { + /// + /// Adds the registry key and value name pair to the collection if it doesn't already exist. + /// + /// The registry key to add. + /// The registry value name to add. + internal void Add(string key, string name) + { + KeyValuePair pair = new KeyValuePair(key, name); + if (!this.Contains(pair)) + { + this.Add(pair); + } + } + + /// + /// Returns whether the collection contains the registry key and value name pair from the . + /// + /// The registry to search for. + /// True if the collection contains the registry key and value name pair from the ; otherwise, false. + internal bool Contains(Row row) + { + if (null == row) + { + return false; + } + + KeyValuePair pair = new KeyValuePair((string)row[2], (string)row[3]); + return this.Contains(pair); + } + + /// + /// Return the hash code of the key and value pair concatenated with a colon as a delimiter. + /// + /// The registry key and value name pair. + /// + protected override int GetKeyForItem(KeyValuePair pair) + { + return String.Concat(pair.Key, ":", pair.Value).GetHashCode(); + } + } + } +} diff --git a/src/wixext/DependencyExtension.csproj b/src/wixext/DependencyExtension.csproj new file mode 100644 index 00000000..050e8662 --- /dev/null +++ b/src/wixext/DependencyExtension.csproj @@ -0,0 +1,50 @@ + + + + + + + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498} + WixDependencyExtension + Library + WixToolset.Extensions + + + + + + + + + + $(RootNamespace).Data.tables.xml + PreserveNewest + + + $(RootNamespace).Data.Messages.resources + + + $(RootNamespace).Xsd.Dependency.xsd + PreserveNewest + + + WixToolset.Data.Serialize + WixToolset.Extensions.Serialize.Dependency + + + Data\Dependency.wixlib + + + + + + + + + + + false + + + + diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs new file mode 100644 index 00000000..da2215ce --- /dev/null +++ b/src/wixext/DependencyExtensionData.cs @@ -0,0 +1,64 @@ +// 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 WixToolset.Extensions +{ + using System; + using System.Reflection; + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The WiX toolset dependency extension. + /// + public sealed class DependencyExtensionData : ExtensionData + { + /// + /// Gets the default culture. + /// + /// The default culture. + public override string DefaultCulture + { + get { return "en-us"; } + } + + /// + /// Gets the optional table definitions for this extension. + /// + /// The optional table definitions for this extension. + public override TableDefinitionCollection TableDefinitions + { + get + { + return DependencyExtensionData.GetExtensionTableDefinitions(); + } + } + + /// + /// Gets the library associated with this extension. + /// + /// The table definitions to use while loading the library. + /// The loaded library. + public override Library GetLibrary(TableDefinitionCollection tableDefinitions) + { + return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Internal mechanism to access the extension's table definitions. + /// + /// Extension's table definitions. + internal static TableDefinitionCollection GetExtensionTableDefinitions() + { + return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); + } + + /// + /// Internal mechanism to access the extension's library. + /// + /// Extension's library. + internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) + { + return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.Dependency.wixlib", tableDefinitions); + } + } +} diff --git a/src/wixext/messages.xml b/src/wixext/messages.xml new file mode 100644 index 00000000..bd6eb602 --- /dev/null +++ b/src/wixext/messages.xml @@ -0,0 +1,60 @@ + + + + + + + + + The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2} + + + + + + + + The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value. + + + + + + + + + + The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring. + + + + + + The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring. + + + + + + The property {0} was authored in the package with a value and will be removed. The property should not be authored. + + + + + + The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default. + + + The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default. + + + + + + The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to "no" to make sure the dependency feature works correctly on all supported operating systems. + + + + + + diff --git a/src/wixext/tables.xml b/src/wixext/tables.xml new file mode 100644 index 00000000..03c9f267 --- /dev/null +++ b/src/wixext/tables.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/DependencyExtension.wixproj b/src/wixlib/DependencyExtension.wixproj new file mode 100644 index 00000000..e52218ed --- /dev/null +++ b/src/wixlib/DependencyExtension.wixproj @@ -0,0 +1,27 @@ + + + + + + + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} + dependency + Library + true + true + 1086 + en-us + + + + + + + + + + + + + + diff --git a/src/wixlib/DependencyExtension.wxs b/src/wixlib/DependencyExtension.wxs new file mode 100644 index 00000000..21f863d2 --- /dev/null +++ b/src/wixlib/DependencyExtension.wxs @@ -0,0 +1,22 @@ + + + + + + + + + + !(loc.msierrDependencyMissingDependencies) + !(loc.msierrDependencyHasDependents) + + + + + + + + + + + diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi new file mode 100644 index 00000000..d06b0055 --- /dev/null +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/DependencyExtension_x86.wxs b/src/wixlib/DependencyExtension_x86.wxs new file mode 100644 index 00000000..715eba02 --- /dev/null +++ b/src/wixlib/DependencyExtension_x86.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/en-us.wxl b/src/wixlib/en-us.wxl new file mode 100644 index 00000000..ce29a153 --- /dev/null +++ b/src/wixlib/en-us.wxl @@ -0,0 +1,8 @@ + + + + + + If you continue with this install, the product may not work properly because [2] or more dependencies are missing. Do you want to continue with this install anyway? + If you continue with this uninstall, [2] or more products may stop working properly. Do you want to continue with this uninstall anyway? + -- cgit v1.2.3-55-g6feb From 6f29d2fc2b3514cc85a7975e974e8e31f39288e2 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 3 Feb 2019 14:43:56 -0600 Subject: Integrate into latest v4. --- .editorconfig | 37 +++ Dependency.wixext.sln | 61 +++++ appveyor.cmd | 13 + appveyor.yml | 42 ++++ nuget.config | 16 ++ src/Cpp.Build.props | 104 ++++++++ src/Directory.Build.props | 28 +++ src/Directory.Build.targets | 48 ++++ src/FindLocalWix.props | 8 + src/ca/custommsierrors.h | 5 + src/ca/dependencyca.vcxproj | 61 +++++ src/ca/dependencyca.vcxproj.filters | 35 +++ src/ca/packages.config | 5 + src/ca/wixdepca.def | 2 +- src/ca/wixdepca.vcxproj | 57 ----- src/ca/wixdepca.vcxproj.filters | 40 ---- .../DependencyExtensionFixture.cs | 32 +++ .../TestData/UsingProvides/Package.en-us.wxl | 11 + .../TestData/UsingProvides/Package.wxs | 22 ++ .../TestData/UsingProvides/PackageComponents.wxs | 12 + .../TestData/UsingProvides/example.txt | 1 + .../WixToolsetTest.Dependency.csproj | 38 +++ src/wixext/DependencyBinder.cs | 169 ------------- src/wixext/DependencyCommon.cs | 2 +- src/wixext/DependencyCompiler.cs | 263 ++++++++++----------- src/wixext/DependencyDecompiler.cs | 4 +- src/wixext/DependencyErrors.cs | 37 +++ src/wixext/DependencyExtension.csproj | 50 ---- src/wixext/DependencyExtensionData.cs | 52 +--- src/wixext/DependencyExtensionFactory.cs | 18 ++ src/wixext/DependencyWarnings.cs | 60 +++++ ...ndencyWindowsInstallerBackendBinderExtension.cs | 181 ++++++++++++++ src/wixext/Tuples/DependencyTupleDefinitions.cs | 47 ++++ src/wixext/Tuples/WixDependencyProviderTuple.cs | 87 +++++++ src/wixext/Tuples/WixDependencyRefTuple.cs | 55 +++++ src/wixext/Tuples/WixDependencyTuple.cs | 79 +++++++ src/wixext/WixToolset.Dependency.wixext.csproj | 33 +++ src/wixext/WixToolset.Dependency.wixext.targets | 11 + src/wixext/messages.xml | 60 ----- src/wixlib/DependencyExtension.wixproj | 27 --- src/wixlib/DependencyExtension_Platform.wxi | 6 +- src/wixlib/caSuffix.wxi | 28 +++ src/wixlib/caerr.wxi | 96 ++++++++ src/wixlib/dependency.wixproj | 43 ++++ src/wixlib/packages.config | 5 + version.json | 11 + 46 files changed, 1517 insertions(+), 585 deletions(-) create mode 100644 .editorconfig create mode 100644 Dependency.wixext.sln create mode 100644 appveyor.cmd create mode 100644 appveyor.yml create mode 100644 nuget.config create mode 100644 src/Cpp.Build.props create mode 100644 src/Directory.Build.props create mode 100644 src/Directory.Build.targets create mode 100644 src/FindLocalWix.props create mode 100644 src/ca/custommsierrors.h create mode 100644 src/ca/dependencyca.vcxproj create mode 100644 src/ca/dependencyca.vcxproj.filters create mode 100644 src/ca/packages.config delete mode 100644 src/ca/wixdepca.vcxproj delete mode 100644 src/ca/wixdepca.vcxproj.filters create mode 100644 src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs create mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl create mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs create mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs create mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt create mode 100644 src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj delete mode 100644 src/wixext/DependencyBinder.cs create mode 100644 src/wixext/DependencyErrors.cs delete mode 100644 src/wixext/DependencyExtension.csproj create mode 100644 src/wixext/DependencyExtensionFactory.cs create mode 100644 src/wixext/DependencyWarnings.cs create mode 100644 src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs create mode 100644 src/wixext/Tuples/DependencyTupleDefinitions.cs create mode 100644 src/wixext/Tuples/WixDependencyProviderTuple.cs create mode 100644 src/wixext/Tuples/WixDependencyRefTuple.cs create mode 100644 src/wixext/Tuples/WixDependencyTuple.cs create mode 100644 src/wixext/WixToolset.Dependency.wixext.csproj create mode 100644 src/wixext/WixToolset.Dependency.wixext.targets delete mode 100644 src/wixext/messages.xml delete mode 100644 src/wixlib/DependencyExtension.wixproj create mode 100644 src/wixlib/caSuffix.wxi create mode 100644 src/wixlib/caerr.wxi create mode 100644 src/wixlib/dependency.wixproj create mode 100644 src/wixlib/packages.config create mode 100644 version.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..1d72e683 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,37 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig +# then update all of the repos. + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{cs,vb}] +dotnet_sort_system_directives_first = true + +[*.cs] +csharp_indent_case_contents = true : error +csharp_indent_switch_labels = true : error +csharp_new_line_before_open_brace = all +csharp_prefer_braces = true : error +csharp_style_expression_bodied_methods = when_on_single_line : suggestion +csharp_style_expression_bodied_constructors = when_on_single_line : suggestion +csharp_style_expression_bodied_operators = when_on_single_line : suggestion +csharp_style_expression_bodied_properties = when_on_single_line : suggestion +csharp_style_expression_bodied_indexers = when_on_single_line : suggestion +csharp_style_expression_bodied_accessors = when_on_single_line : suggestion +csharp_style_var_elsewhere = true : suggestion +csharp_style_var_for_built_in_types = true : suggestion +csharp_style_var_when_type_is_apparent = true : suggestion +dotnet_style_qualification_for_event = true : error +dotnet_style_qualification_for_field = true : error +dotnet_style_qualification_for_method = true : error +dotnet_style_qualification_for_property = true : error + +[*.targets] +indent_size = 2 diff --git a/Dependency.wixext.sln b/Dependency.wixext.sln new file mode 100644 index 00000000..c69a467b --- /dev/null +++ b/Dependency.wixext.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2016 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "dependency", "src\wixlib\dependency.wixproj", "{58ED0EC8-73F8-4EE1-8664-A53486D38EC8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dependency.wixext", "src\wixext\WixToolset.Dependency.wixext.csproj", "{A0B6D3F1-AE5E-423B-BA92-60C9926CA498}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Dependency", "src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj", "{E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.Build.0 = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.ActiveCfg = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.Build.0 = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.ActiveCfg = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.Build.0 = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.ActiveCfg = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.Build.0 = Release|Win32 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.ActiveCfg = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.Build.0 = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.ActiveCfg = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.Build.0 = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.ActiveCfg = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.Build.0 = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.ActiveCfg = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.Build.0 = Release|x86 + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.ActiveCfg = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.Build.0 = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.Build.0 = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.ActiveCfg = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.Build.0 = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.Build.0 = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.Build.0 = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.ActiveCfg = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {77F012B1-8E94-4F85-9450-066C6BD15000} + EndGlobalSection +EndGlobal diff --git a/appveyor.cmd b/appveyor.cmd new file mode 100644 index 00000000..73674296 --- /dev/null +++ b/appveyor.cmd @@ -0,0 +1,13 @@ +@setlocal +@pushd %~dp0 + +nuget restore + +msbuild -p:Configuration=Release -t:Restore + +msbuild -p:Configuration=Release src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj + +msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj + +@popd +@endlocal \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..8d80c6af --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,42 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml +# then update all of the repos. + +branches: + only: + - master + - develop + +image: Visual Studio 2017 + +version: 0.0.0.{build} +configuration: Release + +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_XMLDOC_MODE: skip + +build_script: + - appveyor.cmd + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +skip_branch_with_pr: true +skip_tags: true + +artifacts: +- path: build\Release\**\*.nupkg + name: nuget +- path: build\Release\**\*.msi + name: msi + +notifications: +- provider: Slack + incoming_webhook: + secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..aaee3228 --- /dev/null +++ b/nuget.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props new file mode 100644 index 00000000..0e00132b --- /dev/null +++ b/src/Cpp.Build.props @@ -0,0 +1,104 @@ + + + + + + Win32 + $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ + $(OutputPath)$(Platform)\ + + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + + + + + $(DisableSpecificCompilerWarnings) + Level4 + $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + Use + precomp.h + StdCall + true + false + -YlprecompDefine + /Zc:threadSafeInit- %(AdditionalOptions) + true + + + $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) + $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) + + + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) + + + $(ProjectSubSystem) + $(ProjectModuleDefinitionFile) + $(ResourceOnlyDll) + true + $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) + /IGNORE:4099 %(AdditionalOptions) + + + + + + NoExtensions + + + + + CDecl + + + + + OldStyle + true + true + + + + + Disabled + EnableFastChecks + _DEBUG;DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + + MultiThreadedDebugDll + + + + + MinSpace + NDEBUG;%(PreprocessorDefinitions) + true + true + MultiThreaded + + + true + true + + + + + + MultiThreadedDll + + + + + $(LinkKeyFile) + $(LinkDelaySign) + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props new file mode 100644 index 00000000..a22f4470 --- /dev/null +++ b/src/Directory.Build.props @@ -0,0 +1,28 @@ + + + + + + Debug + false + MSB3246 + + $(MSBuildProjectName) + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) + $(BaseOutputPath)obj\$(ProjectName)\ + $(BaseOutputPath)$(Configuration)\ + + WiX Toolset Team + WiX Toolset + Copyright (c) .NET Foundation and contributors. All rights reserved. + MS-RL + WiX Toolset + + + + + + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..dac7452a --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,48 @@ + + + + + + + true + $(SolutionPath) + $(NCrunchOriginalSolutionPath) + + + + + + + $([System.IO.File]::ReadAllText($(TheSolutionPath))) + $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) + (?<="[PackageName]", ")(.*)(?=", ") + + + + + + %(Identity) + $(SolutionFileContent.Contains('\%(Identity).csproj')) + + + + + $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) + $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) + + + + + + + + + + + diff --git a/src/FindLocalWix.props b/src/FindLocalWix.props new file mode 100644 index 00000000..a784e352 --- /dev/null +++ b/src/FindLocalWix.props @@ -0,0 +1,8 @@ + + + + + + $(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets + + diff --git a/src/ca/custommsierrors.h b/src/ca/custommsierrors.h new file mode 100644 index 00000000..26450452 --- /dev/null +++ b/src/ca/custommsierrors.h @@ -0,0 +1,5 @@ +#pragma once +// 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. + +#define msierrDependencyMissingDependencies 26451 +#define msierrDependencyHasDependents 26452 diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj new file mode 100644 index 00000000..480a1861 --- /dev/null +++ b/src/ca/dependencyca.vcxproj @@ -0,0 +1,61 @@ + + + + + + + + + + Debug + Win32 + + + Release + Win32 + + + + + {B86AF46C-0F90-49CC-923F-A800B088D015} + DynamicLibrary + v141 + Unicode + dependencyca + wixdepca.def + WiX Toolset Dependency CustomAction + + + + + + + msi.lib + + + + + Create + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + diff --git a/src/ca/dependencyca.vcxproj.filters b/src/ca/dependencyca.vcxproj.filters new file mode 100644 index 00000000..d4931f32 --- /dev/null +++ b/src/ca/dependencyca.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/src/ca/packages.config b/src/ca/packages.config new file mode 100644 index 00000000..ab964d2c --- /dev/null +++ b/src/ca/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/ca/wixdepca.def b/src/ca/wixdepca.def index df50e992..651c6373 100644 --- a/src/ca/wixdepca.def +++ b/src/ca/wixdepca.def @@ -1,7 +1,7 @@ ; 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. -LIBRARY "wixdepca" +LIBRARY "dependencyca" EXPORTS WixDependencyRequire diff --git a/src/ca/wixdepca.vcxproj b/src/ca/wixdepca.vcxproj deleted file mode 100644 index b757a35f..00000000 --- a/src/ca/wixdepca.vcxproj +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - Debug - Win32 - - - Release - Win32 - - - - - Debug - ARM - - - Release - ARM - - - - - {B86AF46C-0F90-49CC-923F-A800B088D015} - DynamicLibrary - Unicode - WixDepCA - wixdepca.def - - - - - - $(WixRoot)src\libs\dutil\inc;$(WixRoot)src\libs\wcautil;$(WixRoot)src\libs\deputil\inc - msi.lib;dutil.lib;deputil.lib;wcautil.lib - - - - - - - - - - - - - - - - - - diff --git a/src/ca/wixdepca.vcxproj.filters b/src/ca/wixdepca.vcxproj.filters deleted file mode 100644 index 1fdb0236..00000000 --- a/src/ca/wixdepca.vcxproj.filters +++ /dev/null @@ -1,40 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Resource Files - - - - - Source Files - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs new file mode 100644 index 00000000..07d6228e --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -0,0 +1,32 @@ +// 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.Dependency +{ + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Dependency; + using Xunit; + + public class DependencyExtensionFixture + { + [Fact] + public void CanBuildUsingProvides() + { + var folder = TestData.Get(@"TestData\UsingProvides"); + var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); + + var results = build.BuildAndQuery(Build, "WixDependencyProvider"); + Assert.Equal(new[] + { + "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t0", + }, results.OrderBy(s => s).ToArray()); + } + + private static void Build(string[] args) + { + var result = WixRunner.Execute(args) + .AssertSuccess(); + } + } +} diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs new file mode 100644 index 00000000..68ff98fd --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs new file mode 100644 index 00000000..e241fb17 --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt new file mode 100644 index 00000000..1b4ffe8a --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt @@ -0,0 +1 @@ +This is example.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj new file mode 100644 index 00000000..342325df --- /dev/null +++ b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj @@ -0,0 +1,38 @@ + + + + + + netcoreapp2.1 + false + + + + NU1701 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixext/DependencyBinder.cs b/src/wixext/DependencyBinder.cs deleted file mode 100644 index 13fea203..00000000 --- a/src/wixext/DependencyBinder.cs +++ /dev/null @@ -1,169 +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 WixToolset.Extensions -{ - using System; - using System.Collections.ObjectModel; - using System.Globalization; - using WixToolset.Data; - using WixToolset.Extensibility; - - /// - /// The compiler for the WiX toolset dependency extension. - /// - public sealed class DependencyBinder : BinderExtension - { - private Output output; - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - public override void Finish(Output output) - { - // Only process MSI packages. - if (OutputType.Product != output.Type) - { - return; - } - - this.output = output; - - Table wixDependencyTable = output.Tables["WixDependency"]; - Table wixDependencyProviderTable = output.Tables["WixDependencyProvider"]; - Table wixDependencyRefTable = output.Tables["WixDependencyRef"]; - - // Make sure there's something to do. - if (null != wixDependencyRefTable) - { - KeyedRowCollection wixDependencyRows = new KeyedRowCollection(wixDependencyTable); - KeyedRowCollection wixDependencyProviderRows = new KeyedRowCollection(wixDependencyProviderTable); - - // For each relationship, get the provides and requires rows to generate registry values. - foreach (Row wixDependencyRefRow in wixDependencyRefTable.Rows) - { - string providesId = (string)wixDependencyRefRow[0]; - string requiresId = (string)wixDependencyRefRow[1]; - - Row wixDependencyRow = null; - if (wixDependencyRows.Contains(requiresId)) - { - wixDependencyRow = wixDependencyRows[requiresId]; - } - - Row wixDependencyProviderRow = null; - if (wixDependencyProviderRows.Contains(providesId)) - { - wixDependencyProviderRow = wixDependencyProviderRows[providesId]; - } - - // If we found both rows, generate the registry values. - if (null != wixDependencyRow && null != wixDependencyProviderRow) - { - // Format the root registry key using the required provider key and the current provider key. - string requiresKey = (string)wixDependencyRow[1]; - string providesKey = (string)wixDependencyProviderRow[2]; - string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); - - // Get the component ID from the provider. - string componentId = (string)wixDependencyProviderRow[1]; - - Row row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "(Default)"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "*"; - row[4] = null; - row[5] = componentId; - - string minVersion = (string)wixDependencyRow[2]; - if (!String.IsNullOrEmpty(minVersion)) - { - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MinVersion"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "MinVersion"; - row[4] = minVersion; - row[5] = componentId; - } - - string maxVersion = (string)wixDependencyRow[3]; - if (!String.IsNullOrEmpty(minVersion)) - { - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MaxVersion"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "MaxVersion"; - row[4] = maxVersion; - row[5] = componentId; - } - - if (null != wixDependencyRow[4]) - { - int attributes = (int)wixDependencyRow[4]; - - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "Attributes"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "Attributes"; - row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); - row[5] = componentId; - } - } - } - } - } - - /// - /// Creates a registry row using source information from the given . - /// - /// The from which the section and source line information are retrieved. - /// A new Registry row. - private Row CreateRegistryRow(Row referenceRow) - { - TableDefinition tableDefinition = this.Core.TableDefinitions["Registry"]; - - // Create the row from the main tables, which were populated during link anyway. - // We still associate the table with the dependency row's section to maintain servicing. - Table table = this.output.EnsureTable(tableDefinition, referenceRow.Table.Section); - Row row = table.CreateRow(referenceRow.SourceLineNumbers); - - // Set the section ID for patching and return the new row. - row.SectionId = referenceRow.SectionId; - return row; - } - - /// - /// A keyed collection of instances for O(1) lookup. - /// - private sealed class KeyedRowCollection : KeyedCollection - { - /// - /// Initializes the class with all rows from the specified . - /// - /// The containing rows to index. - internal KeyedRowCollection(Table table) - { - if (null != table) - { - foreach (Row row in table.Rows) - { - this.Add(row); - } - } - } - - /// - /// Gets the primary key for the . - /// - /// The to index. - /// The primary key for the . - protected override string GetKeyForItem(Row row) - { - return row.GetPrimaryKey('/'); - } - } - } -} diff --git a/src/wixext/DependencyCommon.cs b/src/wixext/DependencyCommon.cs index 4826d8b0..cb36be36 100644 --- a/src/wixext/DependencyCommon.cs +++ b/src/wixext/DependencyCommon.cs @@ -1,6 +1,6 @@ // 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 WixToolset.Extensions +namespace WixToolset.Dependency { using System; using WixToolset; diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index a138c047..f866b589 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -1,6 +1,6 @@ // 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 WixToolset.Extensions +namespace WixToolset.Dependency { using System; using System.Collections.Generic; @@ -9,11 +9,12 @@ namespace WixToolset.Extensions using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; /// - /// The compiler for the WiX toolset dependency extension. + /// The compiler for the WiX Toolset Dependency Extension. /// - public sealed class DependencyCompiler : CompilerExtension + public sealed class DependencyCompiler : BaseCompilerExtension { /// /// Package type when parsing the Provides element. @@ -27,10 +28,7 @@ namespace WixToolset.Extensions MsuPackage } - public DependencyCompiler() - { - this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/dependency"; - } + public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/dependency"; /// /// Processes an attribute for the Compiler. @@ -38,24 +36,24 @@ namespace WixToolset.Extensions /// Source line number for the parent element. /// Parent element of attribute. /// Attribute to process. - public override void ParseAttribute(XElement parentElement, XAttribute attribute, IDictionary context) + public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) { - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); + SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); switch (parentElement.Name.LocalName) { case "Bundle": switch (attribute.Name.LocalName) { case "ProviderKey": - this.ParseProviderKeyAttribute(sourceLineNumbers, parentElement, attribute); + this.ParseProviderKeyAttribute(section, sourceLineNumbers, parentElement, attribute); break; default: - this.Core.UnexpectedAttribute(parentElement, attribute); + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); break; } break; default: - this.Core.UnexpectedAttribute(parentElement, attribute); + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); break; } } @@ -67,7 +65,7 @@ namespace WixToolset.Extensions /// Parent element of element to process. /// Element to process. /// Extra information about the context in which this element is being parsed. - public override void ParseElement(XElement parentElement, XElement element, IDictionary context) + public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { PackageType packageType = PackageType.None; @@ -80,10 +78,10 @@ namespace WixToolset.Extensions switch (element.Name.LocalName) { case "Requires": - this.ParseRequiresElement(element, null, false); + this.ParseRequiresElement(intermediate, section, element, null, false); break; default: - this.Core.UnexpectedElement(parentElement, element); + this.ParseHelper.UnexpectedElement(parentElement, element); break; } break; @@ -100,7 +98,7 @@ namespace WixToolset.Extensions packageType = PackageType.MsuPackage; break; default: - this.Core.UnexpectedElement(parentElement, element); + this.ParseHelper.UnexpectedElement(parentElement, element); break; } @@ -111,10 +109,10 @@ namespace WixToolset.Extensions switch (element.Name.LocalName) { case "Provides": - this.ParseProvidesElement(element, packageType, packageId); + this.ParseProvidesElement(intermediate, section, element, packageType, packageId); break; default: - this.Core.UnexpectedElement(parentElement, element); + this.ParseHelper.UnexpectedElement(parentElement, element); break; } } @@ -127,9 +125,9 @@ namespace WixToolset.Extensions /// Element to process. /// Extra information about the context in which this element is being parsed. /// The component key path type if set. - public override ComponentKeyPath ParsePossibleKeyPathElement(XElement parentElement, XElement element, IDictionary context) + public override ComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(parentElement); + SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); ComponentKeyPath keyPath = null; switch (parentElement.Name.LocalName) @@ -146,18 +144,18 @@ namespace WixToolset.Extensions case "Provides": if (win64) { - this.Core.OnMessage(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); + this.Messaging.Write(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); } - keyPath = this.ParseProvidesElement(element, PackageType.None, componentId); + keyPath = this.ParseProvidesElement(intermediate, section, element, PackageType.None, componentId); break; default: - this.Core.UnexpectedElement(parentElement, element); + this.ParseHelper.UnexpectedElement(parentElement, element); break; } break; default: - this.Core.UnexpectedElement(parentElement, element); + this.ParseHelper.UnexpectedElement(parentElement, element); break; } @@ -170,7 +168,7 @@ namespace WixToolset.Extensions /// Source line number for the parent element. /// Parent element of attribute. /// The XML attribute for the ProviderKey attribute. - private void ParseProviderKeyAttribute(SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) + private void ParseProviderKeyAttribute(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) { Identifier id = null; string providerKey = null; @@ -179,41 +177,41 @@ namespace WixToolset.Extensions switch (attribute.Name.LocalName) { case "ProviderKey": - providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attribute); + providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); break; default: - this.Core.UnexpectedAttribute(parentElement, attribute); + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); break; } // Make sure the key does not contain any illegal characters or values. if (String.IsNullOrEmpty(providerKey)) { - this.Core.OnMessage(WixErrors.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); + this.Messaging.Write(ErrorMessages.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); } else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) { StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); + this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); } else if ("ALL" == providerKey) { - this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); + this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); } // Generate the primary key for the row. - id = this.Core.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); + id = this.ParseHelper.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); - if (!this.Core.EncounteredError) + if (!this.Messaging.EncounteredError) { // Create the provider row for the bundle. The Component_ field is required // in the table definition but unused for bundles, so just set it to the valid ID. - Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); - row[1] = id.Id; - row[2] = providerKey; - row[5] = DependencyCommon.ProvidesAttributesBundle; + var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); + row.Set(1, id.Id); + row.Set(2, providerKey); + row.Set(5, DependencyCommon.ProvidesAttributesBundle); } } @@ -225,9 +223,9 @@ namespace WixToolset.Extensions /// Explicit key path. /// The identifier of the parent component or package. /// The type of key path if set. - private ComponentKeyPath ParseProvidesElement(XElement node, PackageType packageType, string parentId) + private ComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) { - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); ComponentKeyPath keyPath = null; Identifier id = null; string key = null; @@ -243,25 +241,25 @@ namespace WixToolset.Extensions switch (attrib.Name.LocalName) { case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "Key": - key = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + key = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); break; case "Version": - version = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + version = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "DisplayName": - displayName = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + displayName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); break; default: - this.Core.UnexpectedAttribute(node, attrib); + this.ParseHelper.UnexpectedAttribute(node, attrib); break; } } else { - this.Core.ParseExtensionAttribute(node, attrib); + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); } } @@ -275,22 +273,22 @@ namespace WixToolset.Extensions StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); + this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); } else if ("ALL" == key) { - this.Core.OnMessage(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); + this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); } } else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType) { // Must specify the provider key when authored for a package. - this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); } else if (PackageType.None == packageType) { // Make sure the ProductCode is authored and set the key. - this.Core.CreateSimpleReference(sourceLineNumbers, "Property", "ProductCode"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Property", "ProductCode"); key = "!(bind.property.ProductCode)"; } @@ -300,23 +298,23 @@ namespace WixToolset.Extensions switch (packageType) { case PackageType.None: - this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); + this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); break; case PackageType.MsiPackage: - this.Core.OnMessage(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); + this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); break; } } else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType) { // Must specify the Version when authored for packages that do not contain a version. - this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); } // Need the element ID for child element processing, so generate now if not authored. if (null == id) { - id = this.Core.CreateIdentifier("dep", node.Name.LocalName, parentId, key); + id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, parentId, key); } foreach (XElement child in node.Elements()) @@ -326,94 +324,93 @@ namespace WixToolset.Extensions switch (child.Name.LocalName) { case "Requires": - this.ParseRequiresElement(child, id.Id, PackageType.None == packageType); + this.ParseRequiresElement(intermediate, section, child, id.Id, PackageType.None == packageType); break; case "RequiresRef": - this.ParseRequiresRefElement(child, id.Id, PackageType.None == packageType); + this.ParseRequiresRefElement(intermediate, section, child, id.Id, PackageType.None == packageType); break; default: - this.Core.UnexpectedElement(node, child); + this.ParseHelper.UnexpectedElement(node, child); break; } } else { - this.Core.ParseExtensionElement(node, child); + this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, node, child); } } - if (!this.Core.EncounteredError) + if (!this.Messaging.EncounteredError) { // Create the row in the provider table. - Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyProvider", id); - row[1] = parentId; - row[2] = key; + var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); + row.Set(1, parentId); + row.Set(2, key); if (!String.IsNullOrEmpty(version)) { - row[3] = version; + row.Set(3, version); } if (!String.IsNullOrEmpty(displayName)) { - row[4] = displayName; + row.Set(4, displayName); } if (0 != attributes) { - row[5] = attributes; + row.Set(5, attributes); } if (PackageType.None == packageType) { // Reference the Check custom action to check for dependencies on the current provider. - if (Platform.ARM == this.Core.CurrentPlatform) + if (Platform.ARM == this.Context.Platform) { // Ensure the ARM version of the CA is referenced. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); } else { // All other supported platforms use x86. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyCheck"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck"); } // Generate registry rows for the provider using binder properties. string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); - row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "(Default)")); - row[1] = -1; - row[2] = keyProvides; - row[3] = null; - row[4] = "[ProductCode]"; - row[5] = parentId; + row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "(Default)")); + row.Set(1, -1); + row.Set(2, keyProvides); + row.Set(4, "[ProductCode]"); + row.Set(5, parentId); // Use the Version registry value and use that as a potential key path. - Identifier idVersion = this.Core.CreateIdentifier("reg", id.Id, "Version"); + Identifier idVersion = this.ParseHelper.CreateIdentifier("reg", id.Id, "Version"); keyPath = new ComponentKeyPath() { Id = idVersion.Id, Explicit = false, Type = ComponentKeyPathType.Registry }; - row = this.Core.CreateRow(sourceLineNumbers, "Registry", idVersion); - row[1] = -1; - row[2] = keyProvides; - row[3] = "Version"; - row[4] = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; - row[5] = parentId; + row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", idVersion); + row.Set(1, -1); + row.Set(2, keyProvides); + row.Set(3, "Version"); + row.Set(4, !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"); + row.Set(5, parentId); - row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "DisplayName")); - row[1] = -1; - row[2] = keyProvides; - row[3] = "DisplayName"; - row[4] = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; - row[5] = parentId; + row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "DisplayName")); + row.Set(1, -1); + row.Set(2, keyProvides); + row.Set(3, "DisplayName"); + row.Set(4, !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"); + row.Set(5, parentId); if (0 != attributes) { - row = this.Core.CreateRow(sourceLineNumbers, "Registry", this.Core.CreateIdentifier("reg", id.Id, "Attributes")); - row[1] = -1; - row[2] = keyProvides; - row[3] = "Attributes"; - row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); - row[5] = parentId; + row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "Attributes")); + row.Set(1, -1); + row.Set(2, keyProvides); + row.Set(3, "Attributes"); + row.Set(4, String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat))); + row.Set(5, parentId); } } } @@ -427,9 +424,9 @@ namespace WixToolset.Extensions /// The XML node for the Requires element. /// The parent provider identifier. /// Whether the Requires custom action should be referenced. - private void ParseRequiresElement(XElement node, string providerId, bool requiresAction) + private void ParseRequiresElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) { - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); Identifier id = null; string providerKey = null; string minVersion = null; @@ -444,41 +441,41 @@ namespace WixToolset.Extensions switch (attrib.Name.LocalName) { case "Id": - id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib); + id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); break; case "ProviderKey": - providerKey = this.Core.GetAttributeValue(sourceLineNumbers, attrib); + providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); break; case "Minimum": - minVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + minVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "Maximum": - maxVersion = this.Core.GetAttributeVersionValue(sourceLineNumbers, attrib); + maxVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); break; case "IncludeMinimum": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= DependencyCommon.RequiresAttributesMinVersionInclusive; } break; case "IncludeMaximum": - if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib)) + if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) { attributes |= DependencyCommon.RequiresAttributesMaxVersionInclusive; } break; default: - this.Core.UnexpectedAttribute(node, attrib); + this.ParseHelper.UnexpectedAttribute(node, attrib); break; } } else { - this.Core.ParseExtensionAttribute(node, attrib); + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); } } - this.Core.ParseForExtensionElements(node); + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); if (null == id) { @@ -486,18 +483,18 @@ namespace WixToolset.Extensions // element will be necessary and the Id attribute will be required. if (!String.IsNullOrEmpty(providerId)) { - id = this.Core.CreateIdentifier("dep", node.Name.LocalName, providerKey); + id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, providerKey); } else { - this.Core.OnMessage(WixErrors.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); + this.Messaging.Write(ErrorMessages.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); id = Identifier.Invalid; } } if (String.IsNullOrEmpty(providerKey)) { - this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); } // Make sure the key does not contain any illegal characters. else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) @@ -505,44 +502,44 @@ namespace WixToolset.Extensions StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - this.Core.OnMessage(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); + this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); } - if (!this.Core.EncounteredError) + if (!this.Messaging.EncounteredError) { // Reference the Require custom action if required. if (requiresAction) { - if (Platform.ARM == this.Core.CurrentPlatform) + if (Platform.ARM == this.Context.Platform) { // Ensure the ARM version of the CA is referenced. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); } else { // All other supported platforms use x86. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); } } - Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependency", id); - row[1] = providerKey; - row[2] = minVersion; - row[3] = maxVersion; + var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependency", id); + row.Set(1, providerKey); + row.Set(2, minVersion); + row.Set(3, maxVersion); if (0 != attributes) { - row[4] = attributes; + row.Set(4, attributes); } // Create the relationship between this WixDependency row and the WixDependencyProvider row. if (!String.IsNullOrEmpty(providerId)) { // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); - row[0] = providerId; - row[1] = id.Id; + row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); + row.Set(0, providerId); + row.Set(1, id.Id); } } } @@ -553,9 +550,9 @@ namespace WixToolset.Extensions /// The XML node for the RequiresRef element. /// The parent provider identifier. /// Whether the Requires custom action should be referenced. - private void ParseRequiresRefElement(XElement node, string providerId, bool requiresAction) + private void ParseRequiresRefElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) { - SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); + SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); string id = null; foreach (XAttribute attrib in node.Attributes()) @@ -565,50 +562,50 @@ namespace WixToolset.Extensions switch (attrib.Name.LocalName) { case "Id": - id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib); + id = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); break; default: - this.Core.UnexpectedAttribute(node, attrib); + this.ParseHelper.UnexpectedAttribute(node, attrib); break; } } else { - this.Core.ParseExtensionAttribute(node, attrib); + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); } } - this.Core.ParseForExtensionElements(node); + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); if (String.IsNullOrEmpty(id)) { - this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); } - if (!this.Core.EncounteredError) + if (!this.Messaging.EncounteredError) { // Reference the Require custom action if required. if (requiresAction) { - if (Platform.ARM == this.Core.CurrentPlatform) + if (Platform.ARM == this.Context.Platform) { // Ensure the ARM version of the CA is referenced. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); } else { // All other supported platforms use x86. - this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "WixDependencyRequire"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); } } // Create a link dependency on the row that contains information we'll need during bind. - this.Core.CreateSimpleReference(sourceLineNumbers, "WixDependency", id); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixDependency", id); // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - Row row = this.Core.CreateRow(sourceLineNumbers, "WixDependencyRef"); - row[0] = providerId; - row[1] = id; + var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); + row.Set(0, providerId); + row.Set(1, id); } } } diff --git a/src/wixext/DependencyDecompiler.cs b/src/wixext/DependencyDecompiler.cs index 3013cf7c..31de3097 100644 --- a/src/wixext/DependencyDecompiler.cs +++ b/src/wixext/DependencyDecompiler.cs @@ -1,7 +1,8 @@ // 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 WixToolset.Extensions +namespace WixToolset.Dependency { +#if TODO_CONSIDER_DECOMPILER using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -342,4 +343,5 @@ namespace WixToolset.Extensions } } } +#endif } diff --git a/src/wixext/DependencyErrors.cs b/src/wixext/DependencyErrors.cs new file mode 100644 index 00000000..83c0986a --- /dev/null +++ b/src/wixext/DependencyErrors.cs @@ -0,0 +1,37 @@ +// 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 WixToolset.Dependency +{ + using System; + using System.Resources; + using WixToolset.Data; + + public static class DependencyErrors + { + public static Message IllegalCharactersInProvider(SourceLineNumber sourceLineNumbers, string attributeName, Char illegalChar, string illegalChars) + { + return Message(sourceLineNumbers, Ids.IllegalCharactersInProvider, "The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2}", attributeName, illegalChar, illegalChars); + } + + public static Message ReservedValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string attributeValue) + { + return Message(sourceLineNumbers, Ids.ReservedValue, "The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value.", elementName, attributeName, attributeValue); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); + } + + public enum Ids + { + IllegalCharactersInProvider = 5400, + ReservedValue = 5401, + } + } +} diff --git a/src/wixext/DependencyExtension.csproj b/src/wixext/DependencyExtension.csproj deleted file mode 100644 index 050e8662..00000000 --- a/src/wixext/DependencyExtension.csproj +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498} - WixDependencyExtension - Library - WixToolset.Extensions - - - - - - - - - - $(RootNamespace).Data.tables.xml - PreserveNewest - - - $(RootNamespace).Data.Messages.resources - - - $(RootNamespace).Xsd.Dependency.xsd - PreserveNewest - - - WixToolset.Data.Serialize - WixToolset.Extensions.Serialize.Dependency - - - Data\Dependency.wixlib - - - - - - - - - - - false - - - - diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs index da2215ce..e92aeff1 100644 --- a/src/wixext/DependencyExtensionData.cs +++ b/src/wixext/DependencyExtensionData.cs @@ -1,64 +1,30 @@ // 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 WixToolset.Extensions +namespace WixToolset.Dependency { - using System; - using System.Reflection; using WixToolset.Data; using WixToolset.Extensibility; /// - /// The WiX toolset dependency extension. + /// The WiX Toolset Dependency Extension. /// - public sealed class DependencyExtensionData : ExtensionData + public sealed class DependencyExtensionData : BaseExtensionData { /// /// Gets the default culture. /// /// The default culture. - public override string DefaultCulture - { - get { return "en-us"; } - } - - /// - /// Gets the optional table definitions for this extension. - /// - /// The optional table definitions for this extension. - public override TableDefinitionCollection TableDefinitions - { - get - { - return DependencyExtensionData.GetExtensionTableDefinitions(); - } - } - - /// - /// Gets the library associated with this extension. - /// - /// The table definitions to use while loading the library. - /// The loaded library. - public override Library GetLibrary(TableDefinitionCollection tableDefinitions) - { - return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); - } + public override string DefaultCulture => "en-US"; - /// - /// Internal mechanism to access the extension's table definitions. - /// - /// Extension's table definitions. - internal static TableDefinitionCollection GetExtensionTableDefinitions() + public override bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) { - return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml"); + tupleDefinition = DependencyTupleDefinitions.ByName(name); + return tupleDefinition != null; } - /// - /// Internal mechanism to access the extension's library. - /// - /// Extension's library. - internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions) + public override Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) { - return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.Dependency.wixlib", tableDefinitions); + return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", tupleDefinitions); } } } diff --git a/src/wixext/DependencyExtensionFactory.cs b/src/wixext/DependencyExtensionFactory.cs new file mode 100644 index 00000000..c5b89658 --- /dev/null +++ b/src/wixext/DependencyExtensionFactory.cs @@ -0,0 +1,18 @@ +// 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 WixToolset.Dependency +{ + using System; + using System.Collections.Generic; + using WixToolset.Extensibility; + + public class DependencyExtensionFactory : BaseExtensionFactory + { + protected override IEnumerable ExtensionTypes => new[] + { + typeof(DependencyCompiler), + typeof(DependencyExtensionData), + typeof(DependencyWindowsInstallerBackendBinderExtension), + }; + } +} diff --git a/src/wixext/DependencyWarnings.cs b/src/wixext/DependencyWarnings.cs new file mode 100644 index 00000000..802edc22 --- /dev/null +++ b/src/wixext/DependencyWarnings.cs @@ -0,0 +1,60 @@ +// 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 WixToolset.Dependency +{ + using System; + using System.Resources; + using WixToolset.Data; + + public static class DependencyWarnings + { + public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers) + { + return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default."); + } + + public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers, string id) + { + return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default.", id); + } + + public static Message PropertyRemoved(string name) + { + return Message(null, Ids.PropertyRemoved, "The property {0} was authored in the package with a value and will be removed. The property should not be authored.", name); + } + + public static Message ProvidesKeyNotFound(SourceLineNumber sourceLineNumbers, string id) + { + return Message(sourceLineNumbers, Ids.ProvidesKeyNotFound, "The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring.", id); + } + + public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id) + { + return Message(sourceLineNumbers, Ids.RequiresKeyNotFound, "The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring.", id); + } + + public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) + { + return Message(sourceLineNumbers, Ids.Win64Component, "The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to \"no\" to make sure the dependency feature works correctly on all supported operating systems.", componentId); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); + } + + private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) + { + return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); + } + + public enum Ids + { + ProvidesKeyNotFound = 5431, + RequiresKeyNotFound = 5432, + PropertyRemoved = 5433, + DiscouragedVersionAttribute = 5434, + Win64Component = 5435, + } + } +} diff --git a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs new file mode 100644 index 00000000..485453a1 --- /dev/null +++ b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs @@ -0,0 +1,181 @@ +// 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 WixToolset.Dependency +{ + using System.Linq; + using System.Xml; + using WixToolset.Data.WindowsInstaller; + using WixToolset.Extensibility; + + public class DependencyWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension + { + private static readonly TableDefinition[] Tables = LoadTables(); + + protected override TableDefinition[] TableDefinitionsForTuples => Tables; + + private static TableDefinition[] LoadTables() + { + using (var resourceStream = typeof(DependencyWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Dependency.tables.xml")) + using (var reader = XmlReader.Create(resourceStream)) + { + var tables = TableDefinitionCollection.Load(reader); + return tables.ToArray(); + } + } + +#if TODO_TAG_BINDER_EXTENSION + private Output output; + + /// + /// Called after all output changes occur and right before the output is bound into its final format. + /// + public void Finish(Output output) + { + // Only process MSI packages. + if (OutputType.Product != output.Type) + { + return; + } + + this.output = output; + + Table wixDependencyTable = output.Tables["WixDependency"]; + Table wixDependencyProviderTable = output.Tables["WixDependencyProvider"]; + Table wixDependencyRefTable = output.Tables["WixDependencyRef"]; + + // Make sure there's something to do. + if (null != wixDependencyRefTable) + { + KeyedRowCollection wixDependencyRows = new KeyedRowCollection(wixDependencyTable); + KeyedRowCollection wixDependencyProviderRows = new KeyedRowCollection(wixDependencyProviderTable); + + // For each relationship, get the provides and requires rows to generate registry values. + foreach (Row wixDependencyRefRow in wixDependencyRefTable.Rows) + { + string providesId = (string)wixDependencyRefRow[0]; + string requiresId = (string)wixDependencyRefRow[1]; + + Row wixDependencyRow = null; + if (wixDependencyRows.Contains(requiresId)) + { + wixDependencyRow = wixDependencyRows[requiresId]; + } + + Row wixDependencyProviderRow = null; + if (wixDependencyProviderRows.Contains(providesId)) + { + wixDependencyProviderRow = wixDependencyProviderRows[providesId]; + } + + // If we found both rows, generate the registry values. + if (null != wixDependencyRow && null != wixDependencyProviderRow) + { + // Format the root registry key using the required provider key and the current provider key. + string requiresKey = (string)wixDependencyRow[1]; + string providesKey = (string)wixDependencyProviderRow[2]; + string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); + + // Get the component ID from the provider. + string componentId = (string)wixDependencyProviderRow[1]; + + Row row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "(Default)"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "*"; + row[4] = null; + row[5] = componentId; + + string minVersion = (string)wixDependencyRow[2]; + if (!String.IsNullOrEmpty(minVersion)) + { + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MinVersion"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "MinVersion"; + row[4] = minVersion; + row[5] = componentId; + } + + string maxVersion = (string)wixDependencyRow[3]; + if (!String.IsNullOrEmpty(minVersion)) + { + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MaxVersion"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "MaxVersion"; + row[4] = maxVersion; + row[5] = componentId; + } + + if (null != wixDependencyRow[4]) + { + int attributes = (int)wixDependencyRow[4]; + + row = this.CreateRegistryRow(wixDependencyRow); + row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "Attributes"); + row[1] = -1; + row[2] = keyRequires; + row[3] = "Attributes"; + row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); + row[5] = componentId; + } + } + } + } + } + + /// + /// Creates a registry row using source information from the given . + /// + /// The from which the section and source line information are retrieved. + /// A new Registry row. + private Row CreateRegistryRow(Row referenceRow) + { + TableDefinition tableDefinition = this.Core.TableDefinitions["Registry"]; + + // Create the row from the main tables, which were populated during link anyway. + // We still associate the table with the dependency row's section to maintain servicing. + Table table = this.output.EnsureTable(tableDefinition, referenceRow.Table.Section); + Row row = table.CreateRow(referenceRow.SourceLineNumbers); + + // Set the section ID for patching and return the new row. + row.SectionId = referenceRow.SectionId; + return row; + } + + /// + /// A keyed collection of instances for O(1) lookup. + /// + private sealed class KeyedRowCollection : KeyedCollection + { + /// + /// Initializes the class with all rows from the specified . + /// + /// The containing rows to index. + internal KeyedRowCollection(Table table) + { + if (null != table) + { + foreach (Row row in table.Rows) + { + this.Add(row); + } + } + } + + /// + /// Gets the primary key for the . + /// + /// The to index. + /// The primary key for the . + protected override string GetKeyForItem(Row row) + { + return row.GetPrimaryKey('/'); + } + } +#endif + } +} diff --git a/src/wixext/Tuples/DependencyTupleDefinitions.cs b/src/wixext/Tuples/DependencyTupleDefinitions.cs new file mode 100644 index 00000000..fdd3f0b5 --- /dev/null +++ b/src/wixext/Tuples/DependencyTupleDefinitions.cs @@ -0,0 +1,47 @@ +// 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 WixToolset.Dependency +{ + using System; + using WixToolset.Data; + + public enum DependencyTupleDefinitionType + { + WixDependency, + WixDependencyProvider, + WixDependencyRef, + } + + public static partial class DependencyTupleDefinitions + { + public static readonly Version Version = new Version("4.0.0"); + + public static IntermediateTupleDefinition ByName(string name) + { + if (!Enum.TryParse(name, out DependencyTupleDefinitionType type)) + { + return null; + } + + return ByType(type); + } + + public static IntermediateTupleDefinition ByType(DependencyTupleDefinitionType type) + { + switch (type) + { + case DependencyTupleDefinitionType.WixDependency: + return DependencyTupleDefinitions.WixDependency; + + case DependencyTupleDefinitionType.WixDependencyProvider: + return DependencyTupleDefinitions.WixDependencyProvider; + + case DependencyTupleDefinitionType.WixDependencyRef: + return DependencyTupleDefinitions.WixDependencyRef; + + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + } + } +} diff --git a/src/wixext/Tuples/WixDependencyProviderTuple.cs b/src/wixext/Tuples/WixDependencyProviderTuple.cs new file mode 100644 index 00000000..2fd6a805 --- /dev/null +++ b/src/wixext/Tuples/WixDependencyProviderTuple.cs @@ -0,0 +1,87 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Dependency.Tuples; + + public static partial class DependencyTupleDefinitions + { + public static readonly IntermediateTupleDefinition WixDependencyProvider = new IntermediateTupleDefinition( + DependencyTupleDefinitionType.WixDependencyProvider.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.WixDependencyProvider), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Component_), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.ProviderKey), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Version), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.DisplayName), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Attributes), IntermediateFieldType.Number), + }, + typeof(WixDependencyProviderTuple)); + } +} + +namespace WixToolset.Dependency.Tuples +{ + using WixToolset.Data; + + public enum WixDependencyProviderTupleFields + { + WixDependencyProvider, + Component_, + ProviderKey, + Version, + DisplayName, + Attributes, + } + + public class WixDependencyProviderTuple : IntermediateTuple + { + public WixDependencyProviderTuple() : base(DependencyTupleDefinitions.WixDependencyProvider, null, null) + { + } + + public WixDependencyProviderTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyProvider, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDependencyProviderTupleFields index] => this.Fields[(int)index]; + + public string WixDependencyProvider + { + get => this.Fields[(int)WixDependencyProviderTupleFields.WixDependencyProvider].AsString(); + set => this.Set((int)WixDependencyProviderTupleFields.WixDependencyProvider, value); + } + + public string Component_ + { + get => this.Fields[(int)WixDependencyProviderTupleFields.Component_].AsString(); + set => this.Set((int)WixDependencyProviderTupleFields.Component_, value); + } + + public string ProviderKey + { + get => this.Fields[(int)WixDependencyProviderTupleFields.ProviderKey].AsString(); + set => this.Set((int)WixDependencyProviderTupleFields.ProviderKey, value); + } + + public string Version + { + get => this.Fields[(int)WixDependencyProviderTupleFields.Version].AsString(); + set => this.Set((int)WixDependencyProviderTupleFields.Version, value); + } + + public string DisplayName + { + get => this.Fields[(int)WixDependencyProviderTupleFields.DisplayName].AsString(); + set => this.Set((int)WixDependencyProviderTupleFields.DisplayName, value); + } + + public int Attributes + { + get => this.Fields[(int)WixDependencyProviderTupleFields.Attributes].AsNumber(); + set => this.Set((int)WixDependencyProviderTupleFields.Attributes, value); + } + } +} \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyRefTuple.cs b/src/wixext/Tuples/WixDependencyRefTuple.cs new file mode 100644 index 00000000..3e996f5f --- /dev/null +++ b/src/wixext/Tuples/WixDependencyRefTuple.cs @@ -0,0 +1,55 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Dependency.Tuples; + + public static partial class DependencyTupleDefinitions + { + public static readonly IntermediateTupleDefinition WixDependencyRef = new IntermediateTupleDefinition( + DependencyTupleDefinitionType.WixDependencyRef.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProvider_), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependency_), IntermediateFieldType.String), + }, + typeof(WixDependencyRefTuple)); + } +} + +namespace WixToolset.Dependency.Tuples +{ + using WixToolset.Data; + + public enum WixDependencyRefTupleFields + { + WixDependencyProvider_, + WixDependency_, + } + + public class WixDependencyRefTuple : IntermediateTuple + { + public WixDependencyRefTuple() : base(DependencyTupleDefinitions.WixDependencyRef, null, null) + { + } + + public WixDependencyRefTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyRef, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDependencyRefTupleFields index] => this.Fields[(int)index]; + + public string WixDependencyProvider_ + { + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProvider_].AsString(); + set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProvider_, value); + } + + public string WixDependency_ + { + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependency_].AsString(); + set => this.Set((int)WixDependencyRefTupleFields.WixDependency_, value); + } + } +} \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyTuple.cs b/src/wixext/Tuples/WixDependencyTuple.cs new file mode 100644 index 00000000..81e05ad1 --- /dev/null +++ b/src/wixext/Tuples/WixDependencyTuple.cs @@ -0,0 +1,79 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Dependency.Tuples; + + public static partial class DependencyTupleDefinitions + { + public static readonly IntermediateTupleDefinition WixDependency = new IntermediateTupleDefinition( + DependencyTupleDefinitionType.WixDependency.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.WixDependency), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.ProviderKey), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MinVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MaxVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.Attributes), IntermediateFieldType.Number), + }, + typeof(WixDependencyTuple)); + } +} + +namespace WixToolset.Dependency.Tuples +{ + using WixToolset.Data; + + public enum WixDependencyTupleFields + { + WixDependency, + ProviderKey, + MinVersion, + MaxVersion, + Attributes, + } + + public class WixDependencyTuple : IntermediateTuple + { + public WixDependencyTuple() : base(DependencyTupleDefinitions.WixDependency, null, null) + { + } + + public WixDependencyTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependency, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDependencyTupleFields index] => this.Fields[(int)index]; + + public string WixDependency + { + get => this.Fields[(int)WixDependencyTupleFields.WixDependency].AsString(); + set => this.Set((int)WixDependencyTupleFields.WixDependency, value); + } + + public string ProviderKey + { + get => this.Fields[(int)WixDependencyTupleFields.ProviderKey].AsString(); + set => this.Set((int)WixDependencyTupleFields.ProviderKey, value); + } + + public string MinVersion + { + get => this.Fields[(int)WixDependencyTupleFields.MinVersion].AsString(); + set => this.Set((int)WixDependencyTupleFields.MinVersion, value); + } + + public string MaxVersion + { + get => this.Fields[(int)WixDependencyTupleFields.MaxVersion].AsString(); + set => this.Set((int)WixDependencyTupleFields.MaxVersion, value); + } + + public int Attributes + { + get => this.Fields[(int)WixDependencyTupleFields.Attributes].AsNumber(); + set => this.Set((int)WixDependencyTupleFields.Attributes, value); + } + } +} \ No newline at end of file diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj new file mode 100644 index 00000000..7e9f1e3a --- /dev/null +++ b/src/wixext/WixToolset.Dependency.wixext.csproj @@ -0,0 +1,33 @@ + + + + + + netstandard2.0 + WixToolset.Dependency + WiX Toolset Dependency Extension + WiX Toolset Dependency Extension + true + build + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixext/WixToolset.Dependency.wixext.targets b/src/wixext/WixToolset.Dependency.wixext.targets new file mode 100644 index 00000000..494c0184 --- /dev/null +++ b/src/wixext/WixToolset.Dependency.wixext.targets @@ -0,0 +1,11 @@ + + + + + + $(MSBuildThisFileDirectory)..\tools\WixToolset.Depedency.wixext.dll + + + + + diff --git a/src/wixext/messages.xml b/src/wixext/messages.xml deleted file mode 100644 index bd6eb602..00000000 --- a/src/wixext/messages.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2} - - - - - - - - The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value. - - - - - - - - - - The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring. - - - - - - The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring. - - - - - - The property {0} was authored in the package with a value and will be removed. The property should not be authored. - - - - - - The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default. - - - The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default. - - - - - - The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to "no" to make sure the dependency feature works correctly on all supported operating systems. - - - - - - diff --git a/src/wixlib/DependencyExtension.wixproj b/src/wixlib/DependencyExtension.wixproj deleted file mode 100644 index e52218ed..00000000 --- a/src/wixlib/DependencyExtension.wixproj +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} - dependency - Library - true - true - 1086 - en-us - - - - - - - - - - - - - - diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi index d06b0055..7cd7ad96 100644 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -21,6 +21,6 @@ - + diff --git a/src/wixlib/caSuffix.wxi b/src/wixlib/caSuffix.wxi new file mode 100644 index 00000000..a56a2393 --- /dev/null +++ b/src/wixlib/caSuffix.wxi @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/caerr.wxi b/src/wixlib/caerr.wxi new file mode 100644 index 00000000..141942f2 --- /dev/null +++ b/src/wixlib/caerr.wxi @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj new file mode 100644 index 00000000..6fa70e3d --- /dev/null +++ b/src/wixlib/dependency.wixproj @@ -0,0 +1,43 @@ + + + + + + + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} + dependency + Library + true + true + 1086 + en-us + + + + + + + + + + + + + dependencyca + {B86AF46C-0F90-49CC-923F-A800B088D015} + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config new file mode 100644 index 00000000..f3d424e1 --- /dev/null +++ b/src/wixlib/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 00000000..5f857771 --- /dev/null +++ b/version.json @@ -0,0 +1,11 @@ +{ + "version": "4.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} -- cgit v1.2.3-55-g6feb From f5cdcb877d3a419edb5a291620724a4c9ef7c919 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 4 Feb 2019 21:45:52 -0600 Subject: Fix nuget targets file. --- src/wixext/WixToolset.Dependency.wixext.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wixext/WixToolset.Dependency.wixext.targets b/src/wixext/WixToolset.Dependency.wixext.targets index 494c0184..2b298736 100644 --- a/src/wixext/WixToolset.Dependency.wixext.targets +++ b/src/wixext/WixToolset.Dependency.wixext.targets @@ -3,9 +3,9 @@ - $(MSBuildThisFileDirectory)..\tools\WixToolset.Depedency.wixext.dll + $(MSBuildThisFileDirectory)..\tools\WixToolset.Dependency.wixext.dll - + -- cgit v1.2.3-55-g6feb From 40d38600f3c63dd3e97f3cba85f21454582a0e0f Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 8 Apr 2020 13:05:55 +1000 Subject: Update dependencies. --- appveyor.yml | 2 +- src/Cpp.Build.props | 2 +- src/FindLocalWix.props | 2 +- src/ca/dependencyca.vcxproj | 8 ++++---- src/ca/packages.config | 4 ++-- .../WixToolsetTest.Dependency.csproj | 15 +++++++++------ src/wixext/DependencyCompiler.cs | 13 ++++++++----- .../DependencyWindowsInstallerBackendBinderExtension.cs | 3 ++- src/wixlib/dependency.wixproj | 4 ++-- src/wixlib/packages.config | 2 +- 10 files changed, 31 insertions(+), 24 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8d80c6af..522e5af3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ branches: - master - develop -image: Visual Studio 2017 +image: Visual Studio 2019 version: 0.0.0.{build} configuration: Release diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props index 0e00132b..44a042c7 100644 --- a/src/Cpp.Build.props +++ b/src/Cpp.Build.props @@ -8,7 +8,7 @@ $(OutputPath)$(Platform)\ - + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) diff --git a/src/FindLocalWix.props b/src/FindLocalWix.props index a784e352..1666e4fe 100644 --- a/src/FindLocalWix.props +++ b/src/FindLocalWix.props @@ -3,6 +3,6 @@ - $(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets + $(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 480a1861..c8072f71 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -2,8 +2,8 @@ - - + + @@ -55,7 +55,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + diff --git a/src/ca/packages.config b/src/ca/packages.config index ab964d2c..4e9403bf 100644 --- a/src/ca/packages.config +++ b/src/ca/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj index 342325df..7bedc47d 100644 --- a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj +++ b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj @@ -1,9 +1,9 @@ - + - netcoreapp2.1 + netcoreapp3.1 false @@ -23,7 +23,10 @@ - + + + + @@ -31,8 +34,8 @@ - - - + + + diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index f866b589..dafcfb3e 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -125,10 +125,10 @@ namespace WixToolset.Dependency /// Element to process. /// Extra information about the context in which this element is being parsed. /// The component key path type if set. - public override ComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) + public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); - ComponentKeyPath keyPath = null; + IComponentKeyPath keyPath = null; switch (parentElement.Name.LocalName) { @@ -223,10 +223,10 @@ namespace WixToolset.Dependency /// Explicit key path. /// The identifier of the parent component or package. /// The type of key path if set. - private ComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) + private IComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) { SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); - ComponentKeyPath keyPath = null; + IComponentKeyPath keyPath = null; Identifier id = null; string key = null; string version = null; @@ -387,7 +387,10 @@ namespace WixToolset.Dependency // Use the Version registry value and use that as a potential key path. Identifier idVersion = this.ParseHelper.CreateIdentifier("reg", id.Id, "Version"); - keyPath = new ComponentKeyPath() { Id = idVersion.Id, Explicit = false, Type = ComponentKeyPathType.Registry }; + keyPath = this.CreateComponentKeyPath(); + keyPath.Id = idVersion.Id; + keyPath.Explicit = false; + keyPath.Type = PossibleKeyPathType.Registry; row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", idVersion); row.Set(1, -1); diff --git a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs index 485453a1..265fdd4f 100644 --- a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs +++ b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs @@ -2,6 +2,7 @@ namespace WixToolset.Dependency { + using System.Collections.Generic; using System.Linq; using System.Xml; using WixToolset.Data.WindowsInstaller; @@ -11,7 +12,7 @@ namespace WixToolset.Dependency { private static readonly TableDefinition[] Tables = LoadTables(); - protected override TableDefinition[] TableDefinitionsForTuples => Tables; + public override IEnumerable TableDefinitions => Tables; private static TableDefinition[] LoadTables() { diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index 6fa70e3d..72be9c16 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -1,7 +1,7 @@ - + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} @@ -37,7 +37,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config index f3d424e1..e1b601f6 100644 --- a/src/wixlib/packages.config +++ b/src/wixlib/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file -- cgit v1.2.3-55-g6feb From 9524fee3de3853748ceaef4606dd045edcaffb7d Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 8 Apr 2020 13:52:36 +1000 Subject: Modernize DependencyCompiler and tuples. --- .../DependencyExtensionFixture.cs | 4 +- src/wixext/DependencyCompiler.cs | 182 +++++++++------------ src/wixext/DependencyTableDefinitions.cs | 57 +++++++ ...ndencyWindowsInstallerBackendBinderExtension.cs | 18 +- src/wixext/Tuples/DependencyTupleDefinitions.cs | 4 - src/wixext/Tuples/WixDependencyProviderTuple.cs | 87 ---------- src/wixext/Tuples/WixDependencyRefTuple.cs | 20 +-- src/wixext/Tuples/WixDependencyTuple.cs | 8 - src/wixext/WixToolset.Dependency.wixext.csproj | 1 - src/wixext/tables.xml | 38 ----- 10 files changed, 151 insertions(+), 268 deletions(-) create mode 100644 src/wixext/DependencyTableDefinitions.cs delete mode 100644 src/wixext/Tuples/WixDependencyProviderTuple.cs delete mode 100644 src/wixext/tables.xml diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 07d6228e..823532ee 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -19,8 +19,8 @@ namespace WixToolsetTest.Dependency var results = build.BuildAndQuery(Build, "WixDependencyProvider"); Assert.Equal(new[] { - "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t0", - }, results.OrderBy(s => s).ToArray()); + "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", + }, results); } private static void Build(string[] args) diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index dafcfb3e..4ec6f477 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -8,6 +8,8 @@ namespace WixToolset.Dependency using System.Text; using System.Xml.Linq; using WixToolset.Data; + using WixToolset.Data.Tuples; + using WixToolset.Dependency.Tuples; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; @@ -38,7 +40,7 @@ namespace WixToolset.Dependency /// Attribute to process. public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) { - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); switch (parentElement.Name.LocalName) { case "Bundle": @@ -67,7 +69,7 @@ namespace WixToolset.Dependency /// Extra information about the context in which this element is being parsed. public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { - PackageType packageType = PackageType.None; + var packageType = PackageType.None; switch (parentElement.Name.LocalName) { @@ -104,7 +106,7 @@ namespace WixToolset.Dependency if (PackageType.None != packageType) { - string packageId = context["PackageId"]; + var packageId = context["PackageId"]; switch (element.Name.LocalName) { @@ -127,17 +129,16 @@ namespace WixToolset.Dependency /// The component key path type if set. public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) { - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); IComponentKeyPath keyPath = null; switch (parentElement.Name.LocalName) { case "Component": - string componentId = context["ComponentId"]; + var componentId = context["ComponentId"]; // 64-bit components may cause issues downlevel. - bool win64 = false; - Boolean.TryParse(context["Win64"], out win64); + Boolean.TryParse(context["Win64"], out var win64); switch (element.Name.LocalName) { @@ -191,7 +192,7 @@ namespace WixToolset.Dependency } else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) { - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); @@ -206,12 +207,14 @@ namespace WixToolset.Dependency if (!this.Messaging.EncounteredError) { - // Create the provider row for the bundle. The Component_ field is required + // Create the provider tuple for the bundle. The Component_ field is required // in the table definition but unused for bundles, so just set it to the valid ID. - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); - row.Set(1, id.Id); - row.Set(2, providerKey); - row.Set(5, DependencyCommon.ProvidesAttributesBundle); + section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id) + { + ComponentRef = id.Id, + ProviderKey = providerKey, + Attributes = WixDependencyProviderAttributes.ProvidesAttributesBundle, + }); } } @@ -225,16 +228,15 @@ namespace WixToolset.Dependency /// The type of key path if set. private IComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) { - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); IComponentKeyPath keyPath = null; Identifier id = null; string key = null; string version = null; string displayName = null; - int attributes = 0; int illegalChar = -1; - foreach (XAttribute attrib in node.Attributes()) + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) { @@ -270,7 +272,7 @@ namespace WixToolset.Dependency // Make sure the key does not contain any illegal characters or values. if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters))) { - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); @@ -288,7 +290,7 @@ namespace WixToolset.Dependency else if (PackageType.None == packageType) { // Make sure the ProductCode is authored and set the key. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Property", "ProductCode"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Property, "ProductCode"); key = "!(bind.property.ProductCode)"; } @@ -317,7 +319,7 @@ namespace WixToolset.Dependency id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, parentId, key); } - foreach (XElement child in node.Elements()) + foreach (var child in node.Elements()) { if (this.Namespace == child.Name.Namespace) { @@ -342,24 +344,20 @@ namespace WixToolset.Dependency if (!this.Messaging.EncounteredError) { - // Create the row in the provider table. - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyProvider", id); - row.Set(1, parentId); - row.Set(2, key); + var tuple = section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id) + { + ComponentRef = parentId, + ProviderKey = key, + }); if (!String.IsNullOrEmpty(version)) { - row.Set(3, version); + tuple.Version = version; } if (!String.IsNullOrEmpty(displayName)) { - row.Set(4, displayName); - } - - if (0 != attributes) - { - row.Set(5, attributes); + tuple.DisplayName = displayName; } if (PackageType.None == packageType) @@ -377,44 +375,24 @@ namespace WixToolset.Dependency } // Generate registry rows for the provider using binder properties. - string keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); + var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); + var root = RegistryRootType.MachineUser; + + var value = "[ProductCode]"; + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, null, value, parentId, false); - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "(Default)")); - row.Set(1, -1); - row.Set(2, keyProvides); - row.Set(4, "[ProductCode]"); - row.Set(5, parentId); + value = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; + var versionRegistryTuple = + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "Version", value, parentId, false); + + value = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; + this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "DisplayName", value, parentId, false); // Use the Version registry value and use that as a potential key path. - Identifier idVersion = this.ParseHelper.CreateIdentifier("reg", id.Id, "Version"); keyPath = this.CreateComponentKeyPath(); - keyPath.Id = idVersion.Id; + keyPath.Id = versionRegistryTuple.Id; keyPath.Explicit = false; keyPath.Type = PossibleKeyPathType.Registry; - - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", idVersion); - row.Set(1, -1); - row.Set(2, keyProvides); - row.Set(3, "Version"); - row.Set(4, !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"); - row.Set(5, parentId); - - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "DisplayName")); - row.Set(1, -1); - row.Set(2, keyProvides); - row.Set(3, "DisplayName"); - row.Set(4, !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"); - row.Set(5, parentId); - - if (0 != attributes) - { - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "Registry", this.ParseHelper.CreateIdentifier("reg", id.Id, "Attributes")); - row.Set(1, -1); - row.Set(2, keyProvides); - row.Set(3, "Attributes"); - row.Set(4, String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat))); - row.Set(5, parentId); - } } } @@ -429,7 +407,7 @@ namespace WixToolset.Dependency /// Whether the Requires custom action should be referenced. private void ParseRequiresElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) { - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); Identifier id = null; string providerKey = null; string minVersion = null; @@ -437,7 +415,7 @@ namespace WixToolset.Dependency int attributes = 0; int illegalChar = -1; - foreach (XAttribute attrib in node.Attributes()) + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) { @@ -502,47 +480,40 @@ namespace WixToolset.Dependency // Make sure the key does not contain any illegal characters. else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) { - StringBuilder sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); + var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); } - if (!this.Messaging.EncounteredError) { // Reference the Require custom action if required. if (requiresAction) { - if (Platform.ARM == this.Context.Platform) - { - // Ensure the ARM version of the CA is referenced. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); - } - else - { - // All other supported platforms use x86. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); - } + this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers); } - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependency", id); - row.Set(1, providerKey); - row.Set(2, minVersion); - row.Set(3, maxVersion); + var tuple = section.AddTuple(new WixDependencyTuple(sourceLineNumbers, id) + { + ProviderKey = providerKey, + MinVersion = minVersion, + MaxVersion = maxVersion, + }); if (0 != attributes) { - row.Set(4, attributes); + tuple.Attributes = attributes; } - // Create the relationship between this WixDependency row and the WixDependencyProvider row. + // Create the relationship between this WixDependency tuple and the WixDependencyProvider tuple. if (!String.IsNullOrEmpty(providerId)) { - // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); - row.Set(0, providerId); - row.Set(1, id.Id); + section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers) + { + WixDependencyProviderRef = providerId, + WixDependencyRef = id.Id, + }); } } } @@ -555,10 +526,10 @@ namespace WixToolset.Dependency /// Whether the Requires custom action should be referenced. private void ParseRequiresRefElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) { - SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); string id = null; - foreach (XAttribute attrib in node.Attributes()) + foreach (var attrib in node.Attributes()) { if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) { @@ -590,25 +561,32 @@ namespace WixToolset.Dependency // Reference the Require custom action if required. if (requiresAction) { - if (Platform.ARM == this.Context.Platform) - { - // Ensure the ARM version of the CA is referenced. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); - } - else - { - // All other supported platforms use x86. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); - } + this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers); } // Create a link dependency on the row that contains information we'll need during bind. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "WixDependency", id); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, DependencyTupleDefinitions.WixDependency, id); // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "WixDependencyRef"); - row.Set(0, providerId); - row.Set(1, id); + section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers) + { + WixDependencyProviderRef = providerId, + WixDependencyRef = id, + }); + } + } + + private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers) + { + if (Platform.ARM == this.Context.Platform) + { + // Ensure the ARM version of the CA is referenced. + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); + } + else + { + // All other supported platforms use x86. + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); } } } diff --git a/src/wixext/DependencyTableDefinitions.cs b/src/wixext/DependencyTableDefinitions.cs new file mode 100644 index 00000000..bc3e880a --- /dev/null +++ b/src/wixext/DependencyTableDefinitions.cs @@ -0,0 +1,57 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Data.WindowsInstaller; + + public static class DependencyTableDefinitions + { + public static readonly TableDefinition WixDependencyProvider = new TableDefinition( + "WixDependencyProvider", + new[] + { + new ColumnDefinition("WixDependencyProvider", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "The foreign key into the Component table used to determine install state.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."), + new ColumnDefinition("Version", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The version of the package."), + new ColumnDefinition("DisplayName", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The display name of the package."), + new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), + }, + tupleDefinitionName: TupleDefinitions.WixDependencyProvider.Name, + tupleIdIsPrimaryKey: true + ); + + public static readonly TableDefinition WixDependency = new TableDefinition( + "WixDependency", + new[] + { + new ColumnDefinition("WixDependency", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."), + new ColumnDefinition("MinVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The minimum version of the provider supported."), + new ColumnDefinition("MaxVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The maximum version of the provider supported."), + new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), + }, + tupleDefinitionName: DependencyTupleDefinitions.WixDependency.Name, + tupleIdIsPrimaryKey: true + ); + + public static readonly TableDefinition WixDependencyRef = new TableDefinition( + "WixDependencyRef", + new[] + { + new ColumnDefinition("WixDependencyProvider_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependencyProvider", keyColumn: 1, description: "Foreign key into the Component table.", modularizeType: ColumnModularizeType.Column), + new ColumnDefinition("WixDependency_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependency", keyColumn: 1, description: "Foreign key into the WixDependency table.", modularizeType: ColumnModularizeType.Column), + }, + tupleDefinitionName: DependencyTupleDefinitions.WixDependencyRef.Name, + tupleIdIsPrimaryKey: false + ); + + public static readonly TableDefinition[] All = new[] + { + WixDependencyProvider, + WixDependency, + WixDependencyRef, + }; + } +} diff --git a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs index 265fdd4f..f52f97f3 100644 --- a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs +++ b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs @@ -3,28 +3,14 @@ namespace WixToolset.Dependency { using System.Collections.Generic; - using System.Linq; - using System.Xml; using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility; public class DependencyWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension { - private static readonly TableDefinition[] Tables = LoadTables(); + public override IEnumerable TableDefinitions => DependencyTableDefinitions.All; - public override IEnumerable TableDefinitions => Tables; - - private static TableDefinition[] LoadTables() - { - using (var resourceStream = typeof(DependencyWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Dependency.tables.xml")) - using (var reader = XmlReader.Create(resourceStream)) - { - var tables = TableDefinitionCollection.Load(reader); - return tables.ToArray(); - } - } - -#if TODO_TAG_BINDER_EXTENSION +#if TODO_DEPENDENCY_BINDER_EXTENSION private Output output; /// diff --git a/src/wixext/Tuples/DependencyTupleDefinitions.cs b/src/wixext/Tuples/DependencyTupleDefinitions.cs index fdd3f0b5..3309b0a5 100644 --- a/src/wixext/Tuples/DependencyTupleDefinitions.cs +++ b/src/wixext/Tuples/DependencyTupleDefinitions.cs @@ -8,7 +8,6 @@ namespace WixToolset.Dependency public enum DependencyTupleDefinitionType { WixDependency, - WixDependencyProvider, WixDependencyRef, } @@ -33,9 +32,6 @@ namespace WixToolset.Dependency case DependencyTupleDefinitionType.WixDependency: return DependencyTupleDefinitions.WixDependency; - case DependencyTupleDefinitionType.WixDependencyProvider: - return DependencyTupleDefinitions.WixDependencyProvider; - case DependencyTupleDefinitionType.WixDependencyRef: return DependencyTupleDefinitions.WixDependencyRef; diff --git a/src/wixext/Tuples/WixDependencyProviderTuple.cs b/src/wixext/Tuples/WixDependencyProviderTuple.cs deleted file mode 100644 index 2fd6a805..00000000 --- a/src/wixext/Tuples/WixDependencyProviderTuple.cs +++ /dev/null @@ -1,87 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Dependency.Tuples; - - public static partial class DependencyTupleDefinitions - { - public static readonly IntermediateTupleDefinition WixDependencyProvider = new IntermediateTupleDefinition( - DependencyTupleDefinitionType.WixDependencyProvider.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.WixDependencyProvider), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Component_), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.ProviderKey), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Version), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.DisplayName), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyProviderTupleFields.Attributes), IntermediateFieldType.Number), - }, - typeof(WixDependencyProviderTuple)); - } -} - -namespace WixToolset.Dependency.Tuples -{ - using WixToolset.Data; - - public enum WixDependencyProviderTupleFields - { - WixDependencyProvider, - Component_, - ProviderKey, - Version, - DisplayName, - Attributes, - } - - public class WixDependencyProviderTuple : IntermediateTuple - { - public WixDependencyProviderTuple() : base(DependencyTupleDefinitions.WixDependencyProvider, null, null) - { - } - - public WixDependencyProviderTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyProvider, sourceLineNumber, id) - { - } - - public IntermediateField this[WixDependencyProviderTupleFields index] => this.Fields[(int)index]; - - public string WixDependencyProvider - { - get => this.Fields[(int)WixDependencyProviderTupleFields.WixDependencyProvider].AsString(); - set => this.Set((int)WixDependencyProviderTupleFields.WixDependencyProvider, value); - } - - public string Component_ - { - get => this.Fields[(int)WixDependencyProviderTupleFields.Component_].AsString(); - set => this.Set((int)WixDependencyProviderTupleFields.Component_, value); - } - - public string ProviderKey - { - get => this.Fields[(int)WixDependencyProviderTupleFields.ProviderKey].AsString(); - set => this.Set((int)WixDependencyProviderTupleFields.ProviderKey, value); - } - - public string Version - { - get => this.Fields[(int)WixDependencyProviderTupleFields.Version].AsString(); - set => this.Set((int)WixDependencyProviderTupleFields.Version, value); - } - - public string DisplayName - { - get => this.Fields[(int)WixDependencyProviderTupleFields.DisplayName].AsString(); - set => this.Set((int)WixDependencyProviderTupleFields.DisplayName, value); - } - - public int Attributes - { - get => this.Fields[(int)WixDependencyProviderTupleFields.Attributes].AsNumber(); - set => this.Set((int)WixDependencyProviderTupleFields.Attributes, value); - } - } -} \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyRefTuple.cs b/src/wixext/Tuples/WixDependencyRefTuple.cs index 3e996f5f..9b5a5eed 100644 --- a/src/wixext/Tuples/WixDependencyRefTuple.cs +++ b/src/wixext/Tuples/WixDependencyRefTuple.cs @@ -11,8 +11,8 @@ namespace WixToolset.Dependency DependencyTupleDefinitionType.WixDependencyRef.ToString(), new[] { - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProvider_), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependency_), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProviderRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyRef), IntermediateFieldType.String), }, typeof(WixDependencyRefTuple)); } @@ -24,8 +24,8 @@ namespace WixToolset.Dependency.Tuples public enum WixDependencyRefTupleFields { - WixDependencyProvider_, - WixDependency_, + WixDependencyProviderRef, + WixDependencyRef, } public class WixDependencyRefTuple : IntermediateTuple @@ -40,16 +40,16 @@ namespace WixToolset.Dependency.Tuples public IntermediateField this[WixDependencyRefTupleFields index] => this.Fields[(int)index]; - public string WixDependencyProvider_ + public string WixDependencyProviderRef { - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProvider_].AsString(); - set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProvider_, value); + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProviderRef].AsString(); + set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProviderRef, value); } - public string WixDependency_ + public string WixDependencyRef { - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependency_].AsString(); - set => this.Set((int)WixDependencyRefTupleFields.WixDependency_, value); + get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyRef].AsString(); + set => this.Set((int)WixDependencyRefTupleFields.WixDependencyRef, value); } } } \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyTuple.cs b/src/wixext/Tuples/WixDependencyTuple.cs index 81e05ad1..1d62ae58 100644 --- a/src/wixext/Tuples/WixDependencyTuple.cs +++ b/src/wixext/Tuples/WixDependencyTuple.cs @@ -11,7 +11,6 @@ namespace WixToolset.Dependency DependencyTupleDefinitionType.WixDependency.ToString(), new[] { - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.WixDependency), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.ProviderKey), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MinVersion), IntermediateFieldType.String), new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MaxVersion), IntermediateFieldType.String), @@ -27,7 +26,6 @@ namespace WixToolset.Dependency.Tuples public enum WixDependencyTupleFields { - WixDependency, ProviderKey, MinVersion, MaxVersion, @@ -46,12 +44,6 @@ namespace WixToolset.Dependency.Tuples public IntermediateField this[WixDependencyTupleFields index] => this.Fields[(int)index]; - public string WixDependency - { - get => this.Fields[(int)WixDependencyTupleFields.WixDependency].AsString(); - set => this.Set((int)WixDependencyTupleFields.WixDependency, value); - } - public string ProviderKey { get => this.Fields[(int)WixDependencyTupleFields.ProviderKey].AsString(); diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj index 7e9f1e3a..0221c1c6 100644 --- a/src/wixext/WixToolset.Dependency.wixext.csproj +++ b/src/wixext/WixToolset.Dependency.wixext.csproj @@ -14,7 +14,6 @@ - diff --git a/src/wixext/tables.xml b/src/wixext/tables.xml deleted file mode 100644 index 03c9f267..00000000 --- a/src/wixext/tables.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3-55-g6feb From 5c923acac49eff384392626439a53003c8ef1488 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 13 Apr 2020 20:13:27 +1000 Subject: Update dependencies. --- appveyor.yml | 2 -- src/Cpp.Build.props | 18 ------------------ src/wixext/DependencyTableDefinitions.cs | 6 +++--- src/wixlib/dependency.wixproj | 4 ++-- src/wixlib/packages.config | 2 +- 5 files changed, 6 insertions(+), 26 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 522e5af3..7c686b04 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,8 +33,6 @@ skip_tags: true artifacts: - path: build\Release\**\*.nupkg name: nuget -- path: build\Release\**\*.msi - name: msi notifications: - provider: Slack diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props index 44a042c7..9b7a1bb5 100644 --- a/src/Cpp.Build.props +++ b/src/Cpp.Build.props @@ -70,12 +70,6 @@ MultiThreadedDebug - - - - MultiThreadedDebugDll - - MinSpace @@ -89,16 +83,4 @@ true - - - - MultiThreadedDll - - - - - $(LinkKeyFile) - $(LinkDelaySign) - - diff --git a/src/wixext/DependencyTableDefinitions.cs b/src/wixext/DependencyTableDefinitions.cs index bc3e880a..d563208d 100644 --- a/src/wixext/DependencyTableDefinitions.cs +++ b/src/wixext/DependencyTableDefinitions.cs @@ -9,6 +9,7 @@ namespace WixToolset.Dependency { public static readonly TableDefinition WixDependencyProvider = new TableDefinition( "WixDependencyProvider", + TupleDefinitions.WixDependencyProvider, new[] { new ColumnDefinition("WixDependencyProvider", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), @@ -18,12 +19,12 @@ namespace WixToolset.Dependency new ColumnDefinition("DisplayName", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The display name of the package."), new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), }, - tupleDefinitionName: TupleDefinitions.WixDependencyProvider.Name, tupleIdIsPrimaryKey: true ); public static readonly TableDefinition WixDependency = new TableDefinition( "WixDependency", + DependencyTupleDefinitions.WixDependency, new[] { new ColumnDefinition("WixDependency", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), @@ -32,18 +33,17 @@ namespace WixToolset.Dependency new ColumnDefinition("MaxVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The maximum version of the provider supported."), new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), }, - tupleDefinitionName: DependencyTupleDefinitions.WixDependency.Name, tupleIdIsPrimaryKey: true ); public static readonly TableDefinition WixDependencyRef = new TableDefinition( "WixDependencyRef", + DependencyTupleDefinitions.WixDependencyRef, new[] { new ColumnDefinition("WixDependencyProvider_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependencyProvider", keyColumn: 1, description: "Foreign key into the Component table.", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("WixDependency_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependency", keyColumn: 1, description: "Foreign key into the WixDependency table.", modularizeType: ColumnModularizeType.Column), }, - tupleDefinitionName: DependencyTupleDefinitions.WixDependencyRef.Name, tupleIdIsPrimaryKey: false ); diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index 72be9c16..5c704f3f 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -1,7 +1,7 @@ - + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} @@ -37,7 +37,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config index e1b601f6..1e5a9850 100644 --- a/src/wixlib/packages.config +++ b/src/wixlib/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file -- cgit v1.2.3-55-g6feb From 0ea7e4a065e5c65dd59396dbdf3b7ba1b85c6c4a Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 02:50:45 -0700 Subject: The Great Tuple to Symbol Rename (tm) --- src/wixext/DependencyCompiler.cs | 38 ++++++++++---------- src/wixext/DependencyExtensionData.cs | 10 +++--- src/wixext/DependencyTableDefinitions.cs | 12 +++---- src/wixext/Tuples/DependencyTupleDefinitions.cs | 18 +++++----- src/wixext/Tuples/WixDependencyRefTuple.cs | 34 +++++++++--------- src/wixext/Tuples/WixDependencyTuple.cs | 46 ++++++++++++------------- 6 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 4ec6f477..018a507a 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -8,8 +8,8 @@ namespace WixToolset.Dependency using System.Text; using System.Xml.Linq; using WixToolset.Data; - using WixToolset.Data.Tuples; - using WixToolset.Dependency.Tuples; + using WixToolset.Data.Symbols; + using WixToolset.Dependency.Symbols; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; @@ -207,9 +207,9 @@ namespace WixToolset.Dependency if (!this.Messaging.EncounteredError) { - // Create the provider tuple for the bundle. The Component_ field is required + // Create the provider symbol for the bundle. The Component_ field is required // in the table definition but unused for bundles, so just set it to the valid ID. - section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id) + section.AddSymbol(new WixDependencyProviderSymbol(sourceLineNumbers, id) { ComponentRef = id.Id, ProviderKey = providerKey, @@ -290,7 +290,7 @@ namespace WixToolset.Dependency else if (PackageType.None == packageType) { // Make sure the ProductCode is authored and set the key. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, TupleDefinitions.Property, "ProductCode"); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.Property, "ProductCode"); key = "!(bind.property.ProductCode)"; } @@ -344,7 +344,7 @@ namespace WixToolset.Dependency if (!this.Messaging.EncounteredError) { - var tuple = section.AddTuple(new WixDependencyProviderTuple(sourceLineNumbers, id) + var symbol = section.AddSymbol(new WixDependencyProviderSymbol(sourceLineNumbers, id) { ComponentRef = parentId, ProviderKey = key, @@ -352,12 +352,12 @@ namespace WixToolset.Dependency if (!String.IsNullOrEmpty(version)) { - tuple.Version = version; + symbol.Version = version; } if (!String.IsNullOrEmpty(displayName)) { - tuple.DisplayName = displayName; + symbol.DisplayName = displayName; } if (PackageType.None == packageType) @@ -379,18 +379,18 @@ namespace WixToolset.Dependency var root = RegistryRootType.MachineUser; var value = "[ProductCode]"; - this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, null, value, parentId, false); + this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, null, value, parentId, false); value = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; - var versionRegistryTuple = - this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "Version", value, parentId, false); + var versionRegistrySymbol = + this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, "Version", value, parentId, false); value = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; - this.ParseHelper.CreateRegistryTuple(section, sourceLineNumbers, root, keyProvides, "DisplayName", value, parentId, false); + this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, "DisplayName", value, parentId, false); // Use the Version registry value and use that as a potential key path. keyPath = this.CreateComponentKeyPath(); - keyPath.Id = versionRegistryTuple.Id; + keyPath.Id = versionRegistrySymbol.Id; keyPath.Explicit = false; keyPath.Type = PossibleKeyPathType.Registry; } @@ -494,7 +494,7 @@ namespace WixToolset.Dependency this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers); } - var tuple = section.AddTuple(new WixDependencyTuple(sourceLineNumbers, id) + var symbol = section.AddSymbol(new WixDependencySymbol(sourceLineNumbers, id) { ProviderKey = providerKey, MinVersion = minVersion, @@ -503,13 +503,13 @@ namespace WixToolset.Dependency if (0 != attributes) { - tuple.Attributes = attributes; + symbol.Attributes = attributes; } - // Create the relationship between this WixDependency tuple and the WixDependencyProvider tuple. + // Create the relationship between this WixDependency symbol and the WixDependencyProvider symbol. if (!String.IsNullOrEmpty(providerId)) { - section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers) + section.AddSymbol(new WixDependencyRefSymbol(sourceLineNumbers) { WixDependencyProviderRef = providerId, WixDependencyRef = id.Id, @@ -565,10 +565,10 @@ namespace WixToolset.Dependency } // Create a link dependency on the row that contains information we'll need during bind. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, DependencyTupleDefinitions.WixDependency, id); + this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, DependencySymbolDefinitions.WixDependency, id); // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - section.AddTuple(new WixDependencyRefTuple(sourceLineNumbers) + section.AddSymbol(new WixDependencyRefSymbol(sourceLineNumbers) { WixDependencyProviderRef = providerId, WixDependencyRef = id, diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs index e92aeff1..e7d8746c 100644 --- a/src/wixext/DependencyExtensionData.cs +++ b/src/wixext/DependencyExtensionData.cs @@ -16,15 +16,15 @@ namespace WixToolset.Dependency /// The default culture. public override string DefaultCulture => "en-US"; - public override bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition) + public override bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) { - tupleDefinition = DependencyTupleDefinitions.ByName(name); - return tupleDefinition != null; + symbolDefinition = DependencySymbolDefinitions.ByName(name); + return symbolDefinition != null; } - public override Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions) + public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) { - return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", tupleDefinitions); + return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", symbolDefinitions); } } } diff --git a/src/wixext/DependencyTableDefinitions.cs b/src/wixext/DependencyTableDefinitions.cs index d563208d..d3f643e4 100644 --- a/src/wixext/DependencyTableDefinitions.cs +++ b/src/wixext/DependencyTableDefinitions.cs @@ -9,7 +9,7 @@ namespace WixToolset.Dependency { public static readonly TableDefinition WixDependencyProvider = new TableDefinition( "WixDependencyProvider", - TupleDefinitions.WixDependencyProvider, + SymbolDefinitions.WixDependencyProvider, new[] { new ColumnDefinition("WixDependencyProvider", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), @@ -19,12 +19,12 @@ namespace WixToolset.Dependency new ColumnDefinition("DisplayName", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The display name of the package."), new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), }, - tupleIdIsPrimaryKey: true + symbolIdIsPrimaryKey: true ); public static readonly TableDefinition WixDependency = new TableDefinition( "WixDependency", - DependencyTupleDefinitions.WixDependency, + DependencySymbolDefinitions.WixDependency, new[] { new ColumnDefinition("WixDependency", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), @@ -33,18 +33,18 @@ namespace WixToolset.Dependency new ColumnDefinition("MaxVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The maximum version of the provider supported."), new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), }, - tupleIdIsPrimaryKey: true + symbolIdIsPrimaryKey: true ); public static readonly TableDefinition WixDependencyRef = new TableDefinition( "WixDependencyRef", - DependencyTupleDefinitions.WixDependencyRef, + DependencySymbolDefinitions.WixDependencyRef, new[] { new ColumnDefinition("WixDependencyProvider_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependencyProvider", keyColumn: 1, description: "Foreign key into the Component table.", modularizeType: ColumnModularizeType.Column), new ColumnDefinition("WixDependency_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependency", keyColumn: 1, description: "Foreign key into the WixDependency table.", modularizeType: ColumnModularizeType.Column), }, - tupleIdIsPrimaryKey: false + symbolIdIsPrimaryKey: false ); public static readonly TableDefinition[] All = new[] diff --git a/src/wixext/Tuples/DependencyTupleDefinitions.cs b/src/wixext/Tuples/DependencyTupleDefinitions.cs index 3309b0a5..5a18ae4b 100644 --- a/src/wixext/Tuples/DependencyTupleDefinitions.cs +++ b/src/wixext/Tuples/DependencyTupleDefinitions.cs @@ -5,19 +5,19 @@ namespace WixToolset.Dependency using System; using WixToolset.Data; - public enum DependencyTupleDefinitionType + public enum DependencySymbolDefinitionType { WixDependency, WixDependencyRef, } - public static partial class DependencyTupleDefinitions + public static partial class DependencySymbolDefinitions { public static readonly Version Version = new Version("4.0.0"); - public static IntermediateTupleDefinition ByName(string name) + public static IntermediateSymbolDefinition ByName(string name) { - if (!Enum.TryParse(name, out DependencyTupleDefinitionType type)) + if (!Enum.TryParse(name, out DependencySymbolDefinitionType type)) { return null; } @@ -25,15 +25,15 @@ namespace WixToolset.Dependency return ByType(type); } - public static IntermediateTupleDefinition ByType(DependencyTupleDefinitionType type) + public static IntermediateSymbolDefinition ByType(DependencySymbolDefinitionType type) { switch (type) { - case DependencyTupleDefinitionType.WixDependency: - return DependencyTupleDefinitions.WixDependency; + case DependencySymbolDefinitionType.WixDependency: + return DependencySymbolDefinitions.WixDependency; - case DependencyTupleDefinitionType.WixDependencyRef: - return DependencyTupleDefinitions.WixDependencyRef; + case DependencySymbolDefinitionType.WixDependencyRef: + return DependencySymbolDefinitions.WixDependencyRef; default: throw new ArgumentOutOfRangeException(nameof(type)); diff --git a/src/wixext/Tuples/WixDependencyRefTuple.cs b/src/wixext/Tuples/WixDependencyRefTuple.cs index 9b5a5eed..6f2aaadf 100644 --- a/src/wixext/Tuples/WixDependencyRefTuple.cs +++ b/src/wixext/Tuples/WixDependencyRefTuple.cs @@ -3,53 +3,53 @@ namespace WixToolset.Dependency { using WixToolset.Data; - using WixToolset.Dependency.Tuples; + using WixToolset.Dependency.Symbols; - public static partial class DependencyTupleDefinitions + public static partial class DependencySymbolDefinitions { - public static readonly IntermediateTupleDefinition WixDependencyRef = new IntermediateTupleDefinition( - DependencyTupleDefinitionType.WixDependencyRef.ToString(), + public static readonly IntermediateSymbolDefinition WixDependencyRef = new IntermediateSymbolDefinition( + DependencySymbolDefinitionType.WixDependencyRef.ToString(), new[] { - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyProviderRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyRefTupleFields.WixDependencyRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyProviderRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyRef), IntermediateFieldType.String), }, - typeof(WixDependencyRefTuple)); + typeof(WixDependencyRefSymbol)); } } -namespace WixToolset.Dependency.Tuples +namespace WixToolset.Dependency.Symbols { using WixToolset.Data; - public enum WixDependencyRefTupleFields + public enum WixDependencyRefSymbolFields { WixDependencyProviderRef, WixDependencyRef, } - public class WixDependencyRefTuple : IntermediateTuple + public class WixDependencyRefSymbol : IntermediateSymbol { - public WixDependencyRefTuple() : base(DependencyTupleDefinitions.WixDependencyRef, null, null) + public WixDependencyRefSymbol() : base(DependencySymbolDefinitions.WixDependencyRef, null, null) { } - public WixDependencyRefTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependencyRef, sourceLineNumber, id) + public WixDependencyRefSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependencyRef, sourceLineNumber, id) { } - public IntermediateField this[WixDependencyRefTupleFields index] => this.Fields[(int)index]; + public IntermediateField this[WixDependencyRefSymbolFields index] => this.Fields[(int)index]; public string WixDependencyProviderRef { - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyProviderRef].AsString(); - set => this.Set((int)WixDependencyRefTupleFields.WixDependencyProviderRef, value); + get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyProviderRef].AsString(); + set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyProviderRef, value); } public string WixDependencyRef { - get => this.Fields[(int)WixDependencyRefTupleFields.WixDependencyRef].AsString(); - set => this.Set((int)WixDependencyRefTupleFields.WixDependencyRef, value); + get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyRef].AsString(); + set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyRef, value); } } } \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyTuple.cs b/src/wixext/Tuples/WixDependencyTuple.cs index 1d62ae58..17c631c5 100644 --- a/src/wixext/Tuples/WixDependencyTuple.cs +++ b/src/wixext/Tuples/WixDependencyTuple.cs @@ -3,28 +3,28 @@ namespace WixToolset.Dependency { using WixToolset.Data; - using WixToolset.Dependency.Tuples; + using WixToolset.Dependency.Symbols; - public static partial class DependencyTupleDefinitions + public static partial class DependencySymbolDefinitions { - public static readonly IntermediateTupleDefinition WixDependency = new IntermediateTupleDefinition( - DependencyTupleDefinitionType.WixDependency.ToString(), + public static readonly IntermediateSymbolDefinition WixDependency = new IntermediateSymbolDefinition( + DependencySymbolDefinitionType.WixDependency.ToString(), new[] { - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.ProviderKey), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MinVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.MaxVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyTupleFields.Attributes), IntermediateFieldType.Number), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.ProviderKey), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MinVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MaxVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.Attributes), IntermediateFieldType.Number), }, - typeof(WixDependencyTuple)); + typeof(WixDependencySymbol)); } } -namespace WixToolset.Dependency.Tuples +namespace WixToolset.Dependency.Symbols { using WixToolset.Data; - public enum WixDependencyTupleFields + public enum WixDependencySymbolFields { ProviderKey, MinVersion, @@ -32,40 +32,40 @@ namespace WixToolset.Dependency.Tuples Attributes, } - public class WixDependencyTuple : IntermediateTuple + public class WixDependencySymbol : IntermediateSymbol { - public WixDependencyTuple() : base(DependencyTupleDefinitions.WixDependency, null, null) + public WixDependencySymbol() : base(DependencySymbolDefinitions.WixDependency, null, null) { } - public WixDependencyTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencyTupleDefinitions.WixDependency, sourceLineNumber, id) + public WixDependencySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependency, sourceLineNumber, id) { } - public IntermediateField this[WixDependencyTupleFields index] => this.Fields[(int)index]; + public IntermediateField this[WixDependencySymbolFields index] => this.Fields[(int)index]; public string ProviderKey { - get => this.Fields[(int)WixDependencyTupleFields.ProviderKey].AsString(); - set => this.Set((int)WixDependencyTupleFields.ProviderKey, value); + get => this.Fields[(int)WixDependencySymbolFields.ProviderKey].AsString(); + set => this.Set((int)WixDependencySymbolFields.ProviderKey, value); } public string MinVersion { - get => this.Fields[(int)WixDependencyTupleFields.MinVersion].AsString(); - set => this.Set((int)WixDependencyTupleFields.MinVersion, value); + get => this.Fields[(int)WixDependencySymbolFields.MinVersion].AsString(); + set => this.Set((int)WixDependencySymbolFields.MinVersion, value); } public string MaxVersion { - get => this.Fields[(int)WixDependencyTupleFields.MaxVersion].AsString(); - set => this.Set((int)WixDependencyTupleFields.MaxVersion, value); + get => this.Fields[(int)WixDependencySymbolFields.MaxVersion].AsString(); + set => this.Set((int)WixDependencySymbolFields.MaxVersion, value); } public int Attributes { - get => this.Fields[(int)WixDependencyTupleFields.Attributes].AsNumber(); - set => this.Set((int)WixDependencyTupleFields.Attributes, value); + get => this.Fields[(int)WixDependencySymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixDependencySymbolFields.Attributes, value); } } } \ No newline at end of file -- cgit v1.2.3-55-g6feb From 5756dd94e2a1bdc4ed6b7d957c7df314b66efcd8 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 02:51:42 -0700 Subject: The Great Tuple to Symbol File Rename (tm) --- src/wixext/Symbols/DependencySymbolDefinitions.cs | 43 ++++++++++++++ src/wixext/Symbols/WixDependencyRefSymbol.cs | 55 ++++++++++++++++++ src/wixext/Symbols/WixDependencySymbol.cs | 71 +++++++++++++++++++++++ src/wixext/Tuples/DependencyTupleDefinitions.cs | 43 -------------- src/wixext/Tuples/WixDependencyRefTuple.cs | 55 ------------------ src/wixext/Tuples/WixDependencyTuple.cs | 71 ----------------------- 6 files changed, 169 insertions(+), 169 deletions(-) create mode 100644 src/wixext/Symbols/DependencySymbolDefinitions.cs create mode 100644 src/wixext/Symbols/WixDependencyRefSymbol.cs create mode 100644 src/wixext/Symbols/WixDependencySymbol.cs delete mode 100644 src/wixext/Tuples/DependencyTupleDefinitions.cs delete mode 100644 src/wixext/Tuples/WixDependencyRefTuple.cs delete mode 100644 src/wixext/Tuples/WixDependencyTuple.cs diff --git a/src/wixext/Symbols/DependencySymbolDefinitions.cs b/src/wixext/Symbols/DependencySymbolDefinitions.cs new file mode 100644 index 00000000..5a18ae4b --- /dev/null +++ b/src/wixext/Symbols/DependencySymbolDefinitions.cs @@ -0,0 +1,43 @@ +// 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 WixToolset.Dependency +{ + using System; + using WixToolset.Data; + + public enum DependencySymbolDefinitionType + { + WixDependency, + WixDependencyRef, + } + + public static partial class DependencySymbolDefinitions + { + public static readonly Version Version = new Version("4.0.0"); + + public static IntermediateSymbolDefinition ByName(string name) + { + if (!Enum.TryParse(name, out DependencySymbolDefinitionType type)) + { + return null; + } + + return ByType(type); + } + + public static IntermediateSymbolDefinition ByType(DependencySymbolDefinitionType type) + { + switch (type) + { + case DependencySymbolDefinitionType.WixDependency: + return DependencySymbolDefinitions.WixDependency; + + case DependencySymbolDefinitionType.WixDependencyRef: + return DependencySymbolDefinitions.WixDependencyRef; + + default: + throw new ArgumentOutOfRangeException(nameof(type)); + } + } + } +} diff --git a/src/wixext/Symbols/WixDependencyRefSymbol.cs b/src/wixext/Symbols/WixDependencyRefSymbol.cs new file mode 100644 index 00000000..6f2aaadf --- /dev/null +++ b/src/wixext/Symbols/WixDependencyRefSymbol.cs @@ -0,0 +1,55 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Dependency.Symbols; + + public static partial class DependencySymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixDependencyRef = new IntermediateSymbolDefinition( + DependencySymbolDefinitionType.WixDependencyRef.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyProviderRef), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyRef), IntermediateFieldType.String), + }, + typeof(WixDependencyRefSymbol)); + } +} + +namespace WixToolset.Dependency.Symbols +{ + using WixToolset.Data; + + public enum WixDependencyRefSymbolFields + { + WixDependencyProviderRef, + WixDependencyRef, + } + + public class WixDependencyRefSymbol : IntermediateSymbol + { + public WixDependencyRefSymbol() : base(DependencySymbolDefinitions.WixDependencyRef, null, null) + { + } + + public WixDependencyRefSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependencyRef, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDependencyRefSymbolFields index] => this.Fields[(int)index]; + + public string WixDependencyProviderRef + { + get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyProviderRef].AsString(); + set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyProviderRef, value); + } + + public string WixDependencyRef + { + get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyRef].AsString(); + set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyRef, value); + } + } +} \ No newline at end of file diff --git a/src/wixext/Symbols/WixDependencySymbol.cs b/src/wixext/Symbols/WixDependencySymbol.cs new file mode 100644 index 00000000..17c631c5 --- /dev/null +++ b/src/wixext/Symbols/WixDependencySymbol.cs @@ -0,0 +1,71 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Dependency.Symbols; + + public static partial class DependencySymbolDefinitions + { + public static readonly IntermediateSymbolDefinition WixDependency = new IntermediateSymbolDefinition( + DependencySymbolDefinitionType.WixDependency.ToString(), + new[] + { + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.ProviderKey), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MinVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MaxVersion), IntermediateFieldType.String), + new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.Attributes), IntermediateFieldType.Number), + }, + typeof(WixDependencySymbol)); + } +} + +namespace WixToolset.Dependency.Symbols +{ + using WixToolset.Data; + + public enum WixDependencySymbolFields + { + ProviderKey, + MinVersion, + MaxVersion, + Attributes, + } + + public class WixDependencySymbol : IntermediateSymbol + { + public WixDependencySymbol() : base(DependencySymbolDefinitions.WixDependency, null, null) + { + } + + public WixDependencySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependency, sourceLineNumber, id) + { + } + + public IntermediateField this[WixDependencySymbolFields index] => this.Fields[(int)index]; + + public string ProviderKey + { + get => this.Fields[(int)WixDependencySymbolFields.ProviderKey].AsString(); + set => this.Set((int)WixDependencySymbolFields.ProviderKey, value); + } + + public string MinVersion + { + get => this.Fields[(int)WixDependencySymbolFields.MinVersion].AsString(); + set => this.Set((int)WixDependencySymbolFields.MinVersion, value); + } + + public string MaxVersion + { + get => this.Fields[(int)WixDependencySymbolFields.MaxVersion].AsString(); + set => this.Set((int)WixDependencySymbolFields.MaxVersion, value); + } + + public int Attributes + { + get => this.Fields[(int)WixDependencySymbolFields.Attributes].AsNumber(); + set => this.Set((int)WixDependencySymbolFields.Attributes, value); + } + } +} \ No newline at end of file diff --git a/src/wixext/Tuples/DependencyTupleDefinitions.cs b/src/wixext/Tuples/DependencyTupleDefinitions.cs deleted file mode 100644 index 5a18ae4b..00000000 --- a/src/wixext/Tuples/DependencyTupleDefinitions.cs +++ /dev/null @@ -1,43 +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 WixToolset.Dependency -{ - using System; - using WixToolset.Data; - - public enum DependencySymbolDefinitionType - { - WixDependency, - WixDependencyRef, - } - - public static partial class DependencySymbolDefinitions - { - public static readonly Version Version = new Version("4.0.0"); - - public static IntermediateSymbolDefinition ByName(string name) - { - if (!Enum.TryParse(name, out DependencySymbolDefinitionType type)) - { - return null; - } - - return ByType(type); - } - - public static IntermediateSymbolDefinition ByType(DependencySymbolDefinitionType type) - { - switch (type) - { - case DependencySymbolDefinitionType.WixDependency: - return DependencySymbolDefinitions.WixDependency; - - case DependencySymbolDefinitionType.WixDependencyRef: - return DependencySymbolDefinitions.WixDependencyRef; - - default: - throw new ArgumentOutOfRangeException(nameof(type)); - } - } - } -} diff --git a/src/wixext/Tuples/WixDependencyRefTuple.cs b/src/wixext/Tuples/WixDependencyRefTuple.cs deleted file mode 100644 index 6f2aaadf..00000000 --- a/src/wixext/Tuples/WixDependencyRefTuple.cs +++ /dev/null @@ -1,55 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Dependency.Symbols; - - public static partial class DependencySymbolDefinitions - { - public static readonly IntermediateSymbolDefinition WixDependencyRef = new IntermediateSymbolDefinition( - DependencySymbolDefinitionType.WixDependencyRef.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyProviderRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyRef), IntermediateFieldType.String), - }, - typeof(WixDependencyRefSymbol)); - } -} - -namespace WixToolset.Dependency.Symbols -{ - using WixToolset.Data; - - public enum WixDependencyRefSymbolFields - { - WixDependencyProviderRef, - WixDependencyRef, - } - - public class WixDependencyRefSymbol : IntermediateSymbol - { - public WixDependencyRefSymbol() : base(DependencySymbolDefinitions.WixDependencyRef, null, null) - { - } - - public WixDependencyRefSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependencyRef, sourceLineNumber, id) - { - } - - public IntermediateField this[WixDependencyRefSymbolFields index] => this.Fields[(int)index]; - - public string WixDependencyProviderRef - { - get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyProviderRef].AsString(); - set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyProviderRef, value); - } - - public string WixDependencyRef - { - get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyRef].AsString(); - set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyRef, value); - } - } -} \ No newline at end of file diff --git a/src/wixext/Tuples/WixDependencyTuple.cs b/src/wixext/Tuples/WixDependencyTuple.cs deleted file mode 100644 index 17c631c5..00000000 --- a/src/wixext/Tuples/WixDependencyTuple.cs +++ /dev/null @@ -1,71 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Dependency.Symbols; - - public static partial class DependencySymbolDefinitions - { - public static readonly IntermediateSymbolDefinition WixDependency = new IntermediateSymbolDefinition( - DependencySymbolDefinitionType.WixDependency.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.ProviderKey), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MinVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MaxVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.Attributes), IntermediateFieldType.Number), - }, - typeof(WixDependencySymbol)); - } -} - -namespace WixToolset.Dependency.Symbols -{ - using WixToolset.Data; - - public enum WixDependencySymbolFields - { - ProviderKey, - MinVersion, - MaxVersion, - Attributes, - } - - public class WixDependencySymbol : IntermediateSymbol - { - public WixDependencySymbol() : base(DependencySymbolDefinitions.WixDependency, null, null) - { - } - - public WixDependencySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependency, sourceLineNumber, id) - { - } - - public IntermediateField this[WixDependencySymbolFields index] => this.Fields[(int)index]; - - public string ProviderKey - { - get => this.Fields[(int)WixDependencySymbolFields.ProviderKey].AsString(); - set => this.Set((int)WixDependencySymbolFields.ProviderKey, value); - } - - public string MinVersion - { - get => this.Fields[(int)WixDependencySymbolFields.MinVersion].AsString(); - set => this.Set((int)WixDependencySymbolFields.MinVersion, value); - } - - public string MaxVersion - { - get => this.Fields[(int)WixDependencySymbolFields.MaxVersion].AsString(); - set => this.Set((int)WixDependencySymbolFields.MaxVersion, value); - } - - public int Attributes - { - get => this.Fields[(int)WixDependencySymbolFields.Attributes].AsNumber(); - set => this.Set((int)WixDependencySymbolFields.Attributes, value); - } - } -} \ No newline at end of file -- cgit v1.2.3-55-g6feb From d95a3e33daea883bf7b05ef422d1d489270cc0d3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 02:56:58 -0700 Subject: Build wixlib with WixToolset.Sdk --- global.json | 5 +++++ src/wixlib/dependency.wixproj | 38 +++++++------------------------------- src/wixlib/packages.config | 5 ----- 3 files changed, 12 insertions(+), 36 deletions(-) create mode 100644 global.json delete mode 100644 src/wixlib/packages.config diff --git a/global.json b/global.json new file mode 100644 index 00000000..7a995d0a --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "WixToolset.Sdk": "4.0.0-build-0143" + } +} diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index 5c704f3f..25e13317 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -1,43 +1,19 @@ - - - - + + - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8} - dependency Library true - true - 1086 + en-us - - - - - - + + - - dependencyca - {B86AF46C-0F90-49CC-923F-A800B088D015} - + - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + diff --git a/src/wixlib/packages.config b/src/wixlib/packages.config deleted file mode 100644 index 1e5a9850..00000000 --- a/src/wixlib/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file -- cgit v1.2.3-55-g6feb From 31ee67d67569dd82cd9853dbdd53f28fdda534f3 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 02:59:29 -0700 Subject: Update to latest dutil and wcautil --- src/ca/dependencyca.vcxproj | 8 ++++---- src/ca/packages.config | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index c8072f71..d8441f14 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -2,8 +2,8 @@ - - + + @@ -55,7 +55,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + diff --git a/src/ca/packages.config b/src/ca/packages.config index 4e9403bf..e3dc0e43 100644 --- a/src/ca/packages.config +++ b/src/ca/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file -- cgit v1.2.3-55-g6feb From b9b3a6953a77e93b4ac7cdce5ec829dff7217faf Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 03:00:11 -0700 Subject: Improve build batch file --- appveyor.cmd | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/appveyor.cmd b/appveyor.cmd index 73674296..6bb3b543 100644 --- a/appveyor.cmd +++ b/appveyor.cmd @@ -1,13 +1,14 @@ @setlocal @pushd %~dp0 -nuget restore +nuget restore || exit /b -msbuild -p:Configuration=Release -t:Restore +msbuild -p:Configuration=Release -t:Restore || exit /b -msbuild -p:Configuration=Release src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj +msbuild -p:Configuration=Release src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj || exit /b +dotnet test -c Release --no-build src\test\WixToolsetTest.Dependency || exit /b -msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj +msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj || exit /b @popd @endlocal \ No newline at end of file -- cgit v1.2.3-55-g6feb From 4e1ad5e7a257b351d40a8d68aa6e1a961766556b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Jun 2020 03:02:53 -0700 Subject: Update nuget.config --- nuget.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nuget.config b/nuget.config index aaee3228..10ef488d 100644 --- a/nuget.config +++ b/nuget.config @@ -2,10 +2,12 @@ + + -- cgit v1.2.3-55-g6feb From 6d17a027ff6155ed50f78858cad17d1baef9856d Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 4 Jul 2020 18:59:34 -0400 Subject: Add per-platform custom action support. --- Dependency.wixext.sln | 4 +-- src/ca/dependencyca.vcxproj | 39 +++++++++++++++++++--------- src/ca/dependencyca.vcxproj.filters | 1 + src/wixext/DependencyCompiler.cs | 23 ++--------------- src/wixlib/DependencyExtension_Platform.wxi | 13 ++++++---- src/wixlib/DependencyExtension_arm.wxs | 8 ++++++ src/wixlib/DependencyExtension_arm64.wxs | 8 ++++++ src/wixlib/DependencyExtension_x64.wxs | 8 ++++++ src/wixlib/caDecor.wxi | 40 +++++++++++++++++++++++++++++ src/wixlib/caSuffix.wxi | 28 -------------------- src/wixlib/dependency.wixproj | 7 +++-- 11 files changed, 109 insertions(+), 70 deletions(-) create mode 100644 src/wixlib/DependencyExtension_arm.wxs create mode 100644 src/wixlib/DependencyExtension_arm64.wxs create mode 100644 src/wixlib/DependencyExtension_x64.wxs create mode 100644 src/wixlib/caDecor.wxi delete mode 100644 src/wixlib/caSuffix.wxi diff --git a/Dependency.wixext.sln b/Dependency.wixext.sln index c69a467b..e771ddf6 100644 --- a/Dependency.wixext.sln +++ b/Dependency.wixext.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.2016 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30204.135 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}" EndProject diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index d8441f14..c1dfc0c0 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -1,10 +1,8 @@ - - Debug @@ -14,43 +12,60 @@ Release Win32 + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + - {B86AF46C-0F90-49CC-923F-A800B088D015} DynamicLibrary - v141 + v142 Unicode dependencyca wixdepca.def WiX Toolset Dependency CustomAction + 10.0 - - msi.lib - Create - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. @@ -58,4 +73,4 @@ - + \ No newline at end of file diff --git a/src/ca/dependencyca.vcxproj.filters b/src/ca/dependencyca.vcxproj.filters index d4931f32..bfe457e2 100644 --- a/src/ca/dependencyca.vcxproj.filters +++ b/src/ca/dependencyca.vcxproj.filters @@ -31,5 +31,6 @@ Source Files + \ No newline at end of file diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 018a507a..36a24c67 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -362,17 +362,7 @@ namespace WixToolset.Dependency if (PackageType.None == packageType) { - // Reference the Check custom action to check for dependencies on the current provider. - if (Platform.ARM == this.Context.Platform) - { - // Ensure the ARM version of the CA is referenced. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck_ARM"); - } - else - { - // All other supported platforms use x86. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyCheck"); - } + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); // Generate registry rows for the provider using binder properties. var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); @@ -578,16 +568,7 @@ namespace WixToolset.Dependency private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers) { - if (Platform.ARM == this.Context.Platform) - { - // Ensure the ARM version of the CA is referenced. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire_ARM"); - } - else - { - // All other supported platforms use x86. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "WixDependencyRequire"); - } + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); } } } diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi index 7cd7ad96..299a93eb 100644 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -3,23 +3,26 @@ - + + - + - + + - + - + + diff --git a/src/wixlib/DependencyExtension_arm.wxs b/src/wixlib/DependencyExtension_arm.wxs new file mode 100644 index 00000000..d4ba33a3 --- /dev/null +++ b/src/wixlib/DependencyExtension_arm.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/DependencyExtension_arm64.wxs b/src/wixlib/DependencyExtension_arm64.wxs new file mode 100644 index 00000000..36e023e7 --- /dev/null +++ b/src/wixlib/DependencyExtension_arm64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/DependencyExtension_x64.wxs b/src/wixlib/DependencyExtension_x64.wxs new file mode 100644 index 00000000..8298bce6 --- /dev/null +++ b/src/wixlib/DependencyExtension_x64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi new file mode 100644 index 00000000..1d00df8f --- /dev/null +++ b/src/wixlib/caDecor.wxi @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/caSuffix.wxi b/src/wixlib/caSuffix.wxi deleted file mode 100644 index a56a2393..00000000 --- a/src/wixlib/caSuffix.wxi +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index 25e13317..f7ba0f79 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -4,12 +4,15 @@ Library true - + 1086 en-us - + + + + -- cgit v1.2.3-55-g6feb From e84996576e588d27a7b1c61423c1e10c929b8b1a Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sun, 20 Sep 2020 16:49:56 -0400 Subject: Remove 32-bit ARM support. --- global.json | 2 +- src/ca/dependencyca.vcxproj | 8 -------- .../DependencyExtensionFixture.cs | 2 +- src/wixext/DependencyCompiler.cs | 4 ++-- src/wixlib/DependencyExtension.wxs | 11 +++++------ src/wixlib/DependencyExtension_Platform.wxi | 21 ++++++++++----------- src/wixlib/DependencyExtension_arm.wxs | 8 -------- src/wixlib/DependencyExtension_arm64.wxs | 3 +-- src/wixlib/DependencyExtension_x64.wxs | 3 +-- src/wixlib/DependencyExtension_x86.wxs | 3 +-- src/wixlib/caDecor.wxi | 21 ++++++++++----------- src/wixlib/caerr.wxi | 2 +- src/wixlib/dependency.wixproj | 8 +++++++- src/wixlib/en-us.wxl | 3 +-- 14 files changed, 41 insertions(+), 58 deletions(-) delete mode 100644 src/wixlib/DependencyExtension_arm.wxs diff --git a/global.json b/global.json index 7a995d0a..4d9df50b 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0143" + "WixToolset.Sdk": "4.0.0-build-0157" } } diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index c1dfc0c0..ad01a82f 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -20,14 +20,6 @@ Release x64 - - Debug - ARM - - - Release - ARM - Debug ARM64 diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 823532ee..67072e36 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -19,7 +19,7 @@ namespace WixToolsetTest.Dependency var results = build.BuildAndQuery(Build, "WixDependencyProvider"); Assert.Equal(new[] { - "WixDependencyProvider:depJQsOasf1FRUsKxq8THB9sXk8yws\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", + "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", }, results); } diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 36a24c67..4aaa373b 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -362,7 +362,7 @@ namespace WixToolset.Dependency if (PackageType.None == packageType) { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); // Generate registry rows for the provider using binder properties. var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); @@ -568,7 +568,7 @@ namespace WixToolset.Dependency private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers) { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); } } } diff --git a/src/wixlib/DependencyExtension.wxs b/src/wixlib/DependencyExtension.wxs index 21f863d2..0516b18c 100644 --- a/src/wixlib/DependencyExtension.wxs +++ b/src/wixlib/DependencyExtension.wxs @@ -1,5 +1,4 @@ - - + @@ -7,16 +6,16 @@ - !(loc.msierrDependencyMissingDependencies) - !(loc.msierrDependencyHasDependents) + + - + - + diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi index 299a93eb..68dec471 100644 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -1,29 +1,28 @@ - - + - + - + - - + + - + - + - - + + - + diff --git a/src/wixlib/DependencyExtension_arm.wxs b/src/wixlib/DependencyExtension_arm.wxs deleted file mode 100644 index d4ba33a3..00000000 --- a/src/wixlib/DependencyExtension_arm.wxs +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/wixlib/DependencyExtension_arm64.wxs b/src/wixlib/DependencyExtension_arm64.wxs index 36e023e7..958650e6 100644 --- a/src/wixlib/DependencyExtension_arm64.wxs +++ b/src/wixlib/DependencyExtension_arm64.wxs @@ -1,5 +1,4 @@ - - + diff --git a/src/wixlib/DependencyExtension_x64.wxs b/src/wixlib/DependencyExtension_x64.wxs index 8298bce6..4fe458e8 100644 --- a/src/wixlib/DependencyExtension_x64.wxs +++ b/src/wixlib/DependencyExtension_x64.wxs @@ -1,5 +1,4 @@ - - + diff --git a/src/wixlib/DependencyExtension_x86.wxs b/src/wixlib/DependencyExtension_x86.wxs index 715eba02..d8ac6785 100644 --- a/src/wixlib/DependencyExtension_x86.wxs +++ b/src/wixlib/DependencyExtension_x86.wxs @@ -1,5 +1,4 @@ - - + diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi index 1d00df8f..b1711518 100644 --- a/src/wixlib/caDecor.wxi +++ b/src/wixlib/caDecor.wxi @@ -1,40 +1,39 @@ - - + - + - + - + - + - + - + - + - + - + diff --git a/src/wixlib/caerr.wxi b/src/wixlib/caerr.wxi index 141942f2..ff7ec121 100644 --- a/src/wixlib/caerr.wxi +++ b/src/wixlib/caerr.wxi @@ -1,4 +1,4 @@ - + diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index f7ba0f79..b978a34e 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -4,12 +4,18 @@ Library true + 1086 en-us - + + + + + + diff --git a/src/wixlib/en-us.wxl b/src/wixlib/en-us.wxl index ce29a153..6ad7d63d 100644 --- a/src/wixlib/en-us.wxl +++ b/src/wixlib/en-us.wxl @@ -1,5 +1,4 @@ - - + -- cgit v1.2.3-55-g6feb From 55c0f1c53f7ef89553733658a33f4f36b1731ad1 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 27 Oct 2020 15:58:15 -0400 Subject: Update project for Package/SummaryInformation change (and others). --- global.json | 2 +- .../WixToolsetTest.Dependency/DependencyExtensionFixture.cs | 1 - .../TestData/UsingProvides/Package.wxs | 11 +++++------ src/wixext/DependencyCompiler.cs | 3 +-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/global.json b/global.json index 4d9df50b..f94ab6df 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0157" + "WixToolset.Sdk": "4.0.0-build-0162" } } diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 67072e36..0f729534 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -2,7 +2,6 @@ namespace WixToolsetTest.Dependency { - using System.Linq; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using WixToolset.Dependency; diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs index 68ff98fd..44820bdd 100644 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -1,16 +1,15 @@ - - - - + + + - + - + diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 4aaa373b..18bb89df 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -4,7 +4,6 @@ namespace WixToolset.Dependency { using System; using System.Collections.Generic; - using System.Globalization; using System.Text; using System.Xml.Linq; using WixToolset.Data; @@ -76,7 +75,7 @@ namespace WixToolset.Dependency case "Bundle": case "Fragment": case "Module": - case "Product": + case "Package": switch (element.Name.LocalName) { case "Requires": -- cgit v1.2.3-55-g6feb From 09324a9198ca3d63cd5006f18508efde23e05a71 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 31 Oct 2020 22:01:31 -0400 Subject: Strong-name sign WiX assemblies. --- global.json | 2 +- src/CSharp.Build.props | 11 +++++++++++ src/Directory.Build.props | 1 + src/wix.snk | Bin 0 -> 596 bytes 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/CSharp.Build.props create mode 100644 src/wix.snk diff --git a/global.json b/global.json index f94ab6df..10345833 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0162" + "WixToolset.Sdk": "4.0.0-build-0163" } } diff --git a/src/CSharp.Build.props b/src/CSharp.Build.props new file mode 100644 index 00000000..b12f4c6e --- /dev/null +++ b/src/CSharp.Build.props @@ -0,0 +1,11 @@ + + + + + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a22f4470..f83cc154 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,6 +22,7 @@ WiX Toolset + diff --git a/src/wix.snk b/src/wix.snk new file mode 100644 index 00000000..3908a66a Binary files /dev/null and b/src/wix.snk differ -- cgit v1.2.3-55-g6feb From 3adccec4a07610a87df53d718f679a0de48716ef Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 4 Dec 2020 17:09:05 -0600 Subject: xsd got moved to doc repo. Update dependencies. --- global.json | 2 +- src/ca/dependencyca.vcxproj | 8 +- src/ca/packages.config | 4 +- src/wixext/Dependency.xsd | 226 ------------------------- src/wixext/WixToolset.Dependency.wixext.csproj | 3 +- src/wixlib/dependency.wixproj | 2 +- 6 files changed, 9 insertions(+), 236 deletions(-) delete mode 100644 src/wixext/Dependency.xsd diff --git a/global.json b/global.json index 10345833..77a81322 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0163" + "WixToolset.Sdk": "4.0.0-build-0170" } } diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index ad01a82f..6cc0d24e 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -1,8 +1,8 @@ - - + + Debug @@ -62,7 +62,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + \ No newline at end of file diff --git a/src/ca/packages.config b/src/ca/packages.config index e3dc0e43..9d88f529 100644 --- a/src/ca/packages.config +++ b/src/ca/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/wixext/Dependency.xsd b/src/wixext/Dependency.xsd deleted file mode 100644 index 0c36cb88..00000000 --- a/src/wixext/Dependency.xsd +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - The source code schema for the WiX Toolset Dependency Extension. - - - - - - Describes the information for this product or feature that serves as a dependency of other products or features. - - - - - - - - - - This element is required for any product, feature, or bundle that will use the Dependency feature to properly reference count - other products or features. It should be authored into a component that is always installed and removed with the - product or features that contain it. This guarantees that product dependencies are not removed before those products that - depend on them. - - - The @Key attribute should identify a version range for your product that you guarantee will be backward compatible. - This key is designed to persist throughout compatible upgrades so that dependent products do not have to be reinstalled - and will not prevent your product from being upgraded. If this attribute is not authored, the value is the ProductCode - and will not automatically support upgrades. - - - By default this uses the Product/@Id attribute value, which may be automatically generated. - - - How To: Author product dependencies - - - - - - - - - - - Dependency provider identity. If this attribute is not specified, an identifier will be generated automatically. - - - - - - - Optional unique registry key name that identifies a product version range on which other products can depend. - This attribute is required in package authoring, but optional for components. - - - - - - - The version of the package. For MSI packages, the ProductVersion will be used by default - and this attribute should not be specified. - - - - - - - Optional display name of the package. For MSI packages, the ProductName will be used by default. - - - - - - - - - Describes a dependency on a provider for the current component or package. - - - - - - - - - This element declares a dependency on any product that uses the Provides element. If that product is uninstalled - before a product that requires it, the uninstall will err or warn the user that other products are installed - which depend on that product. This behavior can be modified by changing the attribute values on the Requires element. - - - If you do not nest this element under a Provides element, you must specify the @Id attribute - so that it can be referenced by a RequiresRef element nested under a Provides element. - - - - How To: Author product dependencies - - - - - - - Dependency requirement identity. If this attribute is not specified, an identifier will be generated automatically. - If this element is not authored under a Provides element, this attribute is required. - - - - - - - The unique registry key name for the dependency provider to require during installation of this product. - - - - - - - The minimum version of the dependency provider required to be installed. The default is unbound. - - - - - - - The maximum version of the dependency provider required to be installed. The default is unbound. - - - - - - - Set to "yes" to make the range of dependency provider versions required include the value specified in Minimum. - - - - - - - Set to "yes" to make the range of dependency provider versions required include the value specified in Maximum. - - - - - - - - - References existing authoring for a dependency on a provider for the current component or package. - - - - - This element references a dependency on any product that uses the Provides element. If that product is uninstalled - before a product that requires it, the uninstall will err or warn the user that other products are installed - which depend on that product. This behavior can be modified by changing the attribute values on the Requires element. - - - - How To: Author product dependencies - - - - - - - The identifier of the Requires element to reference. - - - - - - - - - Optional attribute to explicitly author the provider key for the entire bundle. - - - - - - This provider key is designed to persist throughout compatible upgrades so that dependent bundles do not have to be reinstalled - and will not prevent your product from being upgraded. If this attribute is not authored, the value is the - automatically-generated bundle ID and will not automatically support upgrades. - - - Only a single provider key is supported for bundles. To author that your bundle provides additional features via - packages, author different provider keys for your packages. - - - - - - - - - - Values of this type will look like: "x.x.x.x" where x is an integer from 0 to 65534. - This can also be a preprocessor, binder, or WiX variable. - - - - - - - - - - Values of this type will either be "yes" or "no". - - - - - - - - diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj index 0221c1c6..9fac8aae 100644 --- a/src/wixext/WixToolset.Dependency.wixext.csproj +++ b/src/wixext/WixToolset.Dependency.wixext.csproj @@ -13,7 +13,6 @@ - @@ -27,6 +26,6 @@ - + diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index b978a34e..6a04e2a4 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -22,7 +22,7 @@ - + -- cgit v1.2.3-55-g6feb From f217241ff291dc53abefe3ba551d16b120d5a7aa Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Feb 2021 07:49:13 -0800 Subject: Minor custom action optimization --- src/ca/wixdepca.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ca/wixdepca.cpp b/src/ca/wixdepca.cpp index 154b73f2..d6433707 100644 --- a/src/ca/wixdepca.cpp +++ b/src/ca/wixdepca.cpp @@ -278,6 +278,16 @@ static HRESULT EnsureAbsentDependents( UINT cDependents = 0; PMSIHANDLE hDependencyRec = NULL; + // Skip the dependent check if the WixDependencyProvider table is missing (no dependency providers). + hr = WcaTableExists(L"WixDependencyProvider"); + if (S_FALSE == hr) + { + WcaLog(LOGMSG_STANDARD, "Skipping the dependents check since no dependency providers are authored."); + ExitFunction1(hr = S_OK); + } + + ExitOnFailure(hr, "Failed to check if the WixDependencyProvider table exists."); + // Split the IGNOREDEPENDENCIES property for use below if set. If it is "ALL", then quit now. hr = SplitIgnoredDependents(&sdIgnoredDependents); ExitOnFailure(hr, "Failed to get the ignored dependents."); @@ -297,16 +307,6 @@ static HRESULT EnsureAbsentDependents( hr = S_OK; } - // Skip the dependent check if the WixDependencyProvider table is missing (no dependency providers). - hr = WcaTableExists(L"WixDependencyProvider"); - if (S_FALSE == hr) - { - WcaLog(LOGMSG_STANDARD, "Skipping the dependents check since no dependency providers are authored."); - ExitFunction(); - } - - ExitOnFailure(hr, "Failed to check if the WixDependencyProvider table exists."); - // Set the registry hive to use depending on install context. hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; -- cgit v1.2.3-55-g6feb From 3fae69ccb71d99c79adba6855ba7d6402216085d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Feb 2021 07:50:33 -0800 Subject: Integrate Dependency into Core Only the custom action handling is left in Dependency.wixext Partially fixes wixtoolset/issues#5945 --- global.json | 2 +- .../DependencyExtensionFixture.cs | 3 +- .../TestData/UsingProvides/Package.wxs | 23 +- .../TestData/UsingProvides/PackageComponents.wxs | 12 - .../TestData/UsingProvides/example.txt | 1 - .../WixToolsetTest.Dependency.csproj | 5 +- src/wixext/DependencyCommon.cs | 26 - src/wixext/DependencyCompiler.cs | 542 +-------------------- src/wixext/DependencyErrors.cs | 37 -- src/wixext/DependencyExtensionData.cs | 11 +- src/wixext/DependencyExtensionFactory.cs | 1 - src/wixext/DependencyTableDefinitions.cs | 57 --- src/wixext/DependencyWarnings.cs | 60 --- ...ndencyWindowsInstallerBackendBinderExtension.cs | 168 ------- src/wixext/Symbols/DependencySymbolDefinitions.cs | 43 -- src/wixext/Symbols/WixDependencyRefSymbol.cs | 55 --- src/wixext/Symbols/WixDependencySymbol.cs | 71 --- 17 files changed, 33 insertions(+), 1084 deletions(-) delete mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs delete mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt delete mode 100644 src/wixext/DependencyCommon.cs delete mode 100644 src/wixext/DependencyErrors.cs delete mode 100644 src/wixext/DependencyTableDefinitions.cs delete mode 100644 src/wixext/DependencyWarnings.cs delete mode 100644 src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs delete mode 100644 src/wixext/Symbols/DependencySymbolDefinitions.cs delete mode 100644 src/wixext/Symbols/WixDependencyRefSymbol.cs delete mode 100644 src/wixext/Symbols/WixDependencySymbol.cs diff --git a/global.json b/global.json index 77a81322..8b252932 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0170" + "WixToolset.Sdk": "4.0.0-build-0191" } } diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 0f729534..968b8de6 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -15,9 +15,10 @@ namespace WixToolsetTest.Dependency var folder = TestData.Get(@"TestData\UsingProvides"); var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); - var results = build.BuildAndQuery(Build, "WixDependencyProvider"); + var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider"); Assert.Equal(new[] { + "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t", "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", }, results); } diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs index 44820bdd..b15ae8da 100644 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -1,21 +1,16 @@ - + - - - + + - + + + + - - - - - - - - - + diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs deleted file mode 100644 index e241fb17..00000000 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/PackageComponents.wxs +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt deleted file mode 100644 index 1b4ffe8a..00000000 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/example.txt +++ /dev/null @@ -1 +0,0 @@ -This is example.txt. \ No newline at end of file diff --git a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj index 7bedc47d..2d3e40c3 100644 --- a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj +++ b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj @@ -12,10 +12,7 @@ - - - - + diff --git a/src/wixext/DependencyCommon.cs b/src/wixext/DependencyCommon.cs deleted file mode 100644 index cb36be36..00000000 --- a/src/wixext/DependencyCommon.cs +++ /dev/null @@ -1,26 +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 WixToolset.Dependency -{ - using System; - using WixToolset; - - internal static class DependencyCommon - { - // Bundle attributes are in the upper 32-bits. - internal const int ProvidesAttributesBundle = 0x10000; - - // Same values as for the Upgrade table in Windows Installer. - internal const int RequiresAttributesMinVersionInclusive = 256; - internal const int RequiresAttributesMaxVersionInclusive = 512; - - // The root registry key for the dependency extension. We write to Software\Classes explicitly - // based on the current security context instead of HKCR. See - // http://msdn.microsoft.com/en-us/library/ms724475(VS.85).aspx for more information. - internal static readonly string RegistryRoot = @"Software\Classes\Installer\Dependencies\"; - internal static readonly string RegistryDependents = "Dependents"; - - // The following characters cannot be used in a provider key. - internal static readonly char[] InvalidCharacters = new char[] { ' ', '\"', ';', '\\' }; - } -} diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 18bb89df..0405c324 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -2,13 +2,9 @@ namespace WixToolset.Dependency { - using System; using System.Collections.Generic; - using System.Text; using System.Xml.Linq; using WixToolset.Data; - using WixToolset.Data.Symbols; - using WixToolset.Dependency.Symbols; using WixToolset.Extensibility; using WixToolset.Extensibility.Data; @@ -17,18 +13,6 @@ namespace WixToolset.Dependency /// public sealed class DependencyCompiler : BaseCompilerExtension { - /// - /// Package type when parsing the Provides element. - /// - private enum PackageType - { - None, - ExePackage, - MsiPackage, - MspPackage, - MsuPackage - } - public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/dependency"; /// @@ -40,534 +24,38 @@ namespace WixToolset.Dependency public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); - switch (parentElement.Name.LocalName) - { - case "Bundle": - switch (attribute.Name.LocalName) - { - case "ProviderKey": - this.ParseProviderKeyAttribute(section, sourceLineNumbers, parentElement, attribute); - break; - default: - this.ParseHelper.UnexpectedAttribute(parentElement, attribute); - break; - } - break; - default: - this.ParseHelper.UnexpectedAttribute(parentElement, attribute); - break; - } - } - - /// - /// Processes an element for the Compiler. - /// - /// Source line number for the parent element. - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. - public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) - { - var packageType = PackageType.None; + var addCheck = YesNoType.NotSet; + var addRequire = YesNoType.NotSet; switch (parentElement.Name.LocalName) { - case "Bundle": - case "Fragment": - case "Module": - case "Package": - switch (element.Name.LocalName) + case "Provides": + if (attribute.Name.LocalName == "Check" && parentElement.Parent.Name.LocalName == "Component") { - case "Requires": - this.ParseRequiresElement(intermediate, section, element, null, false); - break; - default: - this.ParseHelper.UnexpectedElement(parentElement, element); - break; + addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } break; - case "ExePackage": - packageType = PackageType.ExePackage; - break; - case "MsiPackage": - packageType = PackageType.MsiPackage; - break; - case "MspPackage": - packageType = PackageType.MspPackage; - break; - case "MsuPackage": - packageType = PackageType.MsuPackage; - break; - default: - this.ParseHelper.UnexpectedElement(parentElement, element); - break; - } - - if (PackageType.None != packageType) - { - var packageId = context["PackageId"]; - - switch (element.Name.LocalName) - { - case "Provides": - this.ParseProvidesElement(intermediate, section, element, packageType, packageId); - break; - default: - this.ParseHelper.UnexpectedElement(parentElement, element); - break; - } - } - } - - /// - /// Processes a child element of a Component for the Compiler. - /// - /// Parent element of element to process. - /// Element to process. - /// Extra information about the context in which this element is being parsed. - /// The component key path type if set. - public override IComponentKeyPath ParsePossibleKeyPathElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary context) - { - var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); - IComponentKeyPath keyPath = null; - - switch (parentElement.Name.LocalName) - { - case "Component": - var componentId = context["ComponentId"]; - - // 64-bit components may cause issues downlevel. - Boolean.TryParse(context["Win64"], out var win64); - - switch (element.Name.LocalName) + case "Requires": + case "RequiresRef": + if (attribute.Name.LocalName == "Enforce" && parentElement.Parent.Name.LocalName == "Component") { - case "Provides": - if (win64) - { - this.Messaging.Write(DependencyWarnings.Win64Component(sourceLineNumbers, componentId)); - } - - keyPath = this.ParseProvidesElement(intermediate, section, element, PackageType.None, componentId); - break; - default: - this.ParseHelper.UnexpectedElement(parentElement, element); - break; + addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } break; - default: - this.ParseHelper.UnexpectedElement(parentElement, element); - break; - } - - return keyPath; - } - - /// - /// Processes the ProviderKey bundle attribute. - /// - /// Source line number for the parent element. - /// Parent element of attribute. - /// The XML attribute for the ProviderKey attribute. - private void ParseProviderKeyAttribute(IntermediateSection section, SourceLineNumber sourceLineNumbers, XElement parentElement, XAttribute attribute) - { - Identifier id = null; - string providerKey = null; - int illegalChar = -1; - - switch (attribute.Name.LocalName) - { - case "ProviderKey": - providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attribute); - break; - default: - this.ParseHelper.UnexpectedAttribute(parentElement, attribute); - break; - } - - // Make sure the key does not contain any illegal characters or values. - if (String.IsNullOrEmpty(providerKey)) - { - this.Messaging.Write(ErrorMessages.IllegalEmptyAttributeValue(sourceLineNumbers, parentElement.Name.LocalName, attribute.Name.LocalName)); } - else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) - { - var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); - Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); - } - else if ("ALL" == providerKey) + if (addCheck == YesNoType.NotSet && addRequire == YesNoType.NotSet) { - this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, parentElement.Name.LocalName, "ProviderKey", providerKey)); + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); } - - // Generate the primary key for the row. - id = this.ParseHelper.CreateIdentifier("dep", attribute.Name.LocalName, providerKey); - - if (!this.Messaging.EncounteredError) + else if (addCheck == YesNoType.Yes) { - // Create the provider symbol for the bundle. The Component_ field is required - // in the table definition but unused for bundles, so just set it to the valid ID. - section.AddSymbol(new WixDependencyProviderSymbol(sourceLineNumbers, id) - { - ComponentRef = id.Id, - ProviderKey = providerKey, - Attributes = WixDependencyProviderAttributes.ProvidesAttributesBundle, - }); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); } - } - - /// - /// Processes the Provides element. - /// - /// The XML node for the Provides element. - /// The type of the package being chained into a bundle, or "None" if building an MSI package. - /// Explicit key path. - /// The identifier of the parent component or package. - /// The type of key path if set. - private IComponentKeyPath ParseProvidesElement(Intermediate intermediate, IntermediateSection section, XElement node, PackageType packageType, string parentId) - { - var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); - IComponentKeyPath keyPath = null; - Identifier id = null; - string key = null; - string version = null; - string displayName = null; - int illegalChar = -1; - - foreach (var attrib in node.Attributes()) + else if (addRequire == YesNoType.Yes) { - if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) - { - switch (attrib.Name.LocalName) - { - case "Id": - id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); - break; - case "Key": - key = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Version": - version = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); - break; - case "DisplayName": - displayName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); - break; - default: - this.ParseHelper.UnexpectedAttribute(node, attrib); - break; - } - } - else - { - this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); - } + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); } - - // Make sure the key is valid. The key will default to the ProductCode for MSI packages - // and the package code for MSP packages in the binder if not specified. - if (!String.IsNullOrEmpty(key)) - { - // Make sure the key does not contain any illegal characters or values. - if (0 <= (illegalChar = key.IndexOfAny(DependencyCommon.InvalidCharacters))) - { - var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); - Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - - this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "Key", key[illegalChar], sb.ToString())); - } - else if ("ALL" == key) - { - this.Messaging.Write(DependencyErrors.ReservedValue(sourceLineNumbers, node.Name.LocalName, "Key", key)); - } - } - else if (PackageType.ExePackage == packageType || PackageType.MsuPackage == packageType) - { - // Must specify the provider key when authored for a package. - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); - } - else if (PackageType.None == packageType) - { - // Make sure the ProductCode is authored and set the key. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.Property, "ProductCode"); - key = "!(bind.property.ProductCode)"; - } - - // The Version attribute should not be authored in or for an MSI package. - if (!String.IsNullOrEmpty(version)) - { - switch (packageType) - { - case PackageType.None: - this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers)); - break; - case PackageType.MsiPackage: - this.Messaging.Write(DependencyWarnings.DiscouragedVersionAttribute(sourceLineNumbers, parentId)); - break; - } - } - else if (PackageType.MspPackage == packageType || PackageType.MsuPackage == packageType) - { - // Must specify the Version when authored for packages that do not contain a version. - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); - } - - // Need the element ID for child element processing, so generate now if not authored. - if (null == id) - { - id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, parentId, key); - } - - foreach (var child in node.Elements()) - { - if (this.Namespace == child.Name.Namespace) - { - switch (child.Name.LocalName) - { - case "Requires": - this.ParseRequiresElement(intermediate, section, child, id.Id, PackageType.None == packageType); - break; - case "RequiresRef": - this.ParseRequiresRefElement(intermediate, section, child, id.Id, PackageType.None == packageType); - break; - default: - this.ParseHelper.UnexpectedElement(node, child); - break; - } - } - else - { - this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, node, child); - } - } - - if (!this.Messaging.EncounteredError) - { - var symbol = section.AddSymbol(new WixDependencyProviderSymbol(sourceLineNumbers, id) - { - ComponentRef = parentId, - ProviderKey = key, - }); - - if (!String.IsNullOrEmpty(version)) - { - symbol.Version = version; - } - - if (!String.IsNullOrEmpty(displayName)) - { - symbol.DisplayName = displayName; - } - - if (PackageType.None == packageType) - { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); - - // Generate registry rows for the provider using binder properties. - var keyProvides = String.Concat(DependencyCommon.RegistryRoot, key); - var root = RegistryRootType.MachineUser; - - var value = "[ProductCode]"; - this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, null, value, parentId, false); - - value = !String.IsNullOrEmpty(version) ? version : "[ProductVersion]"; - var versionRegistrySymbol = - this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, "Version", value, parentId, false); - - value = !String.IsNullOrEmpty(displayName) ? displayName : "[ProductName]"; - this.ParseHelper.CreateRegistrySymbol(section, sourceLineNumbers, root, keyProvides, "DisplayName", value, parentId, false); - - // Use the Version registry value and use that as a potential key path. - keyPath = this.CreateComponentKeyPath(); - keyPath.Id = versionRegistrySymbol.Id; - keyPath.Explicit = false; - keyPath.Type = PossibleKeyPathType.Registry; - } - } - - return keyPath; - } - - /// - /// Processes the Requires element. - /// - /// The XML node for the Requires element. - /// The parent provider identifier. - /// Whether the Requires custom action should be referenced. - private void ParseRequiresElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) - { - var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); - Identifier id = null; - string providerKey = null; - string minVersion = null; - string maxVersion = null; - int attributes = 0; - int illegalChar = -1; - - foreach (var attrib in node.Attributes()) - { - if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) - { - switch (attrib.Name.LocalName) - { - case "Id": - id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib); - break; - case "ProviderKey": - providerKey = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); - break; - case "Minimum": - minVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); - break; - case "Maximum": - maxVersion = this.ParseHelper.GetAttributeVersionValue(sourceLineNumbers, attrib); - break; - case "IncludeMinimum": - if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= DependencyCommon.RequiresAttributesMinVersionInclusive; - } - break; - case "IncludeMaximum": - if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) - { - attributes |= DependencyCommon.RequiresAttributesMaxVersionInclusive; - } - break; - default: - this.ParseHelper.UnexpectedAttribute(node, attrib); - break; - } - } - else - { - this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); - } - } - - this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); - - if (null == id) - { - // Generate an ID only if this element is authored under a Provides element; otherwise, a RequiresRef - // element will be necessary and the Id attribute will be required. - if (!String.IsNullOrEmpty(providerId)) - { - id = this.ParseHelper.CreateIdentifier("dep", node.Name.LocalName, providerKey); - } - else - { - this.Messaging.Write(ErrorMessages.ExpectedAttributeWhenElementNotUnderElement(sourceLineNumbers, node.Name.LocalName, "Id", "Provides")); - id = Identifier.Invalid; - } - } - - if (String.IsNullOrEmpty(providerKey)) - { - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProviderKey")); - } - // Make sure the key does not contain any illegal characters. - else if (0 <= (illegalChar = providerKey.IndexOfAny(DependencyCommon.InvalidCharacters))) - { - var sb = new StringBuilder(DependencyCommon.InvalidCharacters.Length * 2); - Array.ForEach(DependencyCommon.InvalidCharacters, c => sb.Append(c).Append(" ")); - - this.Messaging.Write(DependencyErrors.IllegalCharactersInProvider(sourceLineNumbers, "ProviderKey", providerKey[illegalChar], sb.ToString())); - } - - if (!this.Messaging.EncounteredError) - { - // Reference the Require custom action if required. - if (requiresAction) - { - this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers); - } - - var symbol = section.AddSymbol(new WixDependencySymbol(sourceLineNumbers, id) - { - ProviderKey = providerKey, - MinVersion = minVersion, - MaxVersion = maxVersion, - }); - - if (0 != attributes) - { - symbol.Attributes = attributes; - } - - // Create the relationship between this WixDependency symbol and the WixDependencyProvider symbol. - if (!String.IsNullOrEmpty(providerId)) - { - section.AddSymbol(new WixDependencyRefSymbol(sourceLineNumbers) - { - WixDependencyProviderRef = providerId, - WixDependencyRef = id.Id, - }); - } - } - } - - /// - /// Processes the RequiresRef element. - /// - /// The XML node for the RequiresRef element. - /// The parent provider identifier. - /// Whether the Requires custom action should be referenced. - private void ParseRequiresRefElement(Intermediate intermediate, IntermediateSection section, XElement node, string providerId, bool requiresAction) - { - var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); - string id = null; - - foreach (var attrib in node.Attributes()) - { - if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace) - { - switch (attrib.Name.LocalName) - { - case "Id": - id = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); - break; - default: - this.ParseHelper.UnexpectedAttribute(node, attrib); - break; - } - } - else - { - this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib); - } - } - - this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node); - - if (String.IsNullOrEmpty(id)) - { - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id")); - } - - if (!this.Messaging.EncounteredError) - { - // Reference the Require custom action if required. - if (requiresAction) - { - this.AddReferenceToWixDependencyRequire(section, sourceLineNumbers); - } - - // Create a link dependency on the row that contains information we'll need during bind. - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, DependencySymbolDefinitions.WixDependency, id); - - // Create the relationship between the WixDependency row and the parent WixDependencyProvider row. - section.AddSymbol(new WixDependencyRefSymbol(sourceLineNumbers) - { - WixDependencyProviderRef = providerId, - WixDependencyRef = id, - }); - } - } - - private void AddReferenceToWixDependencyRequire(IntermediateSection section, SourceLineNumber sourceLineNumbers) - { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); } } } diff --git a/src/wixext/DependencyErrors.cs b/src/wixext/DependencyErrors.cs deleted file mode 100644 index 83c0986a..00000000 --- a/src/wixext/DependencyErrors.cs +++ /dev/null @@ -1,37 +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 WixToolset.Dependency -{ - using System; - using System.Resources; - using WixToolset.Data; - - public static class DependencyErrors - { - public static Message IllegalCharactersInProvider(SourceLineNumber sourceLineNumbers, string attributeName, Char illegalChar, string illegalChars) - { - return Message(sourceLineNumbers, Ids.IllegalCharactersInProvider, "The provider key authored into the {0} attribute contains an illegal character, '{1}'. Please author the provider key without any of the following characters: {2}", attributeName, illegalChar, illegalChars); - } - - public static Message ReservedValue(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string attributeValue) - { - return Message(sourceLineNumbers, Ids.ReservedValue, "The {0}/@{1} attribute value '{2}' is reserved and cannot be used here. Please choose a different value.", elementName, attributeName, attributeValue); - } - - private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) - { - return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); - } - - private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) - { - return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args); - } - - public enum Ids - { - IllegalCharactersInProvider = 5400, - ReservedValue = 5401, - } - } -} diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs index e7d8746c..2f30c2bf 100644 --- a/src/wixext/DependencyExtensionData.cs +++ b/src/wixext/DependencyExtensionData.cs @@ -16,12 +16,11 @@ namespace WixToolset.Dependency /// The default culture. public override string DefaultCulture => "en-US"; - public override bool TryGetSymbolDefinitionByName(string name, out IntermediateSymbolDefinition symbolDefinition) - { - symbolDefinition = DependencySymbolDefinitions.ByName(name); - return symbolDefinition != null; - } - + /// + /// Gets the contained .wixlib content. + /// + /// Strong typed symbold definitions. + /// The .wixlib. public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) { return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", symbolDefinitions); diff --git a/src/wixext/DependencyExtensionFactory.cs b/src/wixext/DependencyExtensionFactory.cs index c5b89658..354f9234 100644 --- a/src/wixext/DependencyExtensionFactory.cs +++ b/src/wixext/DependencyExtensionFactory.cs @@ -12,7 +12,6 @@ namespace WixToolset.Dependency { typeof(DependencyCompiler), typeof(DependencyExtensionData), - typeof(DependencyWindowsInstallerBackendBinderExtension), }; } } diff --git a/src/wixext/DependencyTableDefinitions.cs b/src/wixext/DependencyTableDefinitions.cs deleted file mode 100644 index d3f643e4..00000000 --- a/src/wixext/DependencyTableDefinitions.cs +++ /dev/null @@ -1,57 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Data.WindowsInstaller; - - public static class DependencyTableDefinitions - { - public static readonly TableDefinition WixDependencyProvider = new TableDefinition( - "WixDependencyProvider", - SymbolDefinitions.WixDependencyProvider, - new[] - { - new ColumnDefinition("WixDependencyProvider", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("Component_", ColumnType.String, 72, primaryKey: false, nullable: false, ColumnCategory.Identifier, keyTable: "Component", keyColumn: 1, description: "The foreign key into the Component table used to determine install state.", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."), - new ColumnDefinition("Version", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The version of the package."), - new ColumnDefinition("DisplayName", ColumnType.String, 255, primaryKey: false, nullable: true, ColumnCategory.Text, description: "The display name of the package."), - new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), - }, - symbolIdIsPrimaryKey: true - ); - - public static readonly TableDefinition WixDependency = new TableDefinition( - "WixDependency", - DependencySymbolDefinitions.WixDependency, - new[] - { - new ColumnDefinition("WixDependency", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, description: "The non-localized primary key for the table.", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("ProviderKey", ColumnType.String, 255, primaryKey: false, nullable: false, ColumnCategory.Text, description: "The name of the registry key that holds the provider identity."), - new ColumnDefinition("MinVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The minimum version of the provider supported."), - new ColumnDefinition("MaxVersion", ColumnType.String, 72, primaryKey: false, nullable: true, ColumnCategory.Version, description: "The maximum version of the provider supported."), - new ColumnDefinition("Attributes", ColumnType.Number, 4, primaryKey: false, nullable: true, ColumnCategory.Unknown, minValue: 0, maxValue: 2147483647, description: "A 32-bit word that specifies the attribute flags to be applied."), - }, - symbolIdIsPrimaryKey: true - ); - - public static readonly TableDefinition WixDependencyRef = new TableDefinition( - "WixDependencyRef", - DependencySymbolDefinitions.WixDependencyRef, - new[] - { - new ColumnDefinition("WixDependencyProvider_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependencyProvider", keyColumn: 1, description: "Foreign key into the Component table.", modularizeType: ColumnModularizeType.Column), - new ColumnDefinition("WixDependency_", ColumnType.String, 72, primaryKey: true, nullable: false, ColumnCategory.Identifier, keyTable: "WixDependency", keyColumn: 1, description: "Foreign key into the WixDependency table.", modularizeType: ColumnModularizeType.Column), - }, - symbolIdIsPrimaryKey: false - ); - - public static readonly TableDefinition[] All = new[] - { - WixDependencyProvider, - WixDependency, - WixDependencyRef, - }; - } -} diff --git a/src/wixext/DependencyWarnings.cs b/src/wixext/DependencyWarnings.cs deleted file mode 100644 index 802edc22..00000000 --- a/src/wixext/DependencyWarnings.cs +++ /dev/null @@ -1,60 +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 WixToolset.Dependency -{ - using System; - using System.Resources; - using WixToolset.Data; - - public static class DependencyWarnings - { - public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers) - { - return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified in an MSI package. The ProductVersion will be used by default."); - } - - public static Message DiscouragedVersionAttribute(SourceLineNumber sourceLineNumbers, string id) - { - return Message(sourceLineNumbers, Ids.DiscouragedVersionAttribute, "The Provides/@Version attribute should not be specified for MSI package {0}. The ProductVersion will be used by default.", id); - } - - public static Message PropertyRemoved(string name) - { - return Message(null, Ids.PropertyRemoved, "The property {0} was authored in the package with a value and will be removed. The property should not be authored.", name); - } - - public static Message ProvidesKeyNotFound(SourceLineNumber sourceLineNumbers, string id) - { - return Message(sourceLineNumbers, Ids.ProvidesKeyNotFound, "The provider key with identifier {0} was not found in the WixDependencyProvider table. Related registry rows will not be removed from authoring.", id); - } - - public static Message RequiresKeyNotFound(SourceLineNumber sourceLineNumbers, string id) - { - return Message(sourceLineNumbers, Ids.RequiresKeyNotFound, "The dependency key with identifier {0} was not found in the WixDependency table. Related registry rows will not be removed from authoring.", id); - } - - public static Message Win64Component(SourceLineNumber sourceLineNumbers, string componentId) - { - return Message(sourceLineNumbers, Ids.Win64Component, "The Provides element should not be authored in the 64-bit component with identifier {0}. The dependency feature may not work if installing this package on 64-bit Windows operating systems prior to Windows 7 and Windows Server 2008 R2. Set the Component/@Win64 attribute to \"no\" to make sure the dependency feature works correctly on all supported operating systems.", componentId); - } - - private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) - { - return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, format, args); - } - - private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args) - { - return new Message(sourceLineNumber, MessageLevel.Warning, (int)id, resourceManager, resourceName, args); - } - - public enum Ids - { - ProvidesKeyNotFound = 5431, - RequiresKeyNotFound = 5432, - PropertyRemoved = 5433, - DiscouragedVersionAttribute = 5434, - Win64Component = 5435, - } - } -} diff --git a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs b/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs deleted file mode 100644 index f52f97f3..00000000 --- a/src/wixext/DependencyWindowsInstallerBackendBinderExtension.cs +++ /dev/null @@ -1,168 +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 WixToolset.Dependency -{ - using System.Collections.Generic; - using WixToolset.Data.WindowsInstaller; - using WixToolset.Extensibility; - - public class DependencyWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension - { - public override IEnumerable TableDefinitions => DependencyTableDefinitions.All; - -#if TODO_DEPENDENCY_BINDER_EXTENSION - private Output output; - - /// - /// Called after all output changes occur and right before the output is bound into its final format. - /// - public void Finish(Output output) - { - // Only process MSI packages. - if (OutputType.Product != output.Type) - { - return; - } - - this.output = output; - - Table wixDependencyTable = output.Tables["WixDependency"]; - Table wixDependencyProviderTable = output.Tables["WixDependencyProvider"]; - Table wixDependencyRefTable = output.Tables["WixDependencyRef"]; - - // Make sure there's something to do. - if (null != wixDependencyRefTable) - { - KeyedRowCollection wixDependencyRows = new KeyedRowCollection(wixDependencyTable); - KeyedRowCollection wixDependencyProviderRows = new KeyedRowCollection(wixDependencyProviderTable); - - // For each relationship, get the provides and requires rows to generate registry values. - foreach (Row wixDependencyRefRow in wixDependencyRefTable.Rows) - { - string providesId = (string)wixDependencyRefRow[0]; - string requiresId = (string)wixDependencyRefRow[1]; - - Row wixDependencyRow = null; - if (wixDependencyRows.Contains(requiresId)) - { - wixDependencyRow = wixDependencyRows[requiresId]; - } - - Row wixDependencyProviderRow = null; - if (wixDependencyProviderRows.Contains(providesId)) - { - wixDependencyProviderRow = wixDependencyProviderRows[providesId]; - } - - // If we found both rows, generate the registry values. - if (null != wixDependencyRow && null != wixDependencyProviderRow) - { - // Format the root registry key using the required provider key and the current provider key. - string requiresKey = (string)wixDependencyRow[1]; - string providesKey = (string)wixDependencyProviderRow[2]; - string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); - - // Get the component ID from the provider. - string componentId = (string)wixDependencyProviderRow[1]; - - Row row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "(Default)"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "*"; - row[4] = null; - row[5] = componentId; - - string minVersion = (string)wixDependencyRow[2]; - if (!String.IsNullOrEmpty(minVersion)) - { - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MinVersion"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "MinVersion"; - row[4] = minVersion; - row[5] = componentId; - } - - string maxVersion = (string)wixDependencyRow[3]; - if (!String.IsNullOrEmpty(minVersion)) - { - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "MaxVersion"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "MaxVersion"; - row[4] = maxVersion; - row[5] = componentId; - } - - if (null != wixDependencyRow[4]) - { - int attributes = (int)wixDependencyRow[4]; - - row = this.CreateRegistryRow(wixDependencyRow); - row[0] = this.Core.CreateIdentifier("reg", providesId, requiresId, "Attributes"); - row[1] = -1; - row[2] = keyRequires; - row[3] = "Attributes"; - row[4] = String.Concat("#", attributes.ToString(CultureInfo.InvariantCulture.NumberFormat)); - row[5] = componentId; - } - } - } - } - } - - /// - /// Creates a registry row using source information from the given . - /// - /// The from which the section and source line information are retrieved. - /// A new Registry row. - private Row CreateRegistryRow(Row referenceRow) - { - TableDefinition tableDefinition = this.Core.TableDefinitions["Registry"]; - - // Create the row from the main tables, which were populated during link anyway. - // We still associate the table with the dependency row's section to maintain servicing. - Table table = this.output.EnsureTable(tableDefinition, referenceRow.Table.Section); - Row row = table.CreateRow(referenceRow.SourceLineNumbers); - - // Set the section ID for patching and return the new row. - row.SectionId = referenceRow.SectionId; - return row; - } - - /// - /// A keyed collection of instances for O(1) lookup. - /// - private sealed class KeyedRowCollection : KeyedCollection - { - /// - /// Initializes the class with all rows from the specified . - /// - /// The containing rows to index. - internal KeyedRowCollection(Table table) - { - if (null != table) - { - foreach (Row row in table.Rows) - { - this.Add(row); - } - } - } - - /// - /// Gets the primary key for the . - /// - /// The to index. - /// The primary key for the . - protected override string GetKeyForItem(Row row) - { - return row.GetPrimaryKey('/'); - } - } -#endif - } -} diff --git a/src/wixext/Symbols/DependencySymbolDefinitions.cs b/src/wixext/Symbols/DependencySymbolDefinitions.cs deleted file mode 100644 index 5a18ae4b..00000000 --- a/src/wixext/Symbols/DependencySymbolDefinitions.cs +++ /dev/null @@ -1,43 +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 WixToolset.Dependency -{ - using System; - using WixToolset.Data; - - public enum DependencySymbolDefinitionType - { - WixDependency, - WixDependencyRef, - } - - public static partial class DependencySymbolDefinitions - { - public static readonly Version Version = new Version("4.0.0"); - - public static IntermediateSymbolDefinition ByName(string name) - { - if (!Enum.TryParse(name, out DependencySymbolDefinitionType type)) - { - return null; - } - - return ByType(type); - } - - public static IntermediateSymbolDefinition ByType(DependencySymbolDefinitionType type) - { - switch (type) - { - case DependencySymbolDefinitionType.WixDependency: - return DependencySymbolDefinitions.WixDependency; - - case DependencySymbolDefinitionType.WixDependencyRef: - return DependencySymbolDefinitions.WixDependencyRef; - - default: - throw new ArgumentOutOfRangeException(nameof(type)); - } - } - } -} diff --git a/src/wixext/Symbols/WixDependencyRefSymbol.cs b/src/wixext/Symbols/WixDependencyRefSymbol.cs deleted file mode 100644 index 6f2aaadf..00000000 --- a/src/wixext/Symbols/WixDependencyRefSymbol.cs +++ /dev/null @@ -1,55 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Dependency.Symbols; - - public static partial class DependencySymbolDefinitions - { - public static readonly IntermediateSymbolDefinition WixDependencyRef = new IntermediateSymbolDefinition( - DependencySymbolDefinitionType.WixDependencyRef.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyProviderRef), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencyRefSymbolFields.WixDependencyRef), IntermediateFieldType.String), - }, - typeof(WixDependencyRefSymbol)); - } -} - -namespace WixToolset.Dependency.Symbols -{ - using WixToolset.Data; - - public enum WixDependencyRefSymbolFields - { - WixDependencyProviderRef, - WixDependencyRef, - } - - public class WixDependencyRefSymbol : IntermediateSymbol - { - public WixDependencyRefSymbol() : base(DependencySymbolDefinitions.WixDependencyRef, null, null) - { - } - - public WixDependencyRefSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependencyRef, sourceLineNumber, id) - { - } - - public IntermediateField this[WixDependencyRefSymbolFields index] => this.Fields[(int)index]; - - public string WixDependencyProviderRef - { - get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyProviderRef].AsString(); - set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyProviderRef, value); - } - - public string WixDependencyRef - { - get => this.Fields[(int)WixDependencyRefSymbolFields.WixDependencyRef].AsString(); - set => this.Set((int)WixDependencyRefSymbolFields.WixDependencyRef, value); - } - } -} \ No newline at end of file diff --git a/src/wixext/Symbols/WixDependencySymbol.cs b/src/wixext/Symbols/WixDependencySymbol.cs deleted file mode 100644 index 17c631c5..00000000 --- a/src/wixext/Symbols/WixDependencySymbol.cs +++ /dev/null @@ -1,71 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Dependency.Symbols; - - public static partial class DependencySymbolDefinitions - { - public static readonly IntermediateSymbolDefinition WixDependency = new IntermediateSymbolDefinition( - DependencySymbolDefinitionType.WixDependency.ToString(), - new[] - { - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.ProviderKey), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MinVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.MaxVersion), IntermediateFieldType.String), - new IntermediateFieldDefinition(nameof(WixDependencySymbolFields.Attributes), IntermediateFieldType.Number), - }, - typeof(WixDependencySymbol)); - } -} - -namespace WixToolset.Dependency.Symbols -{ - using WixToolset.Data; - - public enum WixDependencySymbolFields - { - ProviderKey, - MinVersion, - MaxVersion, - Attributes, - } - - public class WixDependencySymbol : IntermediateSymbol - { - public WixDependencySymbol() : base(DependencySymbolDefinitions.WixDependency, null, null) - { - } - - public WixDependencySymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(DependencySymbolDefinitions.WixDependency, sourceLineNumber, id) - { - } - - public IntermediateField this[WixDependencySymbolFields index] => this.Fields[(int)index]; - - public string ProviderKey - { - get => this.Fields[(int)WixDependencySymbolFields.ProviderKey].AsString(); - set => this.Set((int)WixDependencySymbolFields.ProviderKey, value); - } - - public string MinVersion - { - get => this.Fields[(int)WixDependencySymbolFields.MinVersion].AsString(); - set => this.Set((int)WixDependencySymbolFields.MinVersion, value); - } - - public string MaxVersion - { - get => this.Fields[(int)WixDependencySymbolFields.MaxVersion].AsString(); - set => this.Set((int)WixDependencySymbolFields.MaxVersion, value); - } - - public int Attributes - { - get => this.Fields[(int)WixDependencySymbolFields.Attributes].AsNumber(); - set => this.Set((int)WixDependencySymbolFields.Attributes, value); - } - } -} \ No newline at end of file -- cgit v1.2.3-55-g6feb From 1550b30702ae4e83ea8b30bf95a4f20a6424aa4b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Feb 2021 15:38:50 -0800 Subject: Include native .pdbs in .wixext.nupkg and refine build process --- appveyor.cmd | 17 +++++++---- src/Cpp.Build.props | 2 ++ src/FindLocalWix.props | 8 ----- src/ca/dependencyca.vcxproj | 35 +++++++++++++++------- src/ca/packages.config | 5 ---- .../WixToolsetTest.Dependency.csproj | 1 + src/wixext/WixToolset.Dependency.wixext.csproj | 15 +++++++--- src/wixlib/dependency.wixproj | 8 +++-- 8 files changed, 54 insertions(+), 37 deletions(-) delete mode 100644 src/FindLocalWix.props delete mode 100644 src/ca/packages.config diff --git a/appveyor.cmd b/appveyor.cmd index 6bb3b543..3450d535 100644 --- a/appveyor.cmd +++ b/appveyor.cmd @@ -1,14 +1,19 @@ @setlocal @pushd %~dp0 +@set _C=Release +@if /i "%1"=="debug" set _C=Debug -nuget restore || exit /b +:: Restore +msbuild -p:Configuration=%_C% -t:Restore || exit /b -msbuild -p:Configuration=Release -t:Restore || exit /b +:: Build +msbuild -p:Configuration=%_C% src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj || exit /b -msbuild -p:Configuration=Release src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj || exit /b -dotnet test -c Release --no-build src\test\WixToolsetTest.Dependency || exit /b +:: Test +dotnet test -c %_C% --no-build src\test\WixToolsetTest.Dependency || exit /b -msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj || exit /b +:: Pack +msbuild -p:Configuration=%_C% -p:NoBuild=true -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj || exit /b @popd -@endlocal \ No newline at end of file +@endlocal diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props index 9b7a1bb5..8c7304ee 100644 --- a/src/Cpp.Build.props +++ b/src/Cpp.Build.props @@ -6,6 +6,8 @@ Win32 $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ $(OutputPath)$(Platform)\ + win-x86;win-x64;win-arm64 + native,Version=v0.0 diff --git a/src/FindLocalWix.props b/src/FindLocalWix.props deleted file mode 100644 index 1666e4fe..00000000 --- a/src/FindLocalWix.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets - - diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 6cc0d24e..750deb3c 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -1,8 +1,7 @@ + - - Debug @@ -29,6 +28,7 @@ ARM64 + {B86AF46C-0F90-49CC-923F-A800B088D015} DynamicLibrary @@ -39,30 +39,43 @@ WiX Toolset Dependency CustomAction 10.0 + + msi.lib + Create + + - + + + + 4.0.62 + + + 4.0.18 + + + 1.0.0 + + + 3.3.37 + + + - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - \ No newline at end of file + diff --git a/src/ca/packages.config b/src/ca/packages.config deleted file mode 100644 index 9d88f529..00000000 --- a/src/ca/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj index 2d3e40c3..0b80dc83 100644 --- a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj +++ b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj @@ -4,6 +4,7 @@ netcoreapp3.1 + embedded false diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj index 9fac8aae..fcdab28c 100644 --- a/src/wixext/WixToolset.Dependency.wixext.csproj +++ b/src/wixext/WixToolset.Dependency.wixext.csproj @@ -4,21 +4,22 @@ netstandard2.0 + embedded WixToolset.Dependency WiX Toolset Dependency Extension WiX Toolset Dependency Extension true - build + true + true - - - + + @@ -26,6 +27,12 @@ + + + + + + diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj index 6a04e2a4..76e3ecd3 100644 --- a/src/wixlib/dependency.wixproj +++ b/src/wixlib/dependency.wixproj @@ -1,4 +1,6 @@ + + @@ -16,9 +18,9 @@ - - - + + + -- cgit v1.2.3-55-g6feb From 92fb1113afda38a9c764cb2d899626745bbdfa3c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 27 Feb 2021 15:56:32 -0800 Subject: Simplify PackageReference in .vcxproj --- src/ca/dependencyca.vcxproj | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 750deb3c..6dfa4413 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -63,18 +63,10 @@ - - 4.0.62 - - - 4.0.18 - - - 1.0.0 - - - 3.3.37 - + + + + -- cgit v1.2.3-55-g6feb From 2db1935429110622a756960289857c28e7b1d366 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 28 Feb 2021 17:05:45 -0800 Subject: Update to latest build process to build .snupkg with only the .pdbs --- .gitignore | 43 +++++++++--- src/CSharp.Build.props | 11 --- src/Cpp.Build.props | 88 ------------------------ src/Directory.Build.props | 4 +- src/Directory.Build.targets | 5 +- src/Directory.csproj.props | 13 ++++ src/Directory.csproj.targets | 26 +++++++ src/Directory.vcxproj.props | 93 ++++++++++++++++++++++++++ src/wixext/WixToolset.Dependency.wixext.csproj | 8 +-- src/wixext/WixToolset.Dependency.wixext.nuspec | 25 +++++++ 10 files changed, 195 insertions(+), 121 deletions(-) delete mode 100644 src/CSharp.Build.props delete mode 100644 src/Cpp.Build.props create mode 100644 src/Directory.csproj.props create mode 100644 src/Directory.csproj.targets create mode 100644 src/Directory.vcxproj.props create mode 100644 src/wixext/WixToolset.Dependency.wixext.nuspec diff --git a/.gitignore b/.gitignore index 3e8a1553..1ee53850 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs +# Mono auto generated files +mono_crash.* + # Build results [Dd]ebug/ [Dd]ebugPublic/ @@ -20,12 +23,14 @@ [Rr]eleases/ x64/ x86/ +[Ww][Ii][Nn]32/ [Aa][Rr][Mm]/ [Aa][Rr][Mm]64/ bld/ [Bb]in/ [Oo]bj/ [Ll]og/ +[Ll]ogs/ # Visual Studio 2015/2017 cache/options directory .vs/ @@ -39,9 +44,10 @@ Generated\ Files/ [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* -# NUNIT +# NUnit *.VisualState.xml TestResult.xml +nunit-*.xml # Build Results of an ATL Project [Dd]ebugPS/ @@ -56,6 +62,9 @@ project.lock.json project.fragment.lock.json artifacts/ +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + # StyleCop StyleCopReport.xml @@ -122,9 +131,6 @@ _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user -# JustCode is a .NET coding add-in -.JustCode - # TeamCity is a build add-in _TeamCity* @@ -135,6 +141,11 @@ _TeamCity* .axoCover/* !.axoCover/settings.json +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + # Visual Studio code coverage results *.coverage *.coveragexml @@ -182,6 +193,8 @@ PublishScripts/ # NuGet Packages *.nupkg +# NuGet Symbol Packages +*.snupkg # The packages folder can be ignored because of Package Restore **/[Pp]ackages/* # except build/, which is used as an MSBuild target. @@ -206,6 +219,8 @@ BundleArtifacts/ Package.StoreAssociation.xml _pkginfo.txt *.appx +*.appxbundle +*.appxupload # Visual Studio cache files # files ending in .cache can be ignored @@ -231,8 +246,6 @@ orleans.codegen.cs # Since there are multiple workflows, uncomment next line to ignore bower_components # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) #bower_components/ -# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true -**/wwwroot/lib/ # RIA/Silverlight projects Generated_Code/ @@ -257,6 +270,9 @@ ServiceFabricBackup/ *.bim.layout *.bim_*.settings *.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl # Microsoft Fakes FakesAssemblies/ @@ -292,10 +308,6 @@ paket-files/ # FAKE - F# Make .fake/ -# JetBrains Rider -.idea/ -*.sln.iml - # CodeRush personal settings .cr/personal @@ -337,5 +349,14 @@ ASALocalRun/ # Local History for Visual Studio .localhistory/ -# BeatPulse healthcheck temp database +# BeatPulse healthcheck temp database healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/src/CSharp.Build.props b/src/CSharp.Build.props deleted file mode 100644 index b12f4c6e..00000000 --- a/src/CSharp.Build.props +++ /dev/null @@ -1,11 +0,0 @@ - - - - - true - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) - - diff --git a/src/Cpp.Build.props b/src/Cpp.Build.props deleted file mode 100644 index 8c7304ee..00000000 --- a/src/Cpp.Build.props +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - Win32 - $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ - $(OutputPath)$(Platform)\ - win-x86;win-x64;win-arm64 - native,Version=v0.0 - - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - - - - - $(DisableSpecificCompilerWarnings) - Level4 - $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - Use - precomp.h - StdCall - true - false - -YlprecompDefine - /Zc:threadSafeInit- %(AdditionalOptions) - true - - - $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) - $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) - - - $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) - - - $(ProjectSubSystem) - $(ProjectModuleDefinitionFile) - $(ResourceOnlyDll) - true - $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) - $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) - /IGNORE:4099 %(AdditionalOptions) - - - - - - NoExtensions - - - - - CDecl - - - - - OldStyle - true - true - - - - - Disabled - EnableFastChecks - _DEBUG;DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebug - - - - - MinSpace - NDEBUG;%(PreprocessorDefinitions) - true - true - MultiThreaded - - - true - true - - - diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f83cc154..b3c6287c 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -22,8 +22,6 @@ WiX Toolset - - - + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index dac7452a..2fcc765a 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -40,9 +40,12 @@ - + + + + diff --git a/src/Directory.csproj.props b/src/Directory.csproj.props new file mode 100644 index 00000000..81d24ad1 --- /dev/null +++ b/src/Directory.csproj.props @@ -0,0 +1,13 @@ + + + + + true + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + false + + diff --git a/src/Directory.csproj.targets b/src/Directory.csproj.targets new file mode 100644 index 00000000..c3270426 --- /dev/null +++ b/src/Directory.csproj.targets @@ -0,0 +1,26 @@ + + + + + false + $(OutputPath)\$(AssemblyName).xml + + + + + $(PrivateRepositoryUrl.Replace('.git','')) + + $(MSBuildProjectName).nuspec + $(OutputPath)..\ + $(NuspecProperties);Id=$(PackageId);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);Title=$(Title) + $(NuspecProperties);Version=$(PackageVersion);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);ProjectFolder=$(MSBuildProjectDirectory)\;ProjectUrl=$(ProjectUrl) + true + snupkg + + + + diff --git a/src/Directory.vcxproj.props b/src/Directory.vcxproj.props new file mode 100644 index 00000000..664bc1d8 --- /dev/null +++ b/src/Directory.vcxproj.props @@ -0,0 +1,93 @@ + + + + + + Win32 + $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ + $(OutputPath)$(Platform)\ + + + $(Company) + $(Copyright) + + win-x86;win-x64;win-arm64 + native,Version=v0.0 + + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + + + + + $(DisableSpecificCompilerWarnings) + Level4 + $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + Use + precomp.h + StdCall + true + false + -YlprecompDefine + /Zc:threadSafeInit- %(AdditionalOptions) + true + + + $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) + $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) + + + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) + + + $(ProjectSubSystem) + $(ProjectModuleDefinitionFile) + $(ResourceOnlyDll) + true + $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) + /IGNORE:4099 %(AdditionalOptions) + + + + + + NoExtensions + + + + + CDecl + + + + + OldStyle + true + true + + + + + Disabled + EnableFastChecks + _DEBUG;DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + MinSpace + NDEBUG;%(PreprocessorDefinitions) + true + true + MultiThreaded + + + true + true + + + diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj index fcdab28c..b2663231 100644 --- a/src/wixext/WixToolset.Dependency.wixext.csproj +++ b/src/wixext/WixToolset.Dependency.wixext.csproj @@ -9,19 +9,13 @@ WiX Toolset Dependency Extension WiX Toolset Dependency Extension true - true - true + true - - - - - diff --git a/src/wixext/WixToolset.Dependency.wixext.nuspec b/src/wixext/WixToolset.Dependency.wixext.nuspec new file mode 100644 index 00000000..ba3eaade --- /dev/null +++ b/src/wixext/WixToolset.Dependency.wixext.nuspec @@ -0,0 +1,25 @@ + + + + $id$ + $version$ + $title$ + $description$ + $authors$ + MS-RL + false + $copyright$ + $projectUrl$ + + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb From eaf20736a02847c024690e3d2bcddff269007a1c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 1 Mar 2021 08:02:22 -0800 Subject: Publish .snupkg --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 7c686b04..c53cc9cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,6 +33,8 @@ skip_tags: true artifacts: - path: build\Release\**\*.nupkg name: nuget +- path: build\Release\**\*.snupkg + name: snupkg notifications: - provider: Slack -- cgit v1.2.3-55-g6feb From 5d22e83ed1c5abf2b81caa4a56fa56342f30b83b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 3 Mar 2021 22:56:09 -0600 Subject: Update dependencies. --- global.json | 2 +- src/ca/dependencyca.vcxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 8b252932..30206a47 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0191" + "WixToolset.Sdk": "4.0.0-build-0194" } } diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 6dfa4413..5f859d82 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -63,7 +63,7 @@ - + -- cgit v1.2.3-55-g6feb From 3eef7b697ecebffc20d13bc2c199573620c38ccf Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 5 Mar 2021 15:15:38 -0600 Subject: Fix Enforce. --- .../WixToolsetTest.Dependency/DependencyExtensionFixture.cs | 10 ++++++++-- .../TestData/UsingProvides/Package.wxs | 3 +++ src/wixext/DependencyCompiler.cs | 4 ++-- src/wixlib/DependencyExtension_Platform.wxi | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 968b8de6..708ae658 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -2,6 +2,8 @@ namespace WixToolsetTest.Dependency { + using System.Linq; + using System.Text.RegularExpressions; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using WixToolset.Dependency; @@ -15,11 +17,15 @@ namespace WixToolsetTest.Dependency var folder = TestData.Get(@"TestData\UsingProvides"); var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); - var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider"); - Assert.Equal(new[] + var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider") + .Select(r => Regex.Replace(r, "{[^}]*}", "{*}")) + .ToArray(); + WixAssert.CompareLineByLine(new[] { "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t", + "CustomAction:Wix4DependencyRequire_X86\t1\tDependencyCA_X86\tWixDependencyRequire\t", "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", + "WixDependencyProvider:depTpv28q7slcxvXPWmU4Z0GfbiI.4\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\t{*}\t\t\t", }, results); } diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs index b15ae8da..9351519d 100644 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -9,6 +9,9 @@ + + + diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 0405c324..3d6c84a7 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -30,14 +30,14 @@ namespace WixToolset.Dependency switch (parentElement.Name.LocalName) { case "Provides": - if (attribute.Name.LocalName == "Check" && parentElement.Parent.Name.LocalName == "Component") + if (attribute.Name.LocalName == "Check" && parentElement.Parent?.Name.LocalName == "Component") { addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } break; case "Requires": case "RequiresRef": - if (attribute.Name.LocalName == "Enforce" && parentElement.Parent.Name.LocalName == "Component") + if (attribute.Name.LocalName == "Enforce" && parentElement.Parent?.Parent?.Name.LocalName == "Component") { addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi index 68dec471..9ab28ef3 100644 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -7,7 +7,7 @@ - + -- cgit v1.2.3-55-g6feb From 6e7aaa6e6bae292869438e6f05c4db3523a6b5db Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 31 Mar 2021 12:44:27 -0500 Subject: Update to latest Sdk. --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 30206a47..9181db6f 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0194" + "WixToolset.Sdk": "4.0.0-build-0203" } } -- cgit v1.2.3-55-g6feb From a2f45139b5f455c8a6c096bcaa087929c041762d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 7 Apr 2021 22:04:48 -0700 Subject: Update dependencies --- global.json | 2 +- .../WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index 9181db6f..fc26eb6e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0203" + "WixToolset.Sdk": "4.0.0-build-0206" } } diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs index 9351519d..65984395 100644 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -3,8 +3,10 @@ - - + + + + -- cgit v1.2.3-55-g6feb From e0769330595d6eafbc263e7db13235a508d0781a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 15 Apr 2021 18:28:25 -0500 Subject: Update dependencies. --- global.json | 2 +- src/ca/dependencyca.vcxproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index fc26eb6e..83ab5c51 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0206" + "WixToolset.Sdk": "4.0.0-build-0209" } } diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 5f859d82..3ce2b0fe 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -63,7 +63,7 @@ - + -- cgit v1.2.3-55-g6feb From 4d56d41e82a8b118415421ce334636779cc20b18 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Mon, 19 Apr 2021 23:59:41 -0500 Subject: Use IReadOnlyCollection. --- global.json | 2 +- src/wixext/DependencyExtensionFactory.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/global.json b/global.json index 83ab5c51..616b0b8c 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0209" + "WixToolset.Sdk": "4.0.0-build-0210" } } diff --git a/src/wixext/DependencyExtensionFactory.cs b/src/wixext/DependencyExtensionFactory.cs index 354f9234..413f99ae 100644 --- a/src/wixext/DependencyExtensionFactory.cs +++ b/src/wixext/DependencyExtensionFactory.cs @@ -8,7 +8,7 @@ namespace WixToolset.Dependency public class DependencyExtensionFactory : BaseExtensionFactory { - protected override IEnumerable ExtensionTypes => new[] + protected override IReadOnlyCollection ExtensionTypes => new[] { typeof(DependencyCompiler), typeof(DependencyExtensionData), -- cgit v1.2.3-55-g6feb From 15ef78b3d270096db1e248837fd0a51d2994310c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 20 Apr 2021 13:54:28 -0700 Subject: Integrate latest tooling --- global.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global.json b/global.json index 616b0b8c..23dd3fa6 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0210" + "WixToolset.Sdk": "4.0.0-build-0211" } } -- cgit v1.2.3-55-g6feb From fb095340926a93e3eec9592e3e255b7d7b04d9d5 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 28 Apr 2021 19:30:37 -0500 Subject: Update dependencies. --- global.json | 2 +- src/ca/dependencyca.vcxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/global.json b/global.json index 23dd3fa6..23d7a5bd 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0211" + "WixToolset.Sdk": "4.0.0-build-0213" } } diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj index 3ce2b0fe..2a0760d6 100644 --- a/src/ca/dependencyca.vcxproj +++ b/src/ca/dependencyca.vcxproj @@ -63,8 +63,8 @@ - - + + -- cgit v1.2.3-55-g6feb From 3caaf742fcd19170a8732570654d3b2cbb18830f Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 4 May 2021 12:07:04 -0700 Subject: Move Dependency.wixext into ext --- .editorconfig | 37 -- Dependency.wixext.sln | 61 --- README.md | 2 - appveyor.cmd | 19 - appveyor.yml | 42 -- global.json | 5 - nuget.config | 18 - src/.editorconfig | 37 ++ src/Directory.Build.props | 27 -- src/Directory.Build.targets | 51 -- src/Directory.csproj.props | 13 - src/Directory.csproj.targets | 26 -- src/Directory.vcxproj.props | 93 ---- src/ca/custommsierrors.h | 5 - src/ca/dependencyca.vcxproj | 73 --- src/ca/dependencyca.vcxproj.filters | 36 -- src/ca/dllmain.cpp | 27 -- src/ca/precomp.h | 18 - src/ca/wixdepca.cpp | 516 --------------------- src/ca/wixdepca.def | 8 - src/ext/Dependency/Dependency.wixext.sln | 61 +++ src/ext/Dependency/Directory.Build.props | 27 ++ src/ext/Dependency/Directory.Build.targets | 51 ++ src/ext/Dependency/Directory.csproj.props | 13 + src/ext/Dependency/Directory.csproj.targets | 26 ++ src/ext/Dependency/Directory.vcxproj.props | 93 ++++ src/ext/Dependency/README.md | 2 + src/ext/Dependency/appveyor.cmd | 19 + src/ext/Dependency/appveyor.yml | 42 ++ src/ext/Dependency/ca/custommsierrors.h | 5 + src/ext/Dependency/ca/dependencyca.vcxproj | 73 +++ src/ext/Dependency/ca/dependencyca.vcxproj.filters | 36 ++ src/ext/Dependency/ca/dllmain.cpp | 27 ++ src/ext/Dependency/ca/precomp.h | 18 + src/ext/Dependency/ca/wixdepca.cpp | 516 +++++++++++++++++++++ src/ext/Dependency/ca/wixdepca.def | 8 + src/ext/Dependency/nuget.config | 18 + .../DependencyExtensionFixture.cs | 38 ++ .../TestData/UsingProvides/Package.en-us.wxl | 11 + .../TestData/UsingProvides/Package.wxs | 21 + .../WixToolsetTest.Dependency.csproj | 39 ++ src/ext/Dependency/wix.snk | Bin 0 -> 596 bytes src/ext/Dependency/wixext/DependencyCompiler.cs | 61 +++ src/ext/Dependency/wixext/DependencyDecompiler.cs | 347 ++++++++++++++ .../Dependency/wixext/DependencyExtensionData.cs | 29 ++ .../wixext/DependencyExtensionFactory.cs | 17 + .../wixext/WixToolset.Dependency.wixext.csproj | 32 ++ .../wixext/WixToolset.Dependency.wixext.nuspec | 25 + .../wixext/WixToolset.Dependency.wixext.targets | 11 + src/ext/Dependency/wixlib/DependencyExtension.wxs | 21 + .../wixlib/DependencyExtension_Platform.wxi | 28 ++ .../wixlib/DependencyExtension_arm64.wxs | 7 + .../Dependency/wixlib/DependencyExtension_x64.wxs | 7 + .../Dependency/wixlib/DependencyExtension_x86.wxs | 7 + src/ext/Dependency/wixlib/caDecor.wxi | 39 ++ src/ext/Dependency/wixlib/caerr.wxi | 96 ++++ src/ext/Dependency/wixlib/dependency.wixproj | 30 ++ src/ext/Dependency/wixlib/en-us.wxl | 7 + src/ext/global.json | 5 + .../DependencyExtensionFixture.cs | 38 -- .../TestData/UsingProvides/Package.en-us.wxl | 11 - .../TestData/UsingProvides/Package.wxs | 21 - .../WixToolsetTest.Dependency.csproj | 39 -- src/version.json | 11 + src/wix.snk | Bin 596 -> 0 bytes src/wixext/DependencyCompiler.cs | 61 --- src/wixext/DependencyDecompiler.cs | 347 -------------- src/wixext/DependencyExtensionData.cs | 29 -- src/wixext/DependencyExtensionFactory.cs | 17 - src/wixext/WixToolset.Dependency.wixext.csproj | 32 -- src/wixext/WixToolset.Dependency.wixext.nuspec | 25 - src/wixext/WixToolset.Dependency.wixext.targets | 11 - src/wixlib/DependencyExtension.wxs | 21 - src/wixlib/DependencyExtension_Platform.wxi | 28 -- src/wixlib/DependencyExtension_arm64.wxs | 7 - src/wixlib/DependencyExtension_x64.wxs | 7 - src/wixlib/DependencyExtension_x86.wxs | 7 - src/wixlib/caDecor.wxi | 39 -- src/wixlib/caerr.wxi | 96 ---- src/wixlib/dependency.wixproj | 30 -- src/wixlib/en-us.wxl | 7 - version.json | 11 - 82 files changed, 1961 insertions(+), 1961 deletions(-) delete mode 100644 .editorconfig delete mode 100644 Dependency.wixext.sln delete mode 100644 README.md delete mode 100644 appveyor.cmd delete mode 100644 appveyor.yml delete mode 100644 global.json delete mode 100644 nuget.config create mode 100644 src/.editorconfig delete mode 100644 src/Directory.Build.props delete mode 100644 src/Directory.Build.targets delete mode 100644 src/Directory.csproj.props delete mode 100644 src/Directory.csproj.targets delete mode 100644 src/Directory.vcxproj.props delete mode 100644 src/ca/custommsierrors.h delete mode 100644 src/ca/dependencyca.vcxproj delete mode 100644 src/ca/dependencyca.vcxproj.filters delete mode 100644 src/ca/dllmain.cpp delete mode 100644 src/ca/precomp.h delete mode 100644 src/ca/wixdepca.cpp delete mode 100644 src/ca/wixdepca.def create mode 100644 src/ext/Dependency/Dependency.wixext.sln create mode 100644 src/ext/Dependency/Directory.Build.props create mode 100644 src/ext/Dependency/Directory.Build.targets create mode 100644 src/ext/Dependency/Directory.csproj.props create mode 100644 src/ext/Dependency/Directory.csproj.targets create mode 100644 src/ext/Dependency/Directory.vcxproj.props create mode 100644 src/ext/Dependency/README.md create mode 100644 src/ext/Dependency/appveyor.cmd create mode 100644 src/ext/Dependency/appveyor.yml create mode 100644 src/ext/Dependency/ca/custommsierrors.h create mode 100644 src/ext/Dependency/ca/dependencyca.vcxproj create mode 100644 src/ext/Dependency/ca/dependencyca.vcxproj.filters create mode 100644 src/ext/Dependency/ca/dllmain.cpp create mode 100644 src/ext/Dependency/ca/precomp.h create mode 100644 src/ext/Dependency/ca/wixdepca.cpp create mode 100644 src/ext/Dependency/ca/wixdepca.def create mode 100644 src/ext/Dependency/nuget.config create mode 100644 src/ext/Dependency/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs create mode 100644 src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl create mode 100644 src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs create mode 100644 src/ext/Dependency/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj create mode 100644 src/ext/Dependency/wix.snk create mode 100644 src/ext/Dependency/wixext/DependencyCompiler.cs create mode 100644 src/ext/Dependency/wixext/DependencyDecompiler.cs create mode 100644 src/ext/Dependency/wixext/DependencyExtensionData.cs create mode 100644 src/ext/Dependency/wixext/DependencyExtensionFactory.cs create mode 100644 src/ext/Dependency/wixext/WixToolset.Dependency.wixext.csproj create mode 100644 src/ext/Dependency/wixext/WixToolset.Dependency.wixext.nuspec create mode 100644 src/ext/Dependency/wixext/WixToolset.Dependency.wixext.targets create mode 100644 src/ext/Dependency/wixlib/DependencyExtension.wxs create mode 100644 src/ext/Dependency/wixlib/DependencyExtension_Platform.wxi create mode 100644 src/ext/Dependency/wixlib/DependencyExtension_arm64.wxs create mode 100644 src/ext/Dependency/wixlib/DependencyExtension_x64.wxs create mode 100644 src/ext/Dependency/wixlib/DependencyExtension_x86.wxs create mode 100644 src/ext/Dependency/wixlib/caDecor.wxi create mode 100644 src/ext/Dependency/wixlib/caerr.wxi create mode 100644 src/ext/Dependency/wixlib/dependency.wixproj create mode 100644 src/ext/Dependency/wixlib/en-us.wxl create mode 100644 src/ext/global.json delete mode 100644 src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs delete mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl delete mode 100644 src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs delete mode 100644 src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj create mode 100644 src/version.json delete mode 100644 src/wix.snk delete mode 100644 src/wixext/DependencyCompiler.cs delete mode 100644 src/wixext/DependencyDecompiler.cs delete mode 100644 src/wixext/DependencyExtensionData.cs delete mode 100644 src/wixext/DependencyExtensionFactory.cs delete mode 100644 src/wixext/WixToolset.Dependency.wixext.csproj delete mode 100644 src/wixext/WixToolset.Dependency.wixext.nuspec delete mode 100644 src/wixext/WixToolset.Dependency.wixext.targets delete mode 100644 src/wixlib/DependencyExtension.wxs delete mode 100644 src/wixlib/DependencyExtension_Platform.wxi delete mode 100644 src/wixlib/DependencyExtension_arm64.wxs delete mode 100644 src/wixlib/DependencyExtension_x64.wxs delete mode 100644 src/wixlib/DependencyExtension_x86.wxs delete mode 100644 src/wixlib/caDecor.wxi delete mode 100644 src/wixlib/caerr.wxi delete mode 100644 src/wixlib/dependency.wixproj delete mode 100644 src/wixlib/en-us.wxl delete mode 100644 version.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 1d72e683..00000000 --- a/.editorconfig +++ /dev/null @@ -1,37 +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. -# -# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig -# then update all of the repos. - -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true - -[*.{cs,vb}] -dotnet_sort_system_directives_first = true - -[*.cs] -csharp_indent_case_contents = true : error -csharp_indent_switch_labels = true : error -csharp_new_line_before_open_brace = all -csharp_prefer_braces = true : error -csharp_style_expression_bodied_methods = when_on_single_line : suggestion -csharp_style_expression_bodied_constructors = when_on_single_line : suggestion -csharp_style_expression_bodied_operators = when_on_single_line : suggestion -csharp_style_expression_bodied_properties = when_on_single_line : suggestion -csharp_style_expression_bodied_indexers = when_on_single_line : suggestion -csharp_style_expression_bodied_accessors = when_on_single_line : suggestion -csharp_style_var_elsewhere = true : suggestion -csharp_style_var_for_built_in_types = true : suggestion -csharp_style_var_when_type_is_apparent = true : suggestion -dotnet_style_qualification_for_event = true : error -dotnet_style_qualification_for_field = true : error -dotnet_style_qualification_for_method = true : error -dotnet_style_qualification_for_property = true : error - -[*.targets] -indent_size = 2 diff --git a/Dependency.wixext.sln b/Dependency.wixext.sln deleted file mode 100644 index e771ddf6..00000000 --- a/Dependency.wixext.sln +++ /dev/null @@ -1,61 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30204.135 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}" -EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "dependency", "src\wixlib\dependency.wixproj", "{58ED0EC8-73F8-4EE1-8664-A53486D38EC8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dependency.wixext", "src\wixext\WixToolset.Dependency.wixext.csproj", "{A0B6D3F1-AE5E-423B-BA92-60C9926CA498}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Dependency", "src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj", "{E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.Build.0 = Debug|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.ActiveCfg = Debug|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.Build.0 = Debug|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.ActiveCfg = Release|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.Build.0 = Release|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.ActiveCfg = Release|Win32 - {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.Build.0 = Release|Win32 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.ActiveCfg = Debug|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.Build.0 = Debug|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.ActiveCfg = Debug|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.Build.0 = Debug|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.ActiveCfg = Release|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.Build.0 = Release|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.ActiveCfg = Release|x86 - {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.Build.0 = Release|x86 - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.ActiveCfg = Debug|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.Build.0 = Debug|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.Build.0 = Release|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.ActiveCfg = Release|Any CPU - {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.Build.0 = Release|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.ActiveCfg = Debug|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.Build.0 = Debug|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.Build.0 = Release|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.ActiveCfg = Release|Any CPU - {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {77F012B1-8E94-4F85-9450-066C6BD15000} - EndGlobalSection -EndGlobal diff --git a/README.md b/README.md deleted file mode 100644 index 09feba68..00000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# Dependency.wixext -WixToolset.Dependency.wixext - Dependency WiX Toolset Extension diff --git a/appveyor.cmd b/appveyor.cmd deleted file mode 100644 index 3450d535..00000000 --- a/appveyor.cmd +++ /dev/null @@ -1,19 +0,0 @@ -@setlocal -@pushd %~dp0 -@set _C=Release -@if /i "%1"=="debug" set _C=Debug - -:: Restore -msbuild -p:Configuration=%_C% -t:Restore || exit /b - -:: Build -msbuild -p:Configuration=%_C% src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj || exit /b - -:: Test -dotnet test -c %_C% --no-build src\test\WixToolsetTest.Dependency || exit /b - -:: Pack -msbuild -p:Configuration=%_C% -p:NoBuild=true -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj || exit /b - -@popd -@endlocal diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c53cc9cc..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +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. -# -# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml -# then update all of the repos. - -branches: - only: - - master - - develop - -image: Visual Studio 2019 - -version: 0.0.0.{build} -configuration: Release - -environment: - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_CLI_TELEMETRY_OPTOUT: 1 - NUGET_XMLDOC_MODE: skip - -build_script: - - appveyor.cmd - -pull_requests: - do_not_increment_build_number: true - -nuget: - disable_publish_on_pr: true - -skip_branch_with_pr: true -skip_tags: true - -artifacts: -- path: build\Release\**\*.nupkg - name: nuget -- path: build\Release\**\*.snupkg - name: snupkg - -notifications: -- provider: Slack - incoming_webhook: - secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= diff --git a/global.json b/global.json deleted file mode 100644 index 23d7a5bd..00000000 --- a/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "msbuild-sdks": { - "WixToolset.Sdk": "4.0.0-build-0213" - } -} diff --git a/nuget.config b/nuget.config deleted file mode 100644 index 10ef488d..00000000 --- a/nuget.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..1d72e683 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,37 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\.editorconfig +# then update all of the repos. + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.{cs,vb}] +dotnet_sort_system_directives_first = true + +[*.cs] +csharp_indent_case_contents = true : error +csharp_indent_switch_labels = true : error +csharp_new_line_before_open_brace = all +csharp_prefer_braces = true : error +csharp_style_expression_bodied_methods = when_on_single_line : suggestion +csharp_style_expression_bodied_constructors = when_on_single_line : suggestion +csharp_style_expression_bodied_operators = when_on_single_line : suggestion +csharp_style_expression_bodied_properties = when_on_single_line : suggestion +csharp_style_expression_bodied_indexers = when_on_single_line : suggestion +csharp_style_expression_bodied_accessors = when_on_single_line : suggestion +csharp_style_var_elsewhere = true : suggestion +csharp_style_var_for_built_in_types = true : suggestion +csharp_style_var_when_type_is_apparent = true : suggestion +dotnet_style_qualification_for_event = true : error +dotnet_style_qualification_for_field = true : error +dotnet_style_qualification_for_method = true : error +dotnet_style_qualification_for_property = true : error + +[*.targets] +indent_size = 2 diff --git a/src/Directory.Build.props b/src/Directory.Build.props deleted file mode 100644 index b3c6287c..00000000 --- a/src/Directory.Build.props +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Debug - false - MSB3246 - - $(MSBuildProjectName) - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) - $(BaseOutputPath)obj\$(ProjectName)\ - $(BaseOutputPath)$(Configuration)\ - - WiX Toolset Team - WiX Toolset - Copyright (c) .NET Foundation and contributors. All rights reserved. - MS-RL - WiX Toolset - - - - - diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets deleted file mode 100644 index 2fcc765a..00000000 --- a/src/Directory.Build.targets +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - true - $(SolutionPath) - $(NCrunchOriginalSolutionPath) - - - - - - - $([System.IO.File]::ReadAllText($(TheSolutionPath))) - $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) - (?<="[PackageName]", ")(.*)(?=", ") - - - - - - %(Identity) - $(SolutionFileContent.Contains('\%(Identity).csproj')) - - - - - $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) - $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) - - - - - - - - - - - - - - diff --git a/src/Directory.csproj.props b/src/Directory.csproj.props deleted file mode 100644 index 81d24ad1..00000000 --- a/src/Directory.csproj.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - - true - true - $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) - false - - diff --git a/src/Directory.csproj.targets b/src/Directory.csproj.targets deleted file mode 100644 index c3270426..00000000 --- a/src/Directory.csproj.targets +++ /dev/null @@ -1,26 +0,0 @@ - - - - - false - $(OutputPath)\$(AssemblyName).xml - - - - - $(PrivateRepositoryUrl.Replace('.git','')) - - $(MSBuildProjectName).nuspec - $(OutputPath)..\ - $(NuspecProperties);Id=$(PackageId);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);Title=$(Title) - $(NuspecProperties);Version=$(PackageVersion);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);ProjectFolder=$(MSBuildProjectDirectory)\;ProjectUrl=$(ProjectUrl) - true - snupkg - - - - diff --git a/src/Directory.vcxproj.props b/src/Directory.vcxproj.props deleted file mode 100644 index 664bc1d8..00000000 --- a/src/Directory.vcxproj.props +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - Win32 - $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ - $(OutputPath)$(Platform)\ - - - $(Company) - $(Copyright) - - win-x86;win-x64;win-arm64 - native,Version=v0.0 - - - - $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) - - - - - $(DisableSpecificCompilerWarnings) - Level4 - $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - Use - precomp.h - StdCall - true - false - -YlprecompDefine - /Zc:threadSafeInit- %(AdditionalOptions) - true - - - $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) - $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) - - - $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) - - - $(ProjectSubSystem) - $(ProjectModuleDefinitionFile) - $(ResourceOnlyDll) - true - $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) - $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) - /IGNORE:4099 %(AdditionalOptions) - - - - - - NoExtensions - - - - - CDecl - - - - - OldStyle - true - true - - - - - Disabled - EnableFastChecks - _DEBUG;DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebug - - - - - MinSpace - NDEBUG;%(PreprocessorDefinitions) - true - true - MultiThreaded - - - true - true - - - diff --git a/src/ca/custommsierrors.h b/src/ca/custommsierrors.h deleted file mode 100644 index 26450452..00000000 --- a/src/ca/custommsierrors.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once -// 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. - -#define msierrDependencyMissingDependencies 26451 -#define msierrDependencyHasDependents 26452 diff --git a/src/ca/dependencyca.vcxproj b/src/ca/dependencyca.vcxproj deleted file mode 100644 index 2a0760d6..00000000 --- a/src/ca/dependencyca.vcxproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM64 - - - Release - ARM64 - - - - - {B86AF46C-0F90-49CC-923F-A800B088D015} - DynamicLibrary - v142 - Unicode - dependencyca - wixdepca.def - WiX Toolset Dependency CustomAction - 10.0 - - - - - - - msi.lib - - - - - Create - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ca/dependencyca.vcxproj.filters b/src/ca/dependencyca.vcxproj.filters deleted file mode 100644 index bfe457e2..00000000 --- a/src/ca/dependencyca.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Source Files - - - - \ No newline at end of file diff --git a/src/ca/dllmain.cpp b/src/ca/dllmain.cpp deleted file mode 100644 index 7d299feb..00000000 --- a/src/ca/dllmain.cpp +++ /dev/null @@ -1,27 +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. - -#include "precomp.h" - -/******************************************************************** -DllMain - standard entry point for all WiX custom actions. - -********************************************************************/ -extern "C" BOOL WINAPI DllMain( - IN HINSTANCE hInstance, - IN ULONG ulReason, - IN LPVOID) -{ - switch(ulReason) - { - case DLL_PROCESS_ATTACH: - WcaGlobalInitialize(hInstance); - ::DisableThreadLibraryCalls(hInstance); - break; - - case DLL_PROCESS_DETACH: - WcaGlobalFinalize(); - break; - } - - return TRUE; -} diff --git a/src/ca/precomp.h b/src/ca/precomp.h deleted file mode 100644 index 5fd06cff..00000000 --- a/src/ca/precomp.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once -// 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. - - -#include -#include -#include -#include - -#include "wcautil.h" -#include "fileutil.h" -#include "strutil.h" -#include "memutil.h" -#include "regutil.h" -#include "dictutil.h" -#include "deputil.h" - -#include "CustomMsiErrors.h" diff --git a/src/ca/wixdepca.cpp b/src/ca/wixdepca.cpp deleted file mode 100644 index d6433707..00000000 --- a/src/ca/wixdepca.cpp +++ /dev/null @@ -1,516 +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. - -#include "precomp.h" - -#define IDNOACTION 0 -#define INITIAL_STRINGDICT_SIZE 4 - -LPCWSTR vcsDependencyProviderQuery = - L"SELECT `WixDependencyProvider`.`WixDependencyProvider`, `WixDependencyProvider`.`Component_`, `WixDependencyProvider`.`ProviderKey`, `WixDependencyProvider`.`Attributes` " - L"FROM `WixDependencyProvider`"; -enum eDependencyProviderQuery { dpqId = 1, dpqComponent, dpqProviderKey, dpqAttributes }; - -LPCWSTR vcsDependencyQuery = - L"SELECT `WixDependency`.`WixDependency`, `WixDependencyProvider`.`Component_`, `WixDependency`.`ProviderKey`, `WixDependency`.`MinVersion`, `WixDependency`.`MaxVersion`, `WixDependency`.`Attributes` " - L"FROM `WixDependencyProvider`, `WixDependency`, `WixDependencyRef` " - L"WHERE `WixDependency`.`WixDependency` = `WixDependencyRef`.`WixDependency_` AND `WixDependencyProvider`.`WixDependencyProvider` = `WixDependencyRef`.`WixDependencyProvider_`"; -enum eDependencyComponentQuery { dqId = 1, dqComponent, dqProviderKey, dqMinVersion, dqMaxVersion, dqAttributes }; - -static HRESULT EnsureRequiredDependencies( - __in MSIHANDLE hInstall, - __in BOOL fMachineContext - ); - -static HRESULT EnsureAbsentDependents( - __in MSIHANDLE hInstall, - __in BOOL fMachineContext - ); - -static HRESULT SplitIgnoredDependents( - __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents - ); - -static HRESULT CreateDependencyRecord( - __in int iMessageId, - __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, - __in UINT cDependencies, - __out MSIHANDLE *phRecord - ); - -static LPCWSTR LogDependencyName( - __in_z LPCWSTR wzName - ); - -/*************************************************************************** - WixDependencyRequire - Checks that all required dependencies are installed. - -***************************************************************************/ -extern "C" UINT __stdcall WixDependencyRequire( - __in MSIHANDLE hInstall - ) -{ - HRESULT hr = S_OK; - UINT er = ERROR_SUCCESS; - BOOL fMachineContext = FALSE; - - hr = WcaInitialize(hInstall, "WixDependencyRequire"); - ExitOnFailure(hr, "Failed to initialize."); - - hr = RegInitialize(); - ExitOnFailure(hr, "Failed to initialize the registry functions."); - - // Determine whether we're installing per-user or per-machine. - fMachineContext = WcaIsPropertySet("ALLUSERS"); - - // Check for any provider components being (re)installed that their requirements are already installed. - hr = EnsureRequiredDependencies(hInstall, fMachineContext); - ExitOnFailure(hr, "Failed to ensure required dependencies for (re)installing components."); - -LExit: - RegUninitialize(); - - er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; - return WcaFinalize(er); -} - -/*************************************************************************** - WixDependencyCheck - Check dependencies based on component state. - - Note: may return ERROR_NO_MORE_ITEMS to terminate the session early. -***************************************************************************/ -extern "C" UINT __stdcall WixDependencyCheck( - __in MSIHANDLE hInstall - ) -{ - HRESULT hr = S_OK; - UINT er = ERROR_SUCCESS; - BOOL fMachineContext = FALSE; - - hr = WcaInitialize(hInstall, "WixDependencyCheck"); - ExitOnFailure(hr, "Failed to initialize."); - - hr = RegInitialize(); - ExitOnFailure(hr, "Failed to initialize the registry functions."); - - // Determine whether we're installing per-user or per-machine. - fMachineContext = WcaIsPropertySet("ALLUSERS"); - - // Check for any dependents of provider components being uninstalled. - hr = EnsureAbsentDependents(hInstall, fMachineContext); - ExitOnFailure(hr, "Failed to ensure absent dependents for uninstalling components."); - -LExit: - RegUninitialize(); - - er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; - return WcaFinalize(er); -} - -/*************************************************************************** - EnsureRequiredDependencies - Check that dependencies are installed for - any provider component that is being installed or reinstalled. - - Note: Skipped if DISABLEDEPENDENCYCHECK is set. -***************************************************************************/ -static HRESULT EnsureRequiredDependencies( - __in MSIHANDLE /*hInstall*/, - __in BOOL fMachineContext - ) -{ - HRESULT hr = S_OK; - DWORD er = ERROR_SUCCESS; - STRINGDICT_HANDLE sdDependencies = NULL; - HKEY hkHive = NULL; - PMSIHANDLE hView = NULL; - PMSIHANDLE hRec = NULL; - LPWSTR sczId = NULL; - LPWSTR sczComponent = NULL; - LPWSTR sczProviderKey = NULL; - LPWSTR sczMinVersion = NULL; - LPWSTR sczMaxVersion = NULL; - int iAttributes = 0; - WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; - DEPENDENCY* rgDependencies = NULL; - UINT cDependencies = 0; - PMSIHANDLE hDependencyRec = NULL; - - // Skip the dependency check if the WixDependency table is missing (no dependencies to check for). - hr = WcaTableExists(L"WixDependency"); - if (S_FALSE == hr) - { - WcaLog(LOGMSG_STANDARD, "Skipping the dependency check since no dependencies are authored."); - ExitFunction1(hr = S_OK); - } - - // If the table exists but not the others, the database was not authored correctly. - ExitOnFailure(hr, "Failed to check if the WixDependency table exists."); - - // Initialize the dictionary to keep track of unique dependency keys. - hr = DictCreateStringList(&sdDependencies, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); - ExitOnFailure(hr, "Failed to initialize the unique dependency string list."); - - // Set the registry hive to use depending on install context. - hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; - - // Loop over the provider components. - hr = WcaOpenExecuteView(vcsDependencyQuery, &hView); - ExitOnFailure(hr, "Failed to open the query view for dependencies."); - - while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) - { - hr = WcaGetRecordString(hRec, dqId, &sczId); - ExitOnFailure(hr, "Failed to get WixDependency.WixDependency."); - - hr = WcaGetRecordString(hRec, dqComponent, &sczComponent); - ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component_."); - - // Skip the current component if its not being installed or reinstalled. - tComponentAction = WcaGetComponentToDo(sczComponent); - if (WCA_TODO_INSTALL != tComponentAction && WCA_TODO_REINSTALL != tComponentAction) - { - WcaLog(LOGMSG_STANDARD, "Skipping dependency check for %ls because the component %ls is not being (re)installed.", sczId, sczComponent); - continue; - } - - hr = WcaGetRecordString(hRec, dqProviderKey, &sczProviderKey); - ExitOnFailure(hr, "Failed to get WixDependency.ProviderKey."); - - hr = WcaGetRecordString(hRec, dqMinVersion, &sczMinVersion); - ExitOnFailure(hr, "Failed to get WixDependency.MinVersion."); - - hr = WcaGetRecordString(hRec, dqMaxVersion, &sczMaxVersion); - ExitOnFailure(hr, "Failed to get WixDependency.MaxVersion."); - - hr = WcaGetRecordInteger(hRec, dqAttributes, &iAttributes); - ExitOnFailure(hr, "Failed to get WixDependency.Attributes."); - - // Check the registry to see if the required providers (dependencies) exist. - hr = DepCheckDependency(hkHive, sczProviderKey, sczMinVersion, sczMaxVersion, iAttributes, sdDependencies, &rgDependencies, &cDependencies); - if (E_NOTFOUND != hr) - { - ExitOnFailure(hr, "Failed dependency check for %ls.", sczId); - } - } - - if (E_NOMOREITEMS != hr) - { - ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency query view."); - } - else - { - hr = S_OK; - } - - // If we collected any dependencies in the previous check, pump a message and prompt the user. - if (0 < cDependencies) - { - hr = CreateDependencyRecord(msierrDependencyMissingDependencies, rgDependencies, cDependencies, &hDependencyRec); - ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyMissingDependencies); - - // Send a yes/no message with a warning icon since continuing could be detrimental. - // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding - // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. - er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); - switch (er) - { - // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. - case IDYES: - ExitFunction1(hr = S_OK); - - // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. - case IDNO: - WcaSetReturnValue(ERROR_INSTALL_USEREXIT); - ExitFunction1(hr = S_OK); - - // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. - case IDCANCEL: - __fallthrough; - - // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. - case IDOK: - __fallthrough; - - // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. - case IDNOACTION: - WcaSetReturnValue(ERROR_INSTALL_FAILURE); - ExitFunction1(hr = S_OK); - - default: - ExitOnFailure(hr = E_UNEXPECTED, "Unexpected message response %d from user or bootstrapper application.", er); - } - } - -LExit: - ReleaseDependencyArray(rgDependencies, cDependencies); - ReleaseStr(sczId); - ReleaseStr(sczComponent); - ReleaseStr(sczProviderKey); - ReleaseStr(sczMinVersion); - ReleaseStr(sczMaxVersion); - ReleaseDict(sdDependencies); - - return hr; -} - -/*************************************************************************** - EnsureAbsentDependents - Checks that there are no dependents - registered for providers that are being uninstalled. - - Note: Skipped if UPGRADINGPRODUCTCODE is set. -***************************************************************************/ -static HRESULT EnsureAbsentDependents( - __in MSIHANDLE /*hInstall*/, - __in BOOL fMachineContext - ) -{ - HRESULT hr = S_OK; - DWORD er = ERROR_SUCCESS; - STRINGDICT_HANDLE sdIgnoredDependents = NULL; - HKEY hkHive = NULL; - PMSIHANDLE hView = NULL; - PMSIHANDLE hRec = NULL; - LPWSTR sczId = NULL; - LPWSTR sczComponent = NULL; - LPWSTR sczProviderKey = NULL; - int iAttributes = 0; - WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; - DEPENDENCY* rgDependents = NULL; - UINT cDependents = 0; - PMSIHANDLE hDependencyRec = NULL; - - // Skip the dependent check if the WixDependencyProvider table is missing (no dependency providers). - hr = WcaTableExists(L"WixDependencyProvider"); - if (S_FALSE == hr) - { - WcaLog(LOGMSG_STANDARD, "Skipping the dependents check since no dependency providers are authored."); - ExitFunction1(hr = S_OK); - } - - ExitOnFailure(hr, "Failed to check if the WixDependencyProvider table exists."); - - // Split the IGNOREDEPENDENCIES property for use below if set. If it is "ALL", then quit now. - hr = SplitIgnoredDependents(&sdIgnoredDependents); - ExitOnFailure(hr, "Failed to get the ignored dependents."); - - hr = DictKeyExists(sdIgnoredDependents, L"ALL"); - if (E_NOTFOUND != hr) - { - ExitOnFailure(hr, "Failed to check if \"ALL\" was set in IGNOREDEPENDENCIES."); - - // Otherwise... - WcaLog(LOGMSG_STANDARD, "Skipping the dependencies check since IGNOREDEPENDENCIES contains \"ALL\"."); - ExitFunction(); - } - else - { - // Key was not found, so proceed. - hr = S_OK; - } - - // Set the registry hive to use depending on install context. - hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; - - // Loop over the provider components. - hr = WcaOpenExecuteView(vcsDependencyProviderQuery, &hView); - ExitOnFailure(hr, "Failed to open the query view for dependency providers."); - - while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) - { - hr = WcaGetRecordString(hRec, dpqId, &sczId); - ExitOnFailure(hr, "Failed to get WixDependencyProvider.WixDependencyProvider."); - - hr = WcaGetRecordString(hRec, dpqComponent, &sczComponent); - ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component."); - - // Skip the current component if its not being uninstalled. - tComponentAction = WcaGetComponentToDo(sczComponent); - if (WCA_TODO_UNINSTALL != tComponentAction) - { - WcaLog(LOGMSG_STANDARD, "Skipping dependents check for %ls because the component %ls is not being uninstalled.", sczId, sczComponent); - continue; - } - - hr = WcaGetRecordString(hRec, dpqProviderKey, &sczProviderKey); - ExitOnFailure(hr, "Failed to get WixDependencyProvider.ProviderKey."); - - hr = WcaGetRecordInteger(hRec, dpqAttributes, &iAttributes); - ExitOnFailure(hr, "Failed to get WixDependencyProvider.Attributes."); - - // Check the registry to see if the provider has any dependents registered. - hr = DepCheckDependents(hkHive, sczProviderKey, iAttributes, sdIgnoredDependents, &rgDependents, &cDependents); - ExitOnFailure(hr, "Failed dependents check for %ls.", sczId); - } - - if (E_NOMOREITEMS != hr) - { - ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency provider query view."); - } - else - { - hr = S_OK; - } - - // If we collected any providers with dependents in the previous check, pump a message and prompt the user. - if (0 < cDependents) - { - hr = CreateDependencyRecord(msierrDependencyHasDependents, rgDependents, cDependents, &hDependencyRec); - ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyHasDependents); - - // Send a yes/no message with a warning icon since continuing could be detrimental. - // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding - // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. - er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); - switch (er) - { - // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. - case IDYES: - ExitFunction1(hr = S_OK); - - // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. - case IDNO: - __fallthrough; - - // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. - case IDOK: - __fallthrough; - - // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. - case IDNOACTION: - WcaSetReturnValue(ERROR_NO_MORE_ITEMS); - ExitFunction1(hr = S_OK); - - // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. - case IDCANCEL: - WcaSetReturnValue(ERROR_INSTALL_FAILURE); - ExitFunction1(hr = S_OK); - - default: - hr = E_UNEXPECTED; - ExitOnFailure(hr, "Unexpected message response %d from user or bootstrapper application.", er); - } - } - -LExit: - ReleaseDependencyArray(rgDependents, cDependents); - ReleaseStr(sczId); - ReleaseStr(sczComponent); - ReleaseStr(sczProviderKey); - - return hr; -} - -/*************************************************************************** - SplitIgnoredDependents - Splits the IGNOREDEPENDENCIES property into a map. - -***************************************************************************/ -static HRESULT SplitIgnoredDependents( - __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents - ) -{ - HRESULT hr = S_OK; - LPWSTR sczIgnoreDependencies = NULL; - LPCWSTR wzDelim = L";"; - LPWSTR wzContext = NULL; - - hr = WcaGetProperty(L"IGNOREDEPENDENCIES", &sczIgnoreDependencies); - ExitOnFailure(hr, "Failed to get the string value of the IGNOREDEPENDENCIES property."); - - hr = DictCreateStringList(psdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); - ExitOnFailure(hr, "Failed to create the string dictionary."); - - // Parse through the semicolon-delimited tokens and add to the string dictionary. - for (LPCWSTR wzToken = ::wcstok_s(sczIgnoreDependencies, wzDelim, &wzContext); wzToken; wzToken = ::wcstok_s(NULL, wzDelim, &wzContext)) - { - hr = DictAddKey(*psdIgnoredDependents, wzToken); - ExitOnFailure(hr, "Failed to ignored dependency \"%ls\" to the string dictionary.", wzToken); - } - -LExit: - ReleaseStr(sczIgnoreDependencies); - - return hr; -} - -/*************************************************************************** - CreateDependencyRecord - Creates a record containing the message template - and records to send to the UI handler. - - Notes: Callers should call WcaProcessMessage and handle return codes. -***************************************************************************/ -static HRESULT CreateDependencyRecord( - __in int iMessageId, - __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, - __in UINT cDependencies, - __out MSIHANDLE *phRecord - ) -{ - HRESULT hr = S_OK; - UINT er = ERROR_SUCCESS; - UINT cParams = 0; - UINT iParam = 0; - - // Should not be PMSIHANDLE. - MSIHANDLE hRec = NULL; - - // Calculate the number of parameters based on the format: - // msgId, count, key1, name1, key2, name2, etc. - cParams = 2 + 2 * cDependencies; - - hRec = ::MsiCreateRecord(cParams); - ExitOnNull(hRec, hr, E_OUTOFMEMORY, "Not enough memory to create the message record."); - - er = ::MsiRecordSetInteger(hRec, ++iParam, iMessageId); - ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the message identifier into the message record."); - - er = ::MsiRecordSetInteger(hRec, ++iParam, cDependencies); - ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the number of dependencies into the message record."); - - // Now loop through each dependency and add the key and name to the record. - for (UINT i = 0; i < cDependencies; i++) - { - const DEPENDENCY* pDependency = &rgDependencies[i]; - - // Log message type-specific information. - switch (iMessageId) - { - // Send a user message when installing a component that is missing some dependencies. - case msierrDependencyMissingDependencies: - WcaLog(LOGMSG_VERBOSE, "The dependency \"%ls\" is missing or is not the required version.", pDependency->sczKey); - break; - - // Send a user message when uninstalling a component that still has registered dependents. - case msierrDependencyHasDependents: - WcaLog(LOGMSG_VERBOSE, "Found dependent \"%ls\", name: \"%ls\".", pDependency->sczKey, LogDependencyName(pDependency->sczName)); - break; - } - - er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczKey); - ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency key \"%ls\" into the message record.", pDependency->sczKey); - - er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczName); - ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency name \"%ls\" into the message record.", pDependency->sczName); - } - - // Only assign the out parameter if successful to this point. - *phRecord = hRec; - hRec = NULL; - -LExit: - if (hRec) - { - ::MsiCloseHandle(hRec); - } - - return hr; -} - -/*************************************************************************** - LogDependencyName - Returns the dependency name or "Unknown" if null. - -***************************************************************************/ -static LPCWSTR LogDependencyName( - __in_z LPCWSTR wzName - ) -{ - return wzName ? wzName : L"Unknown"; -} diff --git a/src/ca/wixdepca.def b/src/ca/wixdepca.def deleted file mode 100644 index 651c6373..00000000 --- a/src/ca/wixdepca.def +++ /dev/null @@ -1,8 +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. - - -LIBRARY "dependencyca" - -EXPORTS - WixDependencyRequire - WixDependencyCheck diff --git a/src/ext/Dependency/Dependency.wixext.sln b/src/ext/Dependency/Dependency.wixext.sln new file mode 100644 index 00000000..e771ddf6 --- /dev/null +++ b/src/ext/Dependency/Dependency.wixext.sln @@ -0,0 +1,61 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30204.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dependencyca", "src\ca\dependencyca.vcxproj", "{B86AF46C-0F90-49CC-923F-A800B088D015}" +EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "dependency", "src\wixlib\dependency.wixproj", "{58ED0EC8-73F8-4EE1-8664-A53486D38EC8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dependency.wixext", "src\wixext\WixToolset.Dependency.wixext.csproj", "{A0B6D3F1-AE5E-423B-BA92-60C9926CA498}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Dependency", "src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj", "{E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|Any CPU.Build.0 = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.ActiveCfg = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Debug|x86.Build.0 = Debug|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.ActiveCfg = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|Any CPU.Build.0 = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.ActiveCfg = Release|Win32 + {B86AF46C-0F90-49CC-923F-A800B088D015}.Release|x86.Build.0 = Release|Win32 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.ActiveCfg = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|Any CPU.Build.0 = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.ActiveCfg = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Debug|x86.Build.0 = Debug|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.ActiveCfg = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|Any CPU.Build.0 = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.ActiveCfg = Release|x86 + {58ED0EC8-73F8-4EE1-8664-A53486D38EC8}.Release|x86.Build.0 = Release|x86 + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.ActiveCfg = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Debug|x86.Build.0 = Debug|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|Any CPU.Build.0 = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.ActiveCfg = Release|Any CPU + {A0B6D3F1-AE5E-423B-BA92-60C9926CA498}.Release|x86.Build.0 = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Debug|x86.Build.0 = Debug|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|Any CPU.Build.0 = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.ActiveCfg = Release|Any CPU + {E2AB6AA2-359D-4305-92B0-D90C8F87AF9B}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {77F012B1-8E94-4F85-9450-066C6BD15000} + EndGlobalSection +EndGlobal diff --git a/src/ext/Dependency/Directory.Build.props b/src/ext/Dependency/Directory.Build.props new file mode 100644 index 00000000..b3c6287c --- /dev/null +++ b/src/ext/Dependency/Directory.Build.props @@ -0,0 +1,27 @@ + + + + + + Debug + false + MSB3246 + + $(MSBuildProjectName) + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\build\)) + $(BaseOutputPath)obj\$(ProjectName)\ + $(BaseOutputPath)$(Configuration)\ + + WiX Toolset Team + WiX Toolset + Copyright (c) .NET Foundation and contributors. All rights reserved. + MS-RL + WiX Toolset + + + + + diff --git a/src/ext/Dependency/Directory.Build.targets b/src/ext/Dependency/Directory.Build.targets new file mode 100644 index 00000000..2fcc765a --- /dev/null +++ b/src/ext/Dependency/Directory.Build.targets @@ -0,0 +1,51 @@ + + + + + + + true + $(SolutionPath) + $(NCrunchOriginalSolutionPath) + + + + + + + $([System.IO.File]::ReadAllText($(TheSolutionPath))) + $([System.IO.Path]::GetDirectoryName( $(TheSolutionPath) )) + (?<="[PackageName]", ")(.*)(?=", ") + + + + + + %(Identity) + $(SolutionFileContent.Contains('\%(Identity).csproj')) + + + + + $(RegexPattern.Replace('[PackageName]','%(PackageName)') ) + $([System.Text.RegularExpressions.Regex]::Match('$(SolutionFileContent)', '%(Pattern)')) + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/Directory.csproj.props b/src/ext/Dependency/Directory.csproj.props new file mode 100644 index 00000000..81d24ad1 --- /dev/null +++ b/src/ext/Dependency/Directory.csproj.props @@ -0,0 +1,13 @@ + + + + + true + true + $([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk)) + false + + diff --git a/src/ext/Dependency/Directory.csproj.targets b/src/ext/Dependency/Directory.csproj.targets new file mode 100644 index 00000000..c3270426 --- /dev/null +++ b/src/ext/Dependency/Directory.csproj.targets @@ -0,0 +1,26 @@ + + + + + false + $(OutputPath)\$(AssemblyName).xml + + + + + $(PrivateRepositoryUrl.Replace('.git','')) + + $(MSBuildProjectName).nuspec + $(OutputPath)..\ + $(NuspecProperties);Id=$(PackageId);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description);Title=$(Title) + $(NuspecProperties);Version=$(PackageVersion);RepositoryCommit=$(SourceRevisionId);RepositoryType=$(RepositoryType);RepositoryUrl=$(PrivateRepositoryUrl);ProjectFolder=$(MSBuildProjectDirectory)\;ProjectUrl=$(ProjectUrl) + true + snupkg + + + + diff --git a/src/ext/Dependency/Directory.vcxproj.props b/src/ext/Dependency/Directory.vcxproj.props new file mode 100644 index 00000000..664bc1d8 --- /dev/null +++ b/src/ext/Dependency/Directory.vcxproj.props @@ -0,0 +1,93 @@ + + + + + + Win32 + $(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\ + $(OutputPath)$(Platform)\ + + + $(Company) + $(Copyright) + + win-x86;win-x64;win-arm64 + native,Version=v0.0 + + + + $([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0')) + + + + + $(DisableSpecificCompilerWarnings) + Level4 + $(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories) + WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + Use + precomp.h + StdCall + true + false + -YlprecompDefine + /Zc:threadSafeInit- %(AdditionalOptions) + true + + + $(ArmPreprocessorDefinitions);%(PreprocessorDefinitions) + $(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories) + + + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories) + + + $(ProjectSubSystem) + $(ProjectModuleDefinitionFile) + $(ResourceOnlyDll) + true + $(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies) + $(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories) + /IGNORE:4099 %(AdditionalOptions) + + + + + + NoExtensions + + + + + CDecl + + + + + OldStyle + true + true + + + + + Disabled + EnableFastChecks + _DEBUG;DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + MinSpace + NDEBUG;%(PreprocessorDefinitions) + true + true + MultiThreaded + + + true + true + + + diff --git a/src/ext/Dependency/README.md b/src/ext/Dependency/README.md new file mode 100644 index 00000000..09feba68 --- /dev/null +++ b/src/ext/Dependency/README.md @@ -0,0 +1,2 @@ +# Dependency.wixext +WixToolset.Dependency.wixext - Dependency WiX Toolset Extension diff --git a/src/ext/Dependency/appveyor.cmd b/src/ext/Dependency/appveyor.cmd new file mode 100644 index 00000000..3450d535 --- /dev/null +++ b/src/ext/Dependency/appveyor.cmd @@ -0,0 +1,19 @@ +@setlocal +@pushd %~dp0 +@set _C=Release +@if /i "%1"=="debug" set _C=Debug + +:: Restore +msbuild -p:Configuration=%_C% -t:Restore || exit /b + +:: Build +msbuild -p:Configuration=%_C% src\test\WixToolsetTest.Dependency\WixToolsetTest.Dependency.csproj || exit /b + +:: Test +dotnet test -c %_C% --no-build src\test\WixToolsetTest.Dependency || exit /b + +:: Pack +msbuild -p:Configuration=%_C% -p:NoBuild=true -t:Pack src\wixext\WixToolset.Dependency.wixext.csproj || exit /b + +@popd +@endlocal diff --git a/src/ext/Dependency/appveyor.yml b/src/ext/Dependency/appveyor.yml new file mode 100644 index 00000000..c53cc9cc --- /dev/null +++ b/src/ext/Dependency/appveyor.yml @@ -0,0 +1,42 @@ +# 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. +# +# Do NOT modify this file. Update the canonical version in Home\repo-template\src\appveyor.yml +# then update all of the repos. + +branches: + only: + - master + - develop + +image: Visual Studio 2019 + +version: 0.0.0.{build} +configuration: Release + +environment: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_XMLDOC_MODE: skip + +build_script: + - appveyor.cmd + +pull_requests: + do_not_increment_build_number: true + +nuget: + disable_publish_on_pr: true + +skip_branch_with_pr: true +skip_tags: true + +artifacts: +- path: build\Release\**\*.nupkg + name: nuget +- path: build\Release\**\*.snupkg + name: snupkg + +notifications: +- provider: Slack + incoming_webhook: + secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA= diff --git a/src/ext/Dependency/ca/custommsierrors.h b/src/ext/Dependency/ca/custommsierrors.h new file mode 100644 index 00000000..26450452 --- /dev/null +++ b/src/ext/Dependency/ca/custommsierrors.h @@ -0,0 +1,5 @@ +#pragma once +// 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. + +#define msierrDependencyMissingDependencies 26451 +#define msierrDependencyHasDependents 26452 diff --git a/src/ext/Dependency/ca/dependencyca.vcxproj b/src/ext/Dependency/ca/dependencyca.vcxproj new file mode 100644 index 00000000..2a0760d6 --- /dev/null +++ b/src/ext/Dependency/ca/dependencyca.vcxproj @@ -0,0 +1,73 @@ + + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + + {B86AF46C-0F90-49CC-923F-A800B088D015} + DynamicLibrary + v142 + Unicode + dependencyca + wixdepca.def + WiX Toolset Dependency CustomAction + 10.0 + + + + + + + msi.lib + + + + + Create + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/ca/dependencyca.vcxproj.filters b/src/ext/Dependency/ca/dependencyca.vcxproj.filters new file mode 100644 index 00000000..bfe457e2 --- /dev/null +++ b/src/ext/Dependency/ca/dependencyca.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Source Files + + + + \ No newline at end of file diff --git a/src/ext/Dependency/ca/dllmain.cpp b/src/ext/Dependency/ca/dllmain.cpp new file mode 100644 index 00000000..7d299feb --- /dev/null +++ b/src/ext/Dependency/ca/dllmain.cpp @@ -0,0 +1,27 @@ +// 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. + +#include "precomp.h" + +/******************************************************************** +DllMain - standard entry point for all WiX custom actions. + +********************************************************************/ +extern "C" BOOL WINAPI DllMain( + IN HINSTANCE hInstance, + IN ULONG ulReason, + IN LPVOID) +{ + switch(ulReason) + { + case DLL_PROCESS_ATTACH: + WcaGlobalInitialize(hInstance); + ::DisableThreadLibraryCalls(hInstance); + break; + + case DLL_PROCESS_DETACH: + WcaGlobalFinalize(); + break; + } + + return TRUE; +} diff --git a/src/ext/Dependency/ca/precomp.h b/src/ext/Dependency/ca/precomp.h new file mode 100644 index 00000000..5fd06cff --- /dev/null +++ b/src/ext/Dependency/ca/precomp.h @@ -0,0 +1,18 @@ +#pragma once +// 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. + + +#include +#include +#include +#include + +#include "wcautil.h" +#include "fileutil.h" +#include "strutil.h" +#include "memutil.h" +#include "regutil.h" +#include "dictutil.h" +#include "deputil.h" + +#include "CustomMsiErrors.h" diff --git a/src/ext/Dependency/ca/wixdepca.cpp b/src/ext/Dependency/ca/wixdepca.cpp new file mode 100644 index 00000000..d6433707 --- /dev/null +++ b/src/ext/Dependency/ca/wixdepca.cpp @@ -0,0 +1,516 @@ +// 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. + +#include "precomp.h" + +#define IDNOACTION 0 +#define INITIAL_STRINGDICT_SIZE 4 + +LPCWSTR vcsDependencyProviderQuery = + L"SELECT `WixDependencyProvider`.`WixDependencyProvider`, `WixDependencyProvider`.`Component_`, `WixDependencyProvider`.`ProviderKey`, `WixDependencyProvider`.`Attributes` " + L"FROM `WixDependencyProvider`"; +enum eDependencyProviderQuery { dpqId = 1, dpqComponent, dpqProviderKey, dpqAttributes }; + +LPCWSTR vcsDependencyQuery = + L"SELECT `WixDependency`.`WixDependency`, `WixDependencyProvider`.`Component_`, `WixDependency`.`ProviderKey`, `WixDependency`.`MinVersion`, `WixDependency`.`MaxVersion`, `WixDependency`.`Attributes` " + L"FROM `WixDependencyProvider`, `WixDependency`, `WixDependencyRef` " + L"WHERE `WixDependency`.`WixDependency` = `WixDependencyRef`.`WixDependency_` AND `WixDependencyProvider`.`WixDependencyProvider` = `WixDependencyRef`.`WixDependencyProvider_`"; +enum eDependencyComponentQuery { dqId = 1, dqComponent, dqProviderKey, dqMinVersion, dqMaxVersion, dqAttributes }; + +static HRESULT EnsureRequiredDependencies( + __in MSIHANDLE hInstall, + __in BOOL fMachineContext + ); + +static HRESULT EnsureAbsentDependents( + __in MSIHANDLE hInstall, + __in BOOL fMachineContext + ); + +static HRESULT SplitIgnoredDependents( + __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents + ); + +static HRESULT CreateDependencyRecord( + __in int iMessageId, + __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, + __in UINT cDependencies, + __out MSIHANDLE *phRecord + ); + +static LPCWSTR LogDependencyName( + __in_z LPCWSTR wzName + ); + +/*************************************************************************** + WixDependencyRequire - Checks that all required dependencies are installed. + +***************************************************************************/ +extern "C" UINT __stdcall WixDependencyRequire( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + BOOL fMachineContext = FALSE; + + hr = WcaInitialize(hInstall, "WixDependencyRequire"); + ExitOnFailure(hr, "Failed to initialize."); + + hr = RegInitialize(); + ExitOnFailure(hr, "Failed to initialize the registry functions."); + + // Determine whether we're installing per-user or per-machine. + fMachineContext = WcaIsPropertySet("ALLUSERS"); + + // Check for any provider components being (re)installed that their requirements are already installed. + hr = EnsureRequiredDependencies(hInstall, fMachineContext); + ExitOnFailure(hr, "Failed to ensure required dependencies for (re)installing components."); + +LExit: + RegUninitialize(); + + er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; + return WcaFinalize(er); +} + +/*************************************************************************** + WixDependencyCheck - Check dependencies based on component state. + + Note: may return ERROR_NO_MORE_ITEMS to terminate the session early. +***************************************************************************/ +extern "C" UINT __stdcall WixDependencyCheck( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + BOOL fMachineContext = FALSE; + + hr = WcaInitialize(hInstall, "WixDependencyCheck"); + ExitOnFailure(hr, "Failed to initialize."); + + hr = RegInitialize(); + ExitOnFailure(hr, "Failed to initialize the registry functions."); + + // Determine whether we're installing per-user or per-machine. + fMachineContext = WcaIsPropertySet("ALLUSERS"); + + // Check for any dependents of provider components being uninstalled. + hr = EnsureAbsentDependents(hInstall, fMachineContext); + ExitOnFailure(hr, "Failed to ensure absent dependents for uninstalling components."); + +LExit: + RegUninitialize(); + + er = FAILED(hr) ? ERROR_INSTALL_FAILURE : ERROR_SUCCESS; + return WcaFinalize(er); +} + +/*************************************************************************** + EnsureRequiredDependencies - Check that dependencies are installed for + any provider component that is being installed or reinstalled. + + Note: Skipped if DISABLEDEPENDENCYCHECK is set. +***************************************************************************/ +static HRESULT EnsureRequiredDependencies( + __in MSIHANDLE /*hInstall*/, + __in BOOL fMachineContext + ) +{ + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + STRINGDICT_HANDLE sdDependencies = NULL; + HKEY hkHive = NULL; + PMSIHANDLE hView = NULL; + PMSIHANDLE hRec = NULL; + LPWSTR sczId = NULL; + LPWSTR sczComponent = NULL; + LPWSTR sczProviderKey = NULL; + LPWSTR sczMinVersion = NULL; + LPWSTR sczMaxVersion = NULL; + int iAttributes = 0; + WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; + DEPENDENCY* rgDependencies = NULL; + UINT cDependencies = 0; + PMSIHANDLE hDependencyRec = NULL; + + // Skip the dependency check if the WixDependency table is missing (no dependencies to check for). + hr = WcaTableExists(L"WixDependency"); + if (S_FALSE == hr) + { + WcaLog(LOGMSG_STANDARD, "Skipping the dependency check since no dependencies are authored."); + ExitFunction1(hr = S_OK); + } + + // If the table exists but not the others, the database was not authored correctly. + ExitOnFailure(hr, "Failed to check if the WixDependency table exists."); + + // Initialize the dictionary to keep track of unique dependency keys. + hr = DictCreateStringList(&sdDependencies, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); + ExitOnFailure(hr, "Failed to initialize the unique dependency string list."); + + // Set the registry hive to use depending on install context. + hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + + // Loop over the provider components. + hr = WcaOpenExecuteView(vcsDependencyQuery, &hView); + ExitOnFailure(hr, "Failed to open the query view for dependencies."); + + while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) + { + hr = WcaGetRecordString(hRec, dqId, &sczId); + ExitOnFailure(hr, "Failed to get WixDependency.WixDependency."); + + hr = WcaGetRecordString(hRec, dqComponent, &sczComponent); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component_."); + + // Skip the current component if its not being installed or reinstalled. + tComponentAction = WcaGetComponentToDo(sczComponent); + if (WCA_TODO_INSTALL != tComponentAction && WCA_TODO_REINSTALL != tComponentAction) + { + WcaLog(LOGMSG_STANDARD, "Skipping dependency check for %ls because the component %ls is not being (re)installed.", sczId, sczComponent); + continue; + } + + hr = WcaGetRecordString(hRec, dqProviderKey, &sczProviderKey); + ExitOnFailure(hr, "Failed to get WixDependency.ProviderKey."); + + hr = WcaGetRecordString(hRec, dqMinVersion, &sczMinVersion); + ExitOnFailure(hr, "Failed to get WixDependency.MinVersion."); + + hr = WcaGetRecordString(hRec, dqMaxVersion, &sczMaxVersion); + ExitOnFailure(hr, "Failed to get WixDependency.MaxVersion."); + + hr = WcaGetRecordInteger(hRec, dqAttributes, &iAttributes); + ExitOnFailure(hr, "Failed to get WixDependency.Attributes."); + + // Check the registry to see if the required providers (dependencies) exist. + hr = DepCheckDependency(hkHive, sczProviderKey, sczMinVersion, sczMaxVersion, iAttributes, sdDependencies, &rgDependencies, &cDependencies); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed dependency check for %ls.", sczId); + } + } + + if (E_NOMOREITEMS != hr) + { + ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency query view."); + } + else + { + hr = S_OK; + } + + // If we collected any dependencies in the previous check, pump a message and prompt the user. + if (0 < cDependencies) + { + hr = CreateDependencyRecord(msierrDependencyMissingDependencies, rgDependencies, cDependencies, &hDependencyRec); + ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyMissingDependencies); + + // Send a yes/no message with a warning icon since continuing could be detrimental. + // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding + // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); + switch (er) + { + // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. + case IDYES: + ExitFunction1(hr = S_OK); + + // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. + case IDNO: + WcaSetReturnValue(ERROR_INSTALL_USEREXIT); + ExitFunction1(hr = S_OK); + + // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. + case IDCANCEL: + __fallthrough; + + // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. + case IDOK: + __fallthrough; + + // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. + case IDNOACTION: + WcaSetReturnValue(ERROR_INSTALL_FAILURE); + ExitFunction1(hr = S_OK); + + default: + ExitOnFailure(hr = E_UNEXPECTED, "Unexpected message response %d from user or bootstrapper application.", er); + } + } + +LExit: + ReleaseDependencyArray(rgDependencies, cDependencies); + ReleaseStr(sczId); + ReleaseStr(sczComponent); + ReleaseStr(sczProviderKey); + ReleaseStr(sczMinVersion); + ReleaseStr(sczMaxVersion); + ReleaseDict(sdDependencies); + + return hr; +} + +/*************************************************************************** + EnsureAbsentDependents - Checks that there are no dependents + registered for providers that are being uninstalled. + + Note: Skipped if UPGRADINGPRODUCTCODE is set. +***************************************************************************/ +static HRESULT EnsureAbsentDependents( + __in MSIHANDLE /*hInstall*/, + __in BOOL fMachineContext + ) +{ + HRESULT hr = S_OK; + DWORD er = ERROR_SUCCESS; + STRINGDICT_HANDLE sdIgnoredDependents = NULL; + HKEY hkHive = NULL; + PMSIHANDLE hView = NULL; + PMSIHANDLE hRec = NULL; + LPWSTR sczId = NULL; + LPWSTR sczComponent = NULL; + LPWSTR sczProviderKey = NULL; + int iAttributes = 0; + WCA_TODO tComponentAction = WCA_TODO_UNKNOWN; + DEPENDENCY* rgDependents = NULL; + UINT cDependents = 0; + PMSIHANDLE hDependencyRec = NULL; + + // Skip the dependent check if the WixDependencyProvider table is missing (no dependency providers). + hr = WcaTableExists(L"WixDependencyProvider"); + if (S_FALSE == hr) + { + WcaLog(LOGMSG_STANDARD, "Skipping the dependents check since no dependency providers are authored."); + ExitFunction1(hr = S_OK); + } + + ExitOnFailure(hr, "Failed to check if the WixDependencyProvider table exists."); + + // Split the IGNOREDEPENDENCIES property for use below if set. If it is "ALL", then quit now. + hr = SplitIgnoredDependents(&sdIgnoredDependents); + ExitOnFailure(hr, "Failed to get the ignored dependents."); + + hr = DictKeyExists(sdIgnoredDependents, L"ALL"); + if (E_NOTFOUND != hr) + { + ExitOnFailure(hr, "Failed to check if \"ALL\" was set in IGNOREDEPENDENCIES."); + + // Otherwise... + WcaLog(LOGMSG_STANDARD, "Skipping the dependencies check since IGNOREDEPENDENCIES contains \"ALL\"."); + ExitFunction(); + } + else + { + // Key was not found, so proceed. + hr = S_OK; + } + + // Set the registry hive to use depending on install context. + hkHive = fMachineContext ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + + // Loop over the provider components. + hr = WcaOpenExecuteView(vcsDependencyProviderQuery, &hView); + ExitOnFailure(hr, "Failed to open the query view for dependency providers."); + + while (S_OK == (hr = WcaFetchRecord(hView, &hRec))) + { + hr = WcaGetRecordString(hRec, dpqId, &sczId); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.WixDependencyProvider."); + + hr = WcaGetRecordString(hRec, dpqComponent, &sczComponent); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Component."); + + // Skip the current component if its not being uninstalled. + tComponentAction = WcaGetComponentToDo(sczComponent); + if (WCA_TODO_UNINSTALL != tComponentAction) + { + WcaLog(LOGMSG_STANDARD, "Skipping dependents check for %ls because the component %ls is not being uninstalled.", sczId, sczComponent); + continue; + } + + hr = WcaGetRecordString(hRec, dpqProviderKey, &sczProviderKey); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.ProviderKey."); + + hr = WcaGetRecordInteger(hRec, dpqAttributes, &iAttributes); + ExitOnFailure(hr, "Failed to get WixDependencyProvider.Attributes."); + + // Check the registry to see if the provider has any dependents registered. + hr = DepCheckDependents(hkHive, sczProviderKey, iAttributes, sdIgnoredDependents, &rgDependents, &cDependents); + ExitOnFailure(hr, "Failed dependents check for %ls.", sczId); + } + + if (E_NOMOREITEMS != hr) + { + ExitOnFailure(hr, "Failed to enumerate all of the rows in the dependency provider query view."); + } + else + { + hr = S_OK; + } + + // If we collected any providers with dependents in the previous check, pump a message and prompt the user. + if (0 < cDependents) + { + hr = CreateDependencyRecord(msierrDependencyHasDependents, rgDependents, cDependents, &hDependencyRec); + ExitOnFailure(hr, "Failed to create the dependency record for message %d.", msierrDependencyHasDependents); + + // Send a yes/no message with a warning icon since continuing could be detrimental. + // This is sent as a USER message to better detect whether a user or dependency-aware bootstrapper is responding + // or if Windows Installer or a dependency-unaware boostrapper is returning a typical default response. + er = WcaProcessMessage(static_cast(INSTALLMESSAGE_USER | MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2), hDependencyRec); + switch (er) + { + // Only a user or dependency-aware bootstrapper that prompted the user should return IDYES to continue anyway. + case IDYES: + ExitFunction1(hr = S_OK); + + // Only a user or dependency-aware bootstrapper that prompted the user should return IDNO to terminate the operation. + case IDNO: + __fallthrough; + + // Bootstrappers which are not dependency-aware may return IDOK for unhandled messages. + case IDOK: + __fallthrough; + + // Windows Installer returns 0 for USER messages when silent or passive, or when a bootstrapper does not handle the message. + case IDNOACTION: + WcaSetReturnValue(ERROR_NO_MORE_ITEMS); + ExitFunction1(hr = S_OK); + + // A dependency-aware bootstrapper should return IDCANCEL if running silently and the operation should be canceled. + case IDCANCEL: + WcaSetReturnValue(ERROR_INSTALL_FAILURE); + ExitFunction1(hr = S_OK); + + default: + hr = E_UNEXPECTED; + ExitOnFailure(hr, "Unexpected message response %d from user or bootstrapper application.", er); + } + } + +LExit: + ReleaseDependencyArray(rgDependents, cDependents); + ReleaseStr(sczId); + ReleaseStr(sczComponent); + ReleaseStr(sczProviderKey); + + return hr; +} + +/*************************************************************************** + SplitIgnoredDependents - Splits the IGNOREDEPENDENCIES property into a map. + +***************************************************************************/ +static HRESULT SplitIgnoredDependents( + __deref_inout STRINGDICT_HANDLE* psdIgnoredDependents + ) +{ + HRESULT hr = S_OK; + LPWSTR sczIgnoreDependencies = NULL; + LPCWSTR wzDelim = L";"; + LPWSTR wzContext = NULL; + + hr = WcaGetProperty(L"IGNOREDEPENDENCIES", &sczIgnoreDependencies); + ExitOnFailure(hr, "Failed to get the string value of the IGNOREDEPENDENCIES property."); + + hr = DictCreateStringList(psdIgnoredDependents, INITIAL_STRINGDICT_SIZE, DICT_FLAG_CASEINSENSITIVE); + ExitOnFailure(hr, "Failed to create the string dictionary."); + + // Parse through the semicolon-delimited tokens and add to the string dictionary. + for (LPCWSTR wzToken = ::wcstok_s(sczIgnoreDependencies, wzDelim, &wzContext); wzToken; wzToken = ::wcstok_s(NULL, wzDelim, &wzContext)) + { + hr = DictAddKey(*psdIgnoredDependents, wzToken); + ExitOnFailure(hr, "Failed to ignored dependency \"%ls\" to the string dictionary.", wzToken); + } + +LExit: + ReleaseStr(sczIgnoreDependencies); + + return hr; +} + +/*************************************************************************** + CreateDependencyRecord - Creates a record containing the message template + and records to send to the UI handler. + + Notes: Callers should call WcaProcessMessage and handle return codes. +***************************************************************************/ +static HRESULT CreateDependencyRecord( + __in int iMessageId, + __in_ecount(cDependencies) const DEPENDENCY* rgDependencies, + __in UINT cDependencies, + __out MSIHANDLE *phRecord + ) +{ + HRESULT hr = S_OK; + UINT er = ERROR_SUCCESS; + UINT cParams = 0; + UINT iParam = 0; + + // Should not be PMSIHANDLE. + MSIHANDLE hRec = NULL; + + // Calculate the number of parameters based on the format: + // msgId, count, key1, name1, key2, name2, etc. + cParams = 2 + 2 * cDependencies; + + hRec = ::MsiCreateRecord(cParams); + ExitOnNull(hRec, hr, E_OUTOFMEMORY, "Not enough memory to create the message record."); + + er = ::MsiRecordSetInteger(hRec, ++iParam, iMessageId); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the message identifier into the message record."); + + er = ::MsiRecordSetInteger(hRec, ++iParam, cDependencies); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the number of dependencies into the message record."); + + // Now loop through each dependency and add the key and name to the record. + for (UINT i = 0; i < cDependencies; i++) + { + const DEPENDENCY* pDependency = &rgDependencies[i]; + + // Log message type-specific information. + switch (iMessageId) + { + // Send a user message when installing a component that is missing some dependencies. + case msierrDependencyMissingDependencies: + WcaLog(LOGMSG_VERBOSE, "The dependency \"%ls\" is missing or is not the required version.", pDependency->sczKey); + break; + + // Send a user message when uninstalling a component that still has registered dependents. + case msierrDependencyHasDependents: + WcaLog(LOGMSG_VERBOSE, "Found dependent \"%ls\", name: \"%ls\".", pDependency->sczKey, LogDependencyName(pDependency->sczName)); + break; + } + + er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczKey); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency key \"%ls\" into the message record.", pDependency->sczKey); + + er = ::MsiRecordSetStringW(hRec, ++iParam, pDependency->sczName); + ExitOnFailure(hr = HRESULT_FROM_WIN32(er), "Failed to set the dependency name \"%ls\" into the message record.", pDependency->sczName); + } + + // Only assign the out parameter if successful to this point. + *phRecord = hRec; + hRec = NULL; + +LExit: + if (hRec) + { + ::MsiCloseHandle(hRec); + } + + return hr; +} + +/*************************************************************************** + LogDependencyName - Returns the dependency name or "Unknown" if null. + +***************************************************************************/ +static LPCWSTR LogDependencyName( + __in_z LPCWSTR wzName + ) +{ + return wzName ? wzName : L"Unknown"; +} diff --git a/src/ext/Dependency/ca/wixdepca.def b/src/ext/Dependency/ca/wixdepca.def new file mode 100644 index 00000000..651c6373 --- /dev/null +++ b/src/ext/Dependency/ca/wixdepca.def @@ -0,0 +1,8 @@ +; 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. + + +LIBRARY "dependencyca" + +EXPORTS + WixDependencyRequire + WixDependencyCheck diff --git a/src/ext/Dependency/nuget.config b/src/ext/Dependency/nuget.config new file mode 100644 index 00000000..10ef488d --- /dev/null +++ b/src/ext/Dependency/nuget.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Dependency/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/ext/Dependency/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs new file mode 100644 index 00000000..708ae658 --- /dev/null +++ b/src/ext/Dependency/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -0,0 +1,38 @@ +// 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.Dependency +{ + using System.Linq; + using System.Text.RegularExpressions; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Dependency; + using Xunit; + + public class DependencyExtensionFixture + { + [Fact] + public void CanBuildUsingProvides() + { + var folder = TestData.Get(@"TestData\UsingProvides"); + var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); + + var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider") + .Select(r => Regex.Replace(r, "{[^}]*}", "{*}")) + .ToArray(); + WixAssert.CompareLineByLine(new[] + { + "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t", + "CustomAction:Wix4DependencyRequire_X86\t1\tDependencyCA_X86\tWixDependencyRequire\t", + "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", + "WixDependencyProvider:depTpv28q7slcxvXPWmU4Z0GfbiI.4\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\t{*}\t\t\t", + }, results); + } + + private static void Build(string[] args) + { + var result = WixRunner.Execute(args) + .AssertSuccess(); + } + } +} diff --git a/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl b/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl @@ -0,0 +1,11 @@ + + + + + + A newer version of [ProductName] is already installed. + MsiPackage + + diff --git a/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs new file mode 100644 index 00000000..65984395 --- /dev/null +++ b/src/ext/Dependency/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/ext/Dependency/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj new file mode 100644 index 00000000..0b80dc83 --- /dev/null +++ b/src/ext/Dependency/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj @@ -0,0 +1,39 @@ + + + + + + netcoreapp3.1 + embedded + false + + + + NU1701 + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wix.snk b/src/ext/Dependency/wix.snk new file mode 100644 index 00000000..3908a66a Binary files /dev/null and b/src/ext/Dependency/wix.snk differ diff --git a/src/ext/Dependency/wixext/DependencyCompiler.cs b/src/ext/Dependency/wixext/DependencyCompiler.cs new file mode 100644 index 00000000..3d6c84a7 --- /dev/null +++ b/src/ext/Dependency/wixext/DependencyCompiler.cs @@ -0,0 +1,61 @@ +// 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 WixToolset.Dependency +{ + using System.Collections.Generic; + using System.Xml.Linq; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; + + /// + /// The compiler for the WiX Toolset Dependency Extension. + /// + public sealed class DependencyCompiler : BaseCompilerExtension + { + public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/dependency"; + + /// + /// Processes an attribute for the Compiler. + /// + /// Source line number for the parent element. + /// Parent element of attribute. + /// Attribute to process. + public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) + { + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); + var addCheck = YesNoType.NotSet; + var addRequire = YesNoType.NotSet; + + switch (parentElement.Name.LocalName) + { + case "Provides": + if (attribute.Name.LocalName == "Check" && parentElement.Parent?.Name.LocalName == "Component") + { + addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); + } + break; + case "Requires": + case "RequiresRef": + if (attribute.Name.LocalName == "Enforce" && parentElement.Parent?.Parent?.Name.LocalName == "Component") + { + addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); + } + break; + } + + if (addCheck == YesNoType.NotSet && addRequire == YesNoType.NotSet) + { + this.ParseHelper.UnexpectedAttribute(parentElement, attribute); + } + else if (addCheck == YesNoType.Yes) + { + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); + } + else if (addRequire == YesNoType.Yes) + { + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); + } + } + } +} diff --git a/src/ext/Dependency/wixext/DependencyDecompiler.cs b/src/ext/Dependency/wixext/DependencyDecompiler.cs new file mode 100644 index 00000000..31de3097 --- /dev/null +++ b/src/ext/Dependency/wixext/DependencyDecompiler.cs @@ -0,0 +1,347 @@ +// 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 WixToolset.Dependency +{ +#if TODO_CONSIDER_DECOMPILER + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using WixToolset; + using WixToolset.Data; + using WixToolset.Extensibility; + using WixToolset.Extensions.Serialize.Dependency; + using Dependency = WixToolset.Extensions.Serialize.Dependency; + using Wix = WixToolset.Data.Serialize; + + /// + /// The decompiler for the WiX toolset dependency extension. + /// + public sealed class DependencyDecompiler : DecompilerExtension + { + private RegistryKeyValueCollection registryValues; + private Dictionary keyCache; + + /// + /// Creates a new instance of the class. + /// + public DependencyDecompiler() + { + this.registryValues = new RegistryKeyValueCollection(); + this.keyCache = new Dictionary(); + + this.TableDefinitions = DependencyExtensionData.GetExtensionTableDefinitions(); + } + + /// + /// Get the extensions library to be removed. + /// + /// Table definitions for library. + /// Library to remove from decompiled output. + public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) + { + return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); + } + + /// + /// Decompiles an extension table. + /// + /// The table to decompile. + public override void DecompileTable(Table table) + { + switch (table.Name) + { + case "WixDependencyProvider": + this.DecompileWixDependencyProviderTable(table); + break; + + case "WixDependency": + this.DecompileWixDependencyTable(table); + break; + + case "WixDependencyRef": + this.DecompileWixDependencyRefTable(table); + break; + + default: + base.DecompileTable(table); + break; + } + } + + /// + /// Finalize decompilation by removing registry values that the compiler writes. + /// + /// The collection of all tables. + public override void Finish(TableIndexedCollection tables) + { + // Remove generated registry rows. + this.FinalizeRegistryTable(tables); + + // Remove extension properties. + this.FinalizeProperties(); + } + + /// + /// Decompiles the WixDependencyProvider table. + /// + /// The table to decompile. + private void DecompileWixDependencyProviderTable(Table table) + { + foreach (Row row in table.Rows) + { + Provides provides = new Provides(); + + provides.Id = (string)row[0]; + provides.Key = (string)row[2]; + + if (null != row[3]) + { + provides.Version = (string)row[3]; + } + + if (null != row[4]) + { + provides.DisplayName = (string)row[4]; + } + + // Nothing to parse for attributes currently. + + Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); + if (null != component) + { + component.AddChild(provides); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); + } + + // Index the provider to parent the RequiresRef elements. + this.Core.IndexElement(row, provides); + + // Add the provider-specific registry keys to be removed during finalization. + // Only remove specific keys that the compiler writes. + string keyProvides = String.Concat(DependencyCommon.RegistryRoot, provides.Key); + + this.registryValues.Add(keyProvides, null); + this.registryValues.Add(keyProvides, "Version"); + this.registryValues.Add(keyProvides, "DisplayName"); + this.registryValues.Add(keyProvides, "Attributes"); + + // Cache the provider key. + this.keyCache[provides.Id] = provides.Key; + } + } + + /// + /// Decompiles the WixDependency table. + /// + /// The table to decompile. + private void DecompileWixDependencyTable(Table table) + { + foreach (Row row in table.Rows) + { + Requires requires = new Requires(); + + requires.Id = (string)row[0]; + requires.ProviderKey = (string)row[1]; + + if (null != row[2]) + { + requires.Minimum = (string)row[2]; + } + + if (null != row[3]) + { + requires.Maximum = (string)row[3]; + } + + if (null != row[4]) + { + int attributes = (int)row[4]; + + if (0 != (attributes & DependencyCommon.RequiresAttributesMinVersionInclusive)) + { + requires.IncludeMinimum = Dependency.YesNoType.yes; + } + + if (0 != (attributes & DependencyCommon.RequiresAttributesMaxVersionInclusive)) + { + requires.IncludeMaximum = Dependency.YesNoType.yes; + } + } + + this.Core.RootElement.AddChild(requires); + + // Cache the requires key. + this.keyCache[requires.Id] = requires.ProviderKey; + } + } + + /// + /// Decompiles the WixDependencyRef table. + /// + /// The table to decompile. + private void DecompileWixDependencyRefTable(Table table) + { + foreach (Row row in table.Rows) + { + RequiresRef requiresRef = new RequiresRef(); + + requiresRef.Id = (string)row[1]; + + Provides provides = (Provides)this.Core.GetIndexedElement("WixDependencyProvider", (string)row[0]); + if (null != provides) + { + provides.AddChild(requiresRef); + } + else + { + this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "WixDependencyProvider_", (string)row[0], "WixDependencyProvider")); + } + + // Get the cached keys for the provider and dependency IDs and generate registry rows. + string providesKey = null; + string requiresKey = null; + + if (null != provides && this.keyCache.ContainsKey(provides.Id)) + { + providesKey = this.keyCache[provides.Id]; + } + else + { + this.Core.OnMessage(DependencyWarnings.ProvidesKeyNotFound(row.SourceLineNumbers, provides.Id)); + } + + if (this.keyCache.ContainsKey(requiresRef.Id)) + { + requiresKey = this.keyCache[requiresRef.Id]; + } + else + { + this.Core.OnMessage(DependencyWarnings.RequiresKeyNotFound(row.SourceLineNumbers, requiresRef.Id)); + } + + if (!this.Core.EncounteredError) + { + // Add the dependency-specific registry keys to be removed during finalization. + // Only remove specific keys that the compiler writes. + string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); + + this.registryValues.Add(keyRequires, "*"); + this.registryValues.Add(keyRequires, "MinVersion"); + this.registryValues.Add(keyRequires, "MaxVersion"); + this.registryValues.Add(keyRequires, "Attributes"); + } + } + } + + /// + /// Removes rows from the Registry table that are generated by this extension. + /// + /// The collection of tables. + private void FinalizeRegistryTable(TableIndexedCollection tables) + { + Table registryTable = tables["Registry"]; + if (null != registryTable) + { + foreach (Row registryRow in registryTable.Rows) + { + // Check if the compiler writes this registry value; if so, it should be removed. + if (this.registryValues.Contains(registryRow)) + { + Wix.ISchemaElement elem = this.Core.GetIndexedElement(registryRow); + + // If the registry row was found, remove it from its parent. + if (null != elem && null != elem.ParentElement) + { + Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; + if (null != elemParent) + { + elemParent.RemoveChild(elem); + } + } + } + } + } + } + + /// + /// Removes properties defined by this extension. + /// + /// The collection of tables. + private void FinalizeProperties() + { + string[] properties = new string[] { "DISABLEDEPENDENCYCHECK", "IGNOREDEPENDENCIES" }; + foreach (string property in properties) + { + Wix.Property elem = this.Core.GetIndexedElement("Property", property) as Wix.Property; + if (null != elem) + { + // If a value is defined, log a warning we're removing it. + if (!String.IsNullOrEmpty(elem.Value)) + { + this.Core.OnMessage(DependencyWarnings.PropertyRemoved(elem.Id)); + } + + // If the property row was found, remove it from its parent. + if (null != elem.ParentElement) + { + Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; + if (null != elemParent) + { + elemParent.RemoveChild(elem); + } + } + } + } + } + + /// + /// Provides an O(1) lookup for registry key and value name pairs for use in the decompiler. + /// + private sealed class RegistryKeyValueCollection : KeyedCollection> + { + /// + /// Adds the registry key and value name pair to the collection if it doesn't already exist. + /// + /// The registry key to add. + /// The registry value name to add. + internal void Add(string key, string name) + { + KeyValuePair pair = new KeyValuePair(key, name); + if (!this.Contains(pair)) + { + this.Add(pair); + } + } + + /// + /// Returns whether the collection contains the registry key and value name pair from the . + /// + /// The registry to search for. + /// True if the collection contains the registry key and value name pair from the ; otherwise, false. + internal bool Contains(Row row) + { + if (null == row) + { + return false; + } + + KeyValuePair pair = new KeyValuePair((string)row[2], (string)row[3]); + return this.Contains(pair); + } + + /// + /// Return the hash code of the key and value pair concatenated with a colon as a delimiter. + /// + /// The registry key and value name pair. + /// + protected override int GetKeyForItem(KeyValuePair pair) + { + return String.Concat(pair.Key, ":", pair.Value).GetHashCode(); + } + } + } +#endif +} diff --git a/src/ext/Dependency/wixext/DependencyExtensionData.cs b/src/ext/Dependency/wixext/DependencyExtensionData.cs new file mode 100644 index 00000000..2f30c2bf --- /dev/null +++ b/src/ext/Dependency/wixext/DependencyExtensionData.cs @@ -0,0 +1,29 @@ +// 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 WixToolset.Dependency +{ + using WixToolset.Data; + using WixToolset.Extensibility; + + /// + /// The WiX Toolset Dependency Extension. + /// + public sealed class DependencyExtensionData : BaseExtensionData + { + /// + /// Gets the default culture. + /// + /// The default culture. + public override string DefaultCulture => "en-US"; + + /// + /// Gets the contained .wixlib content. + /// + /// Strong typed symbold definitions. + /// The .wixlib. + public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) + { + return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", symbolDefinitions); + } + } +} diff --git a/src/ext/Dependency/wixext/DependencyExtensionFactory.cs b/src/ext/Dependency/wixext/DependencyExtensionFactory.cs new file mode 100644 index 00000000..413f99ae --- /dev/null +++ b/src/ext/Dependency/wixext/DependencyExtensionFactory.cs @@ -0,0 +1,17 @@ +// 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 WixToolset.Dependency +{ + using System; + using System.Collections.Generic; + using WixToolset.Extensibility; + + public class DependencyExtensionFactory : BaseExtensionFactory + { + protected override IReadOnlyCollection ExtensionTypes => new[] + { + typeof(DependencyCompiler), + typeof(DependencyExtensionData), + }; + } +} diff --git a/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.csproj b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.csproj new file mode 100644 index 00000000..b2663231 --- /dev/null +++ b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.csproj @@ -0,0 +1,32 @@ + + + + + + netstandard2.0 + embedded + WixToolset.Dependency + WiX Toolset Dependency Extension + WiX Toolset Dependency Extension + true + true + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.nuspec b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.nuspec new file mode 100644 index 00000000..ba3eaade --- /dev/null +++ b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.nuspec @@ -0,0 +1,25 @@ + + + + $id$ + $version$ + $title$ + $description$ + $authors$ + MS-RL + false + $copyright$ + $projectUrl$ + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.targets b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.targets new file mode 100644 index 00000000..2b298736 --- /dev/null +++ b/src/ext/Dependency/wixext/WixToolset.Dependency.wixext.targets @@ -0,0 +1,11 @@ + + + + + + $(MSBuildThisFileDirectory)..\tools\WixToolset.Dependency.wixext.dll + + + + + diff --git a/src/ext/Dependency/wixlib/DependencyExtension.wxs b/src/ext/Dependency/wixlib/DependencyExtension.wxs new file mode 100644 index 00000000..0516b18c --- /dev/null +++ b/src/ext/Dependency/wixlib/DependencyExtension.wxs @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixlib/DependencyExtension_Platform.wxi b/src/ext/Dependency/wixlib/DependencyExtension_Platform.wxi new file mode 100644 index 00000000..9ab28ef3 --- /dev/null +++ b/src/ext/Dependency/wixlib/DependencyExtension_Platform.wxi @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixlib/DependencyExtension_arm64.wxs b/src/ext/Dependency/wixlib/DependencyExtension_arm64.wxs new file mode 100644 index 00000000..958650e6 --- /dev/null +++ b/src/ext/Dependency/wixlib/DependencyExtension_arm64.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Dependency/wixlib/DependencyExtension_x64.wxs b/src/ext/Dependency/wixlib/DependencyExtension_x64.wxs new file mode 100644 index 00000000..4fe458e8 --- /dev/null +++ b/src/ext/Dependency/wixlib/DependencyExtension_x64.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Dependency/wixlib/DependencyExtension_x86.wxs b/src/ext/Dependency/wixlib/DependencyExtension_x86.wxs new file mode 100644 index 00000000..d8ac6785 --- /dev/null +++ b/src/ext/Dependency/wixlib/DependencyExtension_x86.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ext/Dependency/wixlib/caDecor.wxi b/src/ext/Dependency/wixlib/caDecor.wxi new file mode 100644 index 00000000..b1711518 --- /dev/null +++ b/src/ext/Dependency/wixlib/caDecor.wxi @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixlib/caerr.wxi b/src/ext/Dependency/wixlib/caerr.wxi new file mode 100644 index 00000000..ff7ec121 --- /dev/null +++ b/src/ext/Dependency/wixlib/caerr.wxi @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ext/Dependency/wixlib/dependency.wixproj b/src/ext/Dependency/wixlib/dependency.wixproj new file mode 100644 index 00000000..76e3ecd3 --- /dev/null +++ b/src/ext/Dependency/wixlib/dependency.wixproj @@ -0,0 +1,30 @@ + + + + + + + Library + true + + 1086 + en-us + + + + + + + + + + + + + + + + + + + diff --git a/src/ext/Dependency/wixlib/en-us.wxl b/src/ext/Dependency/wixlib/en-us.wxl new file mode 100644 index 00000000..6ad7d63d --- /dev/null +++ b/src/ext/Dependency/wixlib/en-us.wxl @@ -0,0 +1,7 @@ + + + + + If you continue with this install, the product may not work properly because [2] or more dependencies are missing. Do you want to continue with this install anyway? + If you continue with this uninstall, [2] or more products may stop working properly. Do you want to continue with this uninstall anyway? + diff --git a/src/ext/global.json b/src/ext/global.json new file mode 100644 index 00000000..23d7a5bd --- /dev/null +++ b/src/ext/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "WixToolset.Sdk": "4.0.0-build-0213" + } +} diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs deleted file mode 100644 index 708ae658..00000000 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ /dev/null @@ -1,38 +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.Dependency -{ - using System.Linq; - using System.Text.RegularExpressions; - using WixBuildTools.TestSupport; - using WixToolset.Core.TestPackage; - using WixToolset.Dependency; - using Xunit; - - public class DependencyExtensionFixture - { - [Fact] - public void CanBuildUsingProvides() - { - var folder = TestData.Get(@"TestData\UsingProvides"); - var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); - - var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider") - .Select(r => Regex.Replace(r, "{[^}]*}", "{*}")) - .ToArray(); - WixAssert.CompareLineByLine(new[] - { - "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t", - "CustomAction:Wix4DependencyRequire_X86\t1\tDependencyCA_X86\tWixDependencyRequire\t", - "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", - "WixDependencyProvider:depTpv28q7slcxvXPWmU4Z0GfbiI.4\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\t{*}\t\t\t", - }, results); - } - - private static void Build(string[] args) - { - var result = WixRunner.Execute(args) - .AssertSuccess(); - } - } -} diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.en-us.wxl deleted file mode 100644 index 38c12ac1..00000000 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/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.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs deleted file mode 100644 index 65984395..00000000 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj b/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj deleted file mode 100644 index 0b80dc83..00000000 --- a/src/test/WixToolsetTest.Dependency/WixToolsetTest.Dependency.csproj +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - netcoreapp3.1 - embedded - false - - - - NU1701 - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/version.json b/src/version.json new file mode 100644 index 00000000..5f857771 --- /dev/null +++ b/src/version.json @@ -0,0 +1,11 @@ +{ + "version": "4.0", + "publicReleaseRefSpec": [ + "^refs/heads/master$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} diff --git a/src/wix.snk b/src/wix.snk deleted file mode 100644 index 3908a66a..00000000 Binary files a/src/wix.snk and /dev/null differ diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs deleted file mode 100644 index 3d6c84a7..00000000 --- a/src/wixext/DependencyCompiler.cs +++ /dev/null @@ -1,61 +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 WixToolset.Dependency -{ - using System.Collections.Generic; - using System.Xml.Linq; - using WixToolset.Data; - using WixToolset.Extensibility; - using WixToolset.Extensibility.Data; - - /// - /// The compiler for the WiX Toolset Dependency Extension. - /// - public sealed class DependencyCompiler : BaseCompilerExtension - { - public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/dependency"; - - /// - /// Processes an attribute for the Compiler. - /// - /// Source line number for the parent element. - /// Parent element of attribute. - /// Attribute to process. - public override void ParseAttribute(Intermediate intermediate, IntermediateSection section, XElement parentElement, XAttribute attribute, IDictionary context) - { - var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(parentElement); - var addCheck = YesNoType.NotSet; - var addRequire = YesNoType.NotSet; - - switch (parentElement.Name.LocalName) - { - case "Provides": - if (attribute.Name.LocalName == "Check" && parentElement.Parent?.Name.LocalName == "Component") - { - addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); - } - break; - case "Requires": - case "RequiresRef": - if (attribute.Name.LocalName == "Enforce" && parentElement.Parent?.Parent?.Name.LocalName == "Component") - { - addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); - } - break; - } - - if (addCheck == YesNoType.NotSet && addRequire == YesNoType.NotSet) - { - this.ParseHelper.UnexpectedAttribute(parentElement, attribute); - } - else if (addCheck == YesNoType.Yes) - { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyCheck", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); - } - else if (addRequire == YesNoType.Yes) - { - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4DependencyRequire", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); - } - } - } -} diff --git a/src/wixext/DependencyDecompiler.cs b/src/wixext/DependencyDecompiler.cs deleted file mode 100644 index 31de3097..00000000 --- a/src/wixext/DependencyDecompiler.cs +++ /dev/null @@ -1,347 +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 WixToolset.Dependency -{ -#if TODO_CONSIDER_DECOMPILER - using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using WixToolset; - using WixToolset.Data; - using WixToolset.Extensibility; - using WixToolset.Extensions.Serialize.Dependency; - using Dependency = WixToolset.Extensions.Serialize.Dependency; - using Wix = WixToolset.Data.Serialize; - - /// - /// The decompiler for the WiX toolset dependency extension. - /// - public sealed class DependencyDecompiler : DecompilerExtension - { - private RegistryKeyValueCollection registryValues; - private Dictionary keyCache; - - /// - /// Creates a new instance of the class. - /// - public DependencyDecompiler() - { - this.registryValues = new RegistryKeyValueCollection(); - this.keyCache = new Dictionary(); - - this.TableDefinitions = DependencyExtensionData.GetExtensionTableDefinitions(); - } - - /// - /// Get the extensions library to be removed. - /// - /// Table definitions for library. - /// Library to remove from decompiled output. - public override Library GetLibraryToRemove(TableDefinitionCollection tableDefinitions) - { - return DependencyExtensionData.GetExtensionLibrary(tableDefinitions); - } - - /// - /// Decompiles an extension table. - /// - /// The table to decompile. - public override void DecompileTable(Table table) - { - switch (table.Name) - { - case "WixDependencyProvider": - this.DecompileWixDependencyProviderTable(table); - break; - - case "WixDependency": - this.DecompileWixDependencyTable(table); - break; - - case "WixDependencyRef": - this.DecompileWixDependencyRefTable(table); - break; - - default: - base.DecompileTable(table); - break; - } - } - - /// - /// Finalize decompilation by removing registry values that the compiler writes. - /// - /// The collection of all tables. - public override void Finish(TableIndexedCollection tables) - { - // Remove generated registry rows. - this.FinalizeRegistryTable(tables); - - // Remove extension properties. - this.FinalizeProperties(); - } - - /// - /// Decompiles the WixDependencyProvider table. - /// - /// The table to decompile. - private void DecompileWixDependencyProviderTable(Table table) - { - foreach (Row row in table.Rows) - { - Provides provides = new Provides(); - - provides.Id = (string)row[0]; - provides.Key = (string)row[2]; - - if (null != row[3]) - { - provides.Version = (string)row[3]; - } - - if (null != row[4]) - { - provides.DisplayName = (string)row[4]; - } - - // Nothing to parse for attributes currently. - - Wix.Component component = (Wix.Component)this.Core.GetIndexedElement("Component", (string)row[1]); - if (null != component) - { - component.AddChild(provides); - } - else - { - this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "Component_", (string)row[1], "Component")); - } - - // Index the provider to parent the RequiresRef elements. - this.Core.IndexElement(row, provides); - - // Add the provider-specific registry keys to be removed during finalization. - // Only remove specific keys that the compiler writes. - string keyProvides = String.Concat(DependencyCommon.RegistryRoot, provides.Key); - - this.registryValues.Add(keyProvides, null); - this.registryValues.Add(keyProvides, "Version"); - this.registryValues.Add(keyProvides, "DisplayName"); - this.registryValues.Add(keyProvides, "Attributes"); - - // Cache the provider key. - this.keyCache[provides.Id] = provides.Key; - } - } - - /// - /// Decompiles the WixDependency table. - /// - /// The table to decompile. - private void DecompileWixDependencyTable(Table table) - { - foreach (Row row in table.Rows) - { - Requires requires = new Requires(); - - requires.Id = (string)row[0]; - requires.ProviderKey = (string)row[1]; - - if (null != row[2]) - { - requires.Minimum = (string)row[2]; - } - - if (null != row[3]) - { - requires.Maximum = (string)row[3]; - } - - if (null != row[4]) - { - int attributes = (int)row[4]; - - if (0 != (attributes & DependencyCommon.RequiresAttributesMinVersionInclusive)) - { - requires.IncludeMinimum = Dependency.YesNoType.yes; - } - - if (0 != (attributes & DependencyCommon.RequiresAttributesMaxVersionInclusive)) - { - requires.IncludeMaximum = Dependency.YesNoType.yes; - } - } - - this.Core.RootElement.AddChild(requires); - - // Cache the requires key. - this.keyCache[requires.Id] = requires.ProviderKey; - } - } - - /// - /// Decompiles the WixDependencyRef table. - /// - /// The table to decompile. - private void DecompileWixDependencyRefTable(Table table) - { - foreach (Row row in table.Rows) - { - RequiresRef requiresRef = new RequiresRef(); - - requiresRef.Id = (string)row[1]; - - Provides provides = (Provides)this.Core.GetIndexedElement("WixDependencyProvider", (string)row[0]); - if (null != provides) - { - provides.AddChild(requiresRef); - } - else - { - this.Core.OnMessage(WixWarnings.ExpectedForeignRow(row.SourceLineNumbers, table.Name, row.GetPrimaryKey(DecompilerConstants.PrimaryKeyDelimiter), "WixDependencyProvider_", (string)row[0], "WixDependencyProvider")); - } - - // Get the cached keys for the provider and dependency IDs and generate registry rows. - string providesKey = null; - string requiresKey = null; - - if (null != provides && this.keyCache.ContainsKey(provides.Id)) - { - providesKey = this.keyCache[provides.Id]; - } - else - { - this.Core.OnMessage(DependencyWarnings.ProvidesKeyNotFound(row.SourceLineNumbers, provides.Id)); - } - - if (this.keyCache.ContainsKey(requiresRef.Id)) - { - requiresKey = this.keyCache[requiresRef.Id]; - } - else - { - this.Core.OnMessage(DependencyWarnings.RequiresKeyNotFound(row.SourceLineNumbers, requiresRef.Id)); - } - - if (!this.Core.EncounteredError) - { - // Add the dependency-specific registry keys to be removed during finalization. - // Only remove specific keys that the compiler writes. - string keyRequires = String.Format(@"{0}{1}\{2}\{3}", DependencyCommon.RegistryRoot, requiresKey, DependencyCommon.RegistryDependents, providesKey); - - this.registryValues.Add(keyRequires, "*"); - this.registryValues.Add(keyRequires, "MinVersion"); - this.registryValues.Add(keyRequires, "MaxVersion"); - this.registryValues.Add(keyRequires, "Attributes"); - } - } - } - - /// - /// Removes rows from the Registry table that are generated by this extension. - /// - /// The collection of tables. - private void FinalizeRegistryTable(TableIndexedCollection tables) - { - Table registryTable = tables["Registry"]; - if (null != registryTable) - { - foreach (Row registryRow in registryTable.Rows) - { - // Check if the compiler writes this registry value; if so, it should be removed. - if (this.registryValues.Contains(registryRow)) - { - Wix.ISchemaElement elem = this.Core.GetIndexedElement(registryRow); - - // If the registry row was found, remove it from its parent. - if (null != elem && null != elem.ParentElement) - { - Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; - if (null != elemParent) - { - elemParent.RemoveChild(elem); - } - } - } - } - } - } - - /// - /// Removes properties defined by this extension. - /// - /// The collection of tables. - private void FinalizeProperties() - { - string[] properties = new string[] { "DISABLEDEPENDENCYCHECK", "IGNOREDEPENDENCIES" }; - foreach (string property in properties) - { - Wix.Property elem = this.Core.GetIndexedElement("Property", property) as Wix.Property; - if (null != elem) - { - // If a value is defined, log a warning we're removing it. - if (!String.IsNullOrEmpty(elem.Value)) - { - this.Core.OnMessage(DependencyWarnings.PropertyRemoved(elem.Id)); - } - - // If the property row was found, remove it from its parent. - if (null != elem.ParentElement) - { - Wix.IParentElement elemParent = elem.ParentElement as Wix.IParentElement; - if (null != elemParent) - { - elemParent.RemoveChild(elem); - } - } - } - } - } - - /// - /// Provides an O(1) lookup for registry key and value name pairs for use in the decompiler. - /// - private sealed class RegistryKeyValueCollection : KeyedCollection> - { - /// - /// Adds the registry key and value name pair to the collection if it doesn't already exist. - /// - /// The registry key to add. - /// The registry value name to add. - internal void Add(string key, string name) - { - KeyValuePair pair = new KeyValuePair(key, name); - if (!this.Contains(pair)) - { - this.Add(pair); - } - } - - /// - /// Returns whether the collection contains the registry key and value name pair from the . - /// - /// The registry to search for. - /// True if the collection contains the registry key and value name pair from the ; otherwise, false. - internal bool Contains(Row row) - { - if (null == row) - { - return false; - } - - KeyValuePair pair = new KeyValuePair((string)row[2], (string)row[3]); - return this.Contains(pair); - } - - /// - /// Return the hash code of the key and value pair concatenated with a colon as a delimiter. - /// - /// The registry key and value name pair. - /// - protected override int GetKeyForItem(KeyValuePair pair) - { - return String.Concat(pair.Key, ":", pair.Value).GetHashCode(); - } - } - } -#endif -} diff --git a/src/wixext/DependencyExtensionData.cs b/src/wixext/DependencyExtensionData.cs deleted file mode 100644 index 2f30c2bf..00000000 --- a/src/wixext/DependencyExtensionData.cs +++ /dev/null @@ -1,29 +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 WixToolset.Dependency -{ - using WixToolset.Data; - using WixToolset.Extensibility; - - /// - /// The WiX Toolset Dependency Extension. - /// - public sealed class DependencyExtensionData : BaseExtensionData - { - /// - /// Gets the default culture. - /// - /// The default culture. - public override string DefaultCulture => "en-US"; - - /// - /// Gets the contained .wixlib content. - /// - /// Strong typed symbold definitions. - /// The .wixlib. - public override Intermediate GetLibrary(ISymbolDefinitionCreator symbolDefinitions) - { - return Intermediate.Load(typeof(DependencyExtensionData).Assembly, "WixToolset.Dependency.dependency.wixlib", symbolDefinitions); - } - } -} diff --git a/src/wixext/DependencyExtensionFactory.cs b/src/wixext/DependencyExtensionFactory.cs deleted file mode 100644 index 413f99ae..00000000 --- a/src/wixext/DependencyExtensionFactory.cs +++ /dev/null @@ -1,17 +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 WixToolset.Dependency -{ - using System; - using System.Collections.Generic; - using WixToolset.Extensibility; - - public class DependencyExtensionFactory : BaseExtensionFactory - { - protected override IReadOnlyCollection ExtensionTypes => new[] - { - typeof(DependencyCompiler), - typeof(DependencyExtensionData), - }; - } -} diff --git a/src/wixext/WixToolset.Dependency.wixext.csproj b/src/wixext/WixToolset.Dependency.wixext.csproj deleted file mode 100644 index b2663231..00000000 --- a/src/wixext/WixToolset.Dependency.wixext.csproj +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - netstandard2.0 - embedded - WixToolset.Dependency - WiX Toolset Dependency Extension - WiX Toolset Dependency Extension - true - true - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixext/WixToolset.Dependency.wixext.nuspec b/src/wixext/WixToolset.Dependency.wixext.nuspec deleted file mode 100644 index ba3eaade..00000000 --- a/src/wixext/WixToolset.Dependency.wixext.nuspec +++ /dev/null @@ -1,25 +0,0 @@ - - - - $id$ - $version$ - $title$ - $description$ - $authors$ - MS-RL - false - $copyright$ - $projectUrl$ - - - - - - - - - - - - - diff --git a/src/wixext/WixToolset.Dependency.wixext.targets b/src/wixext/WixToolset.Dependency.wixext.targets deleted file mode 100644 index 2b298736..00000000 --- a/src/wixext/WixToolset.Dependency.wixext.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - $(MSBuildThisFileDirectory)..\tools\WixToolset.Dependency.wixext.dll - - - - - diff --git a/src/wixlib/DependencyExtension.wxs b/src/wixlib/DependencyExtension.wxs deleted file mode 100644 index 0516b18c..00000000 --- a/src/wixlib/DependencyExtension.wxs +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi deleted file mode 100644 index 9ab28ef3..00000000 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/DependencyExtension_arm64.wxs b/src/wixlib/DependencyExtension_arm64.wxs deleted file mode 100644 index 958650e6..00000000 --- a/src/wixlib/DependencyExtension_arm64.wxs +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/wixlib/DependencyExtension_x64.wxs b/src/wixlib/DependencyExtension_x64.wxs deleted file mode 100644 index 4fe458e8..00000000 --- a/src/wixlib/DependencyExtension_x64.wxs +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/wixlib/DependencyExtension_x86.wxs b/src/wixlib/DependencyExtension_x86.wxs deleted file mode 100644 index d8ac6785..00000000 --- a/src/wixlib/DependencyExtension_x86.wxs +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi deleted file mode 100644 index b1711518..00000000 --- a/src/wixlib/caDecor.wxi +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/caerr.wxi b/src/wixlib/caerr.wxi deleted file mode 100644 index ff7ec121..00000000 --- a/src/wixlib/caerr.wxi +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/wixlib/dependency.wixproj b/src/wixlib/dependency.wixproj deleted file mode 100644 index 76e3ecd3..00000000 --- a/src/wixlib/dependency.wixproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - Library - true - - 1086 - en-us - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/en-us.wxl b/src/wixlib/en-us.wxl deleted file mode 100644 index 6ad7d63d..00000000 --- a/src/wixlib/en-us.wxl +++ /dev/null @@ -1,7 +0,0 @@ - - - - - If you continue with this install, the product may not work properly because [2] or more dependencies are missing. Do you want to continue with this install anyway? - If you continue with this uninstall, [2] or more products may stop working properly. Do you want to continue with this uninstall anyway? - diff --git a/version.json b/version.json deleted file mode 100644 index 5f857771..00000000 --- a/version.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": "4.0", - "publicReleaseRefSpec": [ - "^refs/heads/master$" - ], - "cloudBuild": { - "buildNumber": { - "enabled": true - } - } -} -- cgit v1.2.3-55-g6feb