Integrate into latest v4. Still needs TupleDefinitions.
Integrate into latest v4. Still needs TupleDefinitions.
Sean Hall committed
Dec 16, 2018 at 11:57 UTC
1b7a9d3734119e658c91ebd9742ab5a3ce94cce4
33 files changed
+1000
-263
Sql.wixext.sln
new
+58
@@ -0,0 +1,58 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio 15
4
+VisualStudioVersion = 15.0.28010.2016
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlca", "src\ca\sqlca.vcxproj", "{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}"
7
+EndProject
8
+Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "sql", "src\wixlib\sql.wixproj", "{9ACF1A20-D801-45CC-A463-F9D13E506AA3}"
9
+EndProject
10
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Sql.wixext", "src\wixext\WixToolset.Sql.wixext.csproj", "{0E05519A-0045-4AEC-BD0C-D9205FF1468F}"
11
+EndProject
12
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Sql", "src\test\WixToolsetTest.Sql\WixToolsetTest.Sql.csproj", "{FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}"
13
+EndProject
14
+Global
15
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
16
+ Debug|Any CPU = Debug|Any CPU
17
+ Debug|x86 = Debug|x86
18
+ Release|Any CPU = Release|Any CPU
19
+ Release|x86 = Release|x86
20
+ EndGlobalSection
21
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
22
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|Any CPU.ActiveCfg = Debug|Win32
23
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|x86.ActiveCfg = Debug|Win32
24
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Debug|x86.Build.0 = Debug|Win32
25
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Release|Any CPU.ActiveCfg = Release|Win32
26
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Release|x86.ActiveCfg = Release|Win32
27
+ {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}.Release|x86.Build.0 = Release|Win32
28
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Debug|Any CPU.ActiveCfg = Debug|x86
29
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Debug|Any CPU.Build.0 = Debug|x86
30
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Debug|x86.ActiveCfg = Debug|x86
31
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Debug|x86.Build.0 = Debug|x86
32
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Release|Any CPU.ActiveCfg = Release|x86
33
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Release|x86.ActiveCfg = Release|x86
34
+ {9ACF1A20-D801-45CC-A463-F9D13E506AA3}.Release|x86.Build.0 = Release|x86
35
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Debug|Any CPU.Build.0 = Debug|Any CPU
37
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Debug|x86.ActiveCfg = Debug|Any CPU
38
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Debug|x86.Build.0 = Debug|Any CPU
39
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Release|Any CPU.ActiveCfg = Release|Any CPU
40
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Release|Any CPU.Build.0 = Release|Any CPU
41
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Release|x86.ActiveCfg = Release|Any CPU
42
+ {0E05519A-0045-4AEC-BD0C-D9205FF1468F}.Release|x86.Build.0 = Release|Any CPU
43
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
44
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
45
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Debug|x86.ActiveCfg = Debug|Any CPU
46
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Debug|x86.Build.0 = Debug|Any CPU
47
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
48
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Release|Any CPU.Build.0 = Release|Any CPU
49
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Release|x86.ActiveCfg = Release|Any CPU
50
+ {FE72A369-03CA-4EBC-BC7B-A8BBF5BBD3E0}.Release|x86.Build.0 = Release|Any CPU
51
+ EndGlobalSection
52
+ GlobalSection(SolutionProperties) = preSolution
53
+ HideSolutionNode = FALSE
54
+ EndGlobalSection
55
+ GlobalSection(ExtensibilityGlobals) = postSolution
56
+ SolutionGuid = {DEFEE3BB-E557-4B77-A85C-ECA19D6F5DF5}
57
+ EndGlobalSection
58
+EndGlobal
appveyor.cmd
new
+13
@@ -0,0 +1,13 @@
1
+@setlocal
2
+@pushd %~dp0
3
+
4
+nuget restore
5
+
6
+msbuild -p:Configuration=Release -t:Restore
7
+
8
+msbuild -p:Configuration=Release src\test\WixToolsetTest.Sql\WixToolsetTest.Sql.csproj
9
+
10
+msbuild -p:Configuration=Release -t:Pack src\wixext\WixToolset.Sql.wixext.csproj
11
+
12
+@popd
13
+@endlocal
\ No newline at end of file
appveyor.yml
new
+29
@@ -0,0 +1,29 @@
1
+image: Visual Studio 2017
2
+
3
+version: 0.0.0.{build}
4
+configuration: Release
5
+
6
+environment:
7
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
8
+ DOTNET_CLI_TELEMETRY_OPTOUT: 1
9
+ NUGET_XMLDOC_MODE: skip
10
+
11
+build_script:
12
+ - appveyor.cmd
13
+
14
+pull_requests:
15
+ do_not_increment_build_number: true
16
+
17
+nuget:
18
+ disable_publish_on_pr: true
19
+
20
+skip_tags: true
21
+
22
+artifacts:
23
+- path: build\Release\**\*.nupkg
24
+ name: nuget
25
+
26
+notifications:
27
+- provider: Slack
28
+ incoming_webhook:
29
+ secure: p5xuu+4x2JHfwGDMDe5KcG1k7gZxqYc4jWVwvyNZv5cvkubPD2waJs5yXMAXZNN7Z63/3PWHb7q4KoY/99AjauYa1nZ4c5qYqRPFRBKTHfA=
nuget.config
new
+16
@@ -0,0 +1,16 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<configuration>
3
+ <packageSources>
4
+ <clear />
5
+ <add key="wixtoolset-data" value="https://ci.appveyor.com/nuget/wixtoolset-data" />
6
+ <add key="wixtoolset-extensibility" value="https://ci.appveyor.com/nuget/wixtoolset-extensibility" />
7
+ <add key="wixtoolset-core" value="https://ci.appveyor.com/nuget/wixtoolset-core" />
8
+ <add key="wixtoolset-core-native" value="https://ci.appveyor.com/nuget/wixtoolset-core-native" />
9
+ <add key="wixtoolset-dtf" value="https://ci.appveyor.com/nuget/wixtoolset-dtf" />
10
+ <add key="wixtoolset-dutil" value="https://ci.appveyor.com/nuget/wixtoolset-dutil" />
11
+ <add key="wixtoolset-wcautil" value="https://ci.appveyor.com/nuget/wixtoolset-wcautil" />
12
+ <add key="wixtoolset-tools" value="https://ci.appveyor.com/nuget/wixtoolset-tools" />
13
+ <add key="wixbuildtools" value="https://ci.appveyor.com/nuget/wixbuildtools" />
14
+ <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
15
+ </packageSources>
16
+</configuration>
\ No newline at end of file
src/Cpp.Build.props
new
+100
@@ -0,0 +1,100 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project>
5
+ <PropertyGroup>
6
+ <Platform Condition=" '$(Platform)' == '' OR '$(Platform)' == 'AnyCPU' ">Win32</Platform>
7
+ <IntDir>$(BaseIntermediateOutputPath)$(Configuration)\$(Platform)\</IntDir>
8
+ <OutDir>$(OutputPath)$(Platform)\</OutDir>
9
+ </PropertyGroup>
10
+
11
+ <ItemDefinitionGroup>
12
+ <ClCompile>
13
+ <DisableSpecificWarnings>$(DisableSpecificCompilerWarnings)</DisableSpecificWarnings>
14
+ <WarningLevel>Level4</WarningLevel>
15
+ <AdditionalIncludeDirectories>$(ProjectDir)inc;$(MSBuildProjectDirectory);$(IntDir);$(SqlCESdkIncludePath);$(ProjectAdditionalIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
16
+ <PreprocessorDefinitions>WIN32;_WINDOWS;_WIN32_MSI=500;_WIN32_WINNT=0x0501;$(ArmPreprocessorDefinitions);$(UnicodePreprocessorDefinitions);_CRT_STDIO_LEGACY_WIDE_SPECIFIERS;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
17
+ <PrecompiledHeader>Use</PrecompiledHeader>
18
+ <PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
19
+ <CallingConvention>StdCall</CallingConvention>
20
+ <TreatWarningAsError>true</TreatWarningAsError>
21
+ <ExceptionHandling>false</ExceptionHandling>
22
+ <AdditionalOptions>-YlprecompDefine</AdditionalOptions>
23
+ <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
24
+ <MultiProcessorCompilation Condition=" $(NUMBER_OF_PROCESSORS) > 4 ">true</MultiProcessorCompilation>
25
+ </ClCompile>
26
+ <ResourceCompile>
27
+ <PreprocessorDefinitions>$(ArmPreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
28
+ <AdditionalIncludeDirectories>$(ProjectAdditionalResourceIncludeDirectories);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
29
+ </ResourceCompile>
30
+ <Lib>
31
+ <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ProjectAdditionalLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
32
+ </Lib>
33
+ <Link>
34
+ <SubSystem>$(ProjectSubSystem)</SubSystem>
35
+ <ModuleDefinitionFile>$(ProjectModuleDefinitionFile)</ModuleDefinitionFile>
36
+ <NoEntryPoint>$(ResourceOnlyDll)</NoEntryPoint>
37
+ <GenerateDebugInformation>true</GenerateDebugInformation>
38
+ <AdditionalDependencies>$(ProjectAdditionalLinkLibraries);advapi32.lib;comdlg32.lib;user32.lib;oleaut32.lib;gdi32.lib;shell32.lib;ole32.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>
39
+ <AdditionalLibraryDirectories>$(OutDir);$(AdditionalMultiTargetLibraryPath);$(ArmLibraryDirectories);$(ProjectAdditionalLinkLibraryDirectories);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
40
+ <AdditionalOptions Condition=" $(PlatformToolset.StartsWith('v14')) ">/IGNORE:4099 %(AdditionalOptions)</AdditionalOptions>
41
+ </Link>
42
+ </ItemDefinitionGroup>
43
+
44
+ <ItemDefinitionGroup Condition=" '$(Platform)'=='Win32' and '$(PlatformToolset)'!='v100'">
45
+ <ClCompile>
46
+ <EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
47
+ </ClCompile>
48
+ </ItemDefinitionGroup>
49
+ <ItemDefinitionGroup Condition=" '$(Platform)'=='arm' ">
50
+ <ClCompile>
51
+ <CallingConvention>CDecl</CallingConvention>
52
+ </ClCompile>
53
+ </ItemDefinitionGroup>
54
+ <ItemDefinitionGroup Condition=" '$(ConfigurationType)'=='StaticLibrary' ">
55
+ <ClCompile>
56
+ <DebugInformationFormat>OldStyle</DebugInformationFormat>
57
+ <OmitDefaultLibName>true</OmitDefaultLibName>
58
+ <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
59
+ </ClCompile>
60
+ </ItemDefinitionGroup>
61
+ <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' ">
62
+ <ClCompile>
63
+ <Optimization>Disabled</Optimization>
64
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
65
+ <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
66
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
67
+ </ClCompile>
68
+ </ItemDefinitionGroup>
69
+ <ItemDefinitionGroup Condition=" '$(Configuration)'=='Debug' and '$(CLRSupport)'=='true' ">
70
+ <ClCompile>
71
+ <BasicRuntimeChecks></BasicRuntimeChecks>
72
+ <RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
73
+ </ClCompile>
74
+ </ItemDefinitionGroup>
75
+ <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' ">
76
+ <ClCompile>
77
+ <Optimization>MinSpace</Optimization>
78
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
79
+ <FunctionLevelLinking>true</FunctionLevelLinking>
80
+ <IntrinsicFunctions>true</IntrinsicFunctions>
81
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
82
+ </ClCompile>
83
+ <Link>
84
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
85
+ <OptimizeReferences>true</OptimizeReferences>
86
+ </Link>
87
+ </ItemDefinitionGroup>
88
+ <ItemDefinitionGroup Condition=" '$(Configuration)'=='Release' and '$(CLRSupport)'=='true' ">
89
+ <ClCompile>
90
+ <BasicRuntimeChecks></BasicRuntimeChecks>
91
+ <RuntimeLibrary>MultiThreadedDll</RuntimeLibrary>
92
+ </ClCompile>
93
+ </ItemDefinitionGroup>
94
+ <ItemDefinitionGroup Condition=" '$(CLRSupport)'=='true' ">
95
+ <Link>
96
+ <KeyFile>$(LinkKeyFile)</KeyFile>
97
+ <DelaySign>$(LinkDelaySign)</DelaySign>
98
+ </Link>
99
+ </ItemDefinitionGroup>
100
+</Project>
src/Directory.Build.props
new
+29
@@ -0,0 +1,29 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+<!--
4
+ Do NOT modify this file. Update the canonical version in Home\src\Directory.Build.props
5
+ then update all of the repos.
6
+-->
7
+<Project>
8
+ <PropertyGroup>
9
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
10
+ <EnableSourceLink Condition=" '$(NCrunch)' == '1' ">false</EnableSourceLink>
11
+
12
+ <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
13
+ <BaseOutputPath>$(MSBuildThisFileDirectory)..\build\</BaseOutputPath>
14
+ <BaseIntermediateOutputPath>$(BaseOutputPath)obj\$(ProjectName)\</BaseIntermediateOutputPath>
15
+ <OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath>
16
+
17
+ <Authors>WiX Toolset Team</Authors>
18
+ <Company>WiX Toolset</Company>
19
+ <Copyright>Copyright (c) .NET Foundation and contributors. All rights reserved.</Copyright>
20
+ <Product>WiX Toolset</Product>
21
+ </PropertyGroup>
22
+
23
+ <PropertyGroup>
24
+ <WixToolsetRootFolder>$(MSBuildThisFileDirectory)..\..\</WixToolsetRootFolder>
25
+ </PropertyGroup>
26
+
27
+ <Import Project="Cpp.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.vcxproj' " />
28
+ <Import Project="Custom.Build.props" Condition=" Exists('Custom.Build.props') " />
29
+</Project>
src/FindLocalWix.props
new
+8
@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5
+ <PropertyGroup>
6
+ <WixTargetsPath Condition=" '$(Configuration)' == 'Debug' And Exists('$(MSBuildThisFileDirectory)..\..\Tools\README.md') ">$(MSBuildThisFileDirectory)..\..\Tools\build\Debug\net461\wix.targets</WixTargetsPath>
7
+ </PropertyGroup>
8
+</Project>
src/ca/dllmain.cpp
new
+26
@@ -0,0 +1,26 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+#include "precomp.h"
4
+
5
+/********************************************************************
6
+DllMain - standard entry point for all WiX custom actions
7
+
8
+********************************************************************/
9
+extern "C" BOOL WINAPI DllMain(
10
+ IN HINSTANCE hInst,
11
+ IN ULONG ulReason,
12
+ IN LPVOID)
13
+{
14
+ switch(ulReason)
15
+ {
16
+ case DLL_PROCESS_ATTACH:
17
+ WcaGlobalInitialize(hInst);
18
+ break;
19
+
20
+ case DLL_PROCESS_DETACH:
21
+ WcaGlobalFinalize();
22
+ break;
23
+ }
24
+
25
+ return TRUE;
26
+}
src/ca/packages.config
new
+6
@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+ <package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="1.14.114" targetFramework="native" developmentDependency="true" />
4
+ <package id="WixToolset.DUtil" version="4.0.6" targetFramework="native" />
5
+ <package id="WixToolset.WcaUtil" version="4.0.2" targetFramework="native" />
6
+</packages>
\ No newline at end of file
src/ca/precomp.h
new
+13
@@ -0,0 +1,13 @@
1
+#pragma once
2
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
+
4
+
5
+#include <windows.h>
6
+#include <msiquery.h>
7
+
8
+#define MAXUINT USHRT_MAX
9
+#include <Setup.Configuration.h>
10
+
11
+#include "wcautil.h"
12
+#include "fileutil.h"
13
+#include "strutil.h"
src/ca/sqlca.cpp
new
+3
@@ -0,0 +1,3 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+#include "precomp.h"
src/ca/sqlca.def
new
+7
@@ -0,0 +1,7 @@
1
+; Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+
4
+LIBRARY "sqlca"
5
+
6
+EXPORTS
7
+
src/ca/sqlca.vcxproj
new
+70
@@ -0,0 +1,70 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5
+ <Import Project="..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" />
6
+ <Import Project="..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props" Condition="Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" />
7
+
8
+ <ItemGroup Label="ProjectConfigurations">
9
+ <ProjectConfiguration Include="Debug|Win32">
10
+ <Configuration>Debug</Configuration>
11
+ <Platform>Win32</Platform>
12
+ </ProjectConfiguration>
13
+ <ProjectConfiguration Include="Release|Win32">
14
+ <Configuration>Release</Configuration>
15
+ <Platform>Win32</Platform>
16
+ </ProjectConfiguration>
17
+ </ItemGroup>
18
+
19
+ <PropertyGroup Label="Globals">
20
+ <ProjectGuid>{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}</ProjectGuid>
21
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
22
+ <TargetName>sqlca</TargetName>
23
+ <PlatformToolset>v141</PlatformToolset>
24
+ <CharacterSet>Unicode</CharacterSet>
25
+ <ProjectModuleDefinitionFile>sqlca.def</ProjectModuleDefinitionFile>
26
+ <Description>WiX Toolset Sql CustomAction</Description>
27
+ <WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>
28
+ </PropertyGroup>
29
+
30
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
31
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
32
+
33
+ <ImportGroup Label="ExtensionSettings">
34
+ </ImportGroup>
35
+
36
+ <ImportGroup Label="Shared">
37
+ <Import Project="..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets" Condition="Exists('..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets')" />
38
+ </ImportGroup>
39
+
40
+ <PropertyGroup>
41
+ <ProjectAdditionalLinkLibraries>msi.lib</ProjectAdditionalLinkLibraries>
42
+ </PropertyGroup>
43
+
44
+ <ItemGroup>
45
+ <ClCompile Include="dllmain.cpp">
46
+ <PrecompiledHeader>Create</PrecompiledHeader>
47
+ </ClCompile>
48
+ <ClCompile Include="sqlca.cpp" />
49
+ </ItemGroup>
50
+
51
+ <ItemGroup>
52
+ <ClInclude Include="precomp.h" />
53
+ </ItemGroup>
54
+
55
+ <ItemGroup>
56
+ <None Include="packages.config" />
57
+ <None Include="sqlca.def" />
58
+ </ItemGroup>
59
+
60
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
61
+
62
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
63
+ <PropertyGroup>
64
+ <ErrorText>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}.</ErrorText>
65
+ </PropertyGroup>
66
+ <Error Condition="!Exists('..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Native.1.14.114\build\native\Microsoft.VisualStudio.Setup.Configuration.Native.targets'))" />
67
+ <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.6\build\WixToolset.DUtil.props'))" />
68
+ <Error Condition="!Exists('..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.WcaUtil.4.0.2\build\WixToolset.WcaUtil.props'))" />
69
+ </Target>
70
+</Project>
src/test/WixToolsetTest.Sql/SqlExtensionFixture.cs
new
+32
@@ -0,0 +1,32 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+namespace WixToolsetTest.Sql
4
+{
5
+ using System.Linq;
6
+ using WixBuildTools.TestSupport;
7
+ using WixToolset.Core.TestPackage;
8
+ using WixToolset.Sql;
9
+ using Xunit;
10
+
11
+ public class SqlExtensionFixture
12
+ {
13
+ [Fact]
14
+ public void CanBuildUsingSqlString()
15
+ {
16
+ var folder = TestData.Get(@"TestData\UsingSql");
17
+ var build = new Builder(folder, typeof(SqlExtensionFactory), new[] { folder });
18
+
19
+ var results = build.BuildAndQuery(Build, "SqlString");
20
+ Assert.Equal(new[]
21
+ {
22
+ "SqlString:",
23
+ }, results.OrderBy(s => s).ToArray());
24
+ }
25
+
26
+ private static void Build(string[] args)
27
+ {
28
+ var result = WixRunner.Execute(args)
29
+ .AssertSuccess();
30
+ }
31
+ }
32
+}
src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.en-us.wxl
new
+11
@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<!--
4
+This file contains the declaration of all the localizable strings.
5
+-->
6
+<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
+
8
+ <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9
+ <String Id="FeatureTitle">MsiPackage</String>
10
+
11
+</WixLocalization>
src/test/WixToolsetTest.Sql/TestData/UsingSql/Package.wxs
new
+22
@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4
+ <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
5
+
6
+ <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7
+ <MediaTemplate />
8
+
9
+ <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
10
+ <ComponentGroupRef Id="ProductComponents" />
11
+ </Feature>
12
+
13
+ </Product>
14
+
15
+ <Fragment>
16
+ <Directory Id="TARGETDIR" Name="SourceDir">
17
+ <Directory Id="ProgramFilesFolder">
18
+ <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
19
+ </Directory>
20
+ </Directory>
21
+ </Fragment>
22
+</Wix>
src/test/WixToolsetTest.Sql/TestData/UsingSql/PackageComponents.wxs
new
+14
@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3
+ xmlns:sql="http://wixtoolset.org/schemas/v4/wxs/sql">
4
+ <Fragment>
5
+ <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
6
+ <Component KeyPath="yes">
7
+ <CreateFolder />
8
+ <sql:SqlDatabase Id="TestDB" Database="MyDB" Server="MySQLHostName" Instance="MyInstanceName" CreateOnInstall="yes" DropOnUninstall="yes" ConfirmOverwrite="yes">
9
+ <sql:SqlString Id="TestString" SQL="CREATE TABLE TestTable1(name varchar(20), value varchar(20))" ExecuteOnInstall="yes" />
10
+ </sql:SqlDatabase>
11
+ </Component>
12
+ </ComponentGroup>
13
+ </Fragment>
14
+</Wix>
src/test/WixToolsetTest.Sql/TestData/UsingSql/example.txt
new
+1
@@ -0,0 +1 @@
1
+This is example.txt.
\ No newline at end of file
src/test/WixToolsetTest.Sql/WixToolsetTest.Sql.csproj
new
+42
@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project Sdk="Microsoft.NET.Sdk">
5
+ <PropertyGroup>
6
+ <TargetFramework>netcoreapp2.1</TargetFramework>
7
+ <IsPackable>false</IsPackable>
8
+ </PropertyGroup>
9
+
10
+ <PropertyGroup>
11
+ <NoWarn>NU1701</NoWarn>
12
+ </PropertyGroup>
13
+
14
+ <ItemGroup>
15
+ <Content Include="TestData\UsingSql\example.txt" CopyToOutputDirectory="PreserveNewest" />
16
+ <Content Include="TestData\UsingSql\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
17
+ <Content Include="TestData\UsingSql\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
18
+ <Content Include="TestData\UsingSql\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
19
+ </ItemGroup>
20
+
21
+ <ItemGroup>
22
+ <ProjectReference Include="..\..\wixext\WixToolset.Sql.wixext.csproj" />
23
+ </ItemGroup>
24
+
25
+ <ItemGroup>
26
+ <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Core\README.md') " PrivateAssets="all" />
27
+ <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.TestPackage\WixToolset.Core.TestPackage.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " />
28
+ <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core\WixToolset.Core.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " />
29
+ <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.Burn\WixToolset.Core.Burn.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " />
30
+ <ProjectReference Include="$(WixToolsetRootFolder)\Core\src\WixToolset.Core.WindowsInstaller\WixToolset.Core.WindowsInstaller.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Core\README.md') " />
31
+ </ItemGroup>
32
+
33
+ <ItemGroup>
34
+ <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
35
+ </ItemGroup>
36
+
37
+ <ItemGroup>
38
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
39
+ <PackageReference Include="xunit" Version="2.4.0" />
40
+ <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
41
+ </ItemGroup>
42
+</Project>
src/wixext/SqlCompiler.cs
+193
-198
@@ -1,6 +1,6 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Extensions
3
+namespace WixToolset.Sql
4
{
5
using System;
6
using System.Collections.Generic;
@@ -11,7 +11,7 @@ namespace WixToolset.Extensions
11
/// <summary>
12
/// The compiler for the WiX Toolset SQL Server Extension.
13
/// </summary>
14
- public sealed class SqlCompiler : CompilerExtension
14
+ public sealed class SqlCompiler : BaseCompilerExtension
15
{
16
// sql database attributes definitions (from sca.h)
17
internal const int DbCreateOnInstall = 0x00000001;
@@ -30,22 +30,17 @@ namespace WixToolset.Extensions
30
internal const int SqlRollback = 0x00000008;
31
internal const int SqlExecuteOnReinstall = 0x00000010;
32
33
- /// <summary>
34
- /// Instantiate a new SqlCompiler.
35
- /// </summary>
36
- public SqlCompiler()
37
- {
38
- this.Namespace = "http://wixtoolset.org/schemas/v4/wxs/sql";
39
- }
33
+ public override XNamespace Namespace => "http://wixtoolset.org/schemas/v4/wxs/sql";
34
35
/// <summary>
36
/// Processes an element for the Compiler.
37
/// </summary>
44
- /// <param name="sourceLineNumbers">Source line number for the parent element.</param>
38
+ /// <param name="intermediate"></param>
39
+ /// <param name="section"></param>
40
/// <param name="parentElement">Parent element of element to process.</param>
41
/// <param name="element">Element to process.</param>
47
- /// <param name="contextValues">Extra information about the context in which this element is being parsed.</param>
48
- public override void ParseElement(XElement parentElement, XElement element, IDictionary<string, string> context)
42
+ /// <param name="context">Extra information about the context in which this element is being parsed.</param>
43
+ public override void ParseElement(Intermediate intermediate, IntermediateSection section, XElement parentElement, XElement element, IDictionary<string, string> context)
44
{
45
switch (parentElement.Name.LocalName)
46
{
@@ -56,16 +51,16 @@ namespace WixToolset.Extensions
51
switch (element.Name.LocalName)
52
{
53
case "SqlDatabase":
59
- this.ParseSqlDatabaseElement(element, componentId);
54
+ this.ParseSqlDatabaseElement(intermediate, section, element, componentId);
55
break;
56
case "SqlScript":
62
- this.ParseSqlScriptElement(element, componentId, null);
57
+ this.ParseSqlScriptElement(intermediate, section, element, componentId, null);
58
break;
59
case "SqlString":
65
- this.ParseSqlStringElement(element, componentId, null);
60
+ this.ParseSqlStringElement(intermediate, section, element, componentId, null);
61
break;
62
default:
68
- this.Core.UnexpectedElement(parentElement, element);
63
+ this.ParseHelper.UnexpectedElement(parentElement, element);
64
break;
65
}
66
break;
@@ -75,15 +70,15 @@ namespace WixToolset.Extensions
70
switch (element.Name.LocalName)
71
{
72
case "SqlDatabase":
78
- this.ParseSqlDatabaseElement(element, null);
73
+ this.ParseSqlDatabaseElement(intermediate, section, element, null);
74
break;
75
default:
81
- this.Core.UnexpectedElement(parentElement, element);
76
+ this.ParseHelper.UnexpectedElement(parentElement, element);
77
break;
78
}
79
break;
80
default:
86
- this.Core.UnexpectedElement(parentElement, element);
81
+ this.ParseHelper.UnexpectedElement(parentElement, element);
82
break;
83
}
84
}
@@ -91,36 +86,38 @@ namespace WixToolset.Extensions
86
/// <summary>
87
/// Parses a sql database element
88
/// </summary>
94
- /// <param name="node">Element to parse.</param>
89
+ /// <param name="intermediate"></param>
90
+ /// <param name="section"></param>
91
+ /// <param name="element">Element to parse.</param>
92
/// <param name="componentId">Identifier for parent component.</param>
96
- private void ParseSqlDatabaseElement(XElement node, string componentId)
93
+ private void ParseSqlDatabaseElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId)
94
{
98
- SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
99
- string id = null;
95
+ SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
96
+ Identifier id = null;
97
int attributes = 0;
98
string database = null;
102
- string fileSpec = null;
99
+ Identifier fileSpec = null;
100
string instance = null;
104
- string logFileSpec = null;
101
+ Identifier logFileSpec = null;
102
string server = null;
103
string user = null;
104
108
- foreach (XAttribute attrib in node.Attributes())
105
+ foreach (XAttribute attrib in element.Attributes())
106
{
107
if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
108
{
109
switch (attrib.Name.LocalName)
110
{
111
case "Id":
115
- id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
112
+ id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
113
break;
114
case "ConfirmOverwrite":
115
if (null == componentId)
116
{
120
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
117
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
118
}
119
123
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
120
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
121
{
122
attributes |= DbConfirmOverwrite;
123
}
@@ -128,10 +125,10 @@ namespace WixToolset.Extensions
125
case "ContinueOnError":
126
if (null == componentId)
127
{
131
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
128
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
129
}
130
134
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
131
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
132
{
133
attributes |= DbContinueOnError;
134
}
@@ -139,10 +136,10 @@ namespace WixToolset.Extensions
136
case "CreateOnInstall":
137
if (null == componentId)
138
{
142
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
139
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
140
}
141
145
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
142
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
143
{
144
attributes |= DbCreateOnInstall;
145
}
@@ -150,10 +147,10 @@ namespace WixToolset.Extensions
147
case "CreateOnReinstall":
148
if (null == componentId)
149
{
153
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
150
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
151
}
152
156
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
153
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
154
{
155
attributes |= DbCreateOnReinstall;
156
}
@@ -161,24 +158,24 @@ namespace WixToolset.Extensions
158
case "CreateOnUninstall":
159
if (null == componentId)
160
{
164
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
161
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
162
}
163
167
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
164
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
165
{
166
attributes |= DbCreateOnUninstall;
167
}
168
break;
169
case "Database":
173
- database = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
170
+ database = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
171
break;
172
case "DropOnInstall":
173
if (null == componentId)
174
{
178
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
175
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
176
}
177
181
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
178
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
179
{
180
attributes |= DbDropOnInstall;
181
}
@@ -186,10 +183,10 @@ namespace WixToolset.Extensions
183
case "DropOnReinstall":
184
if (null == componentId)
185
{
189
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
186
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
187
}
188
192
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
189
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
190
{
191
attributes |= DbDropOnReinstall;
192
}
@@ -198,142 +195,141 @@ namespace WixToolset.Extensions
195
case "DropOnUninstall":
196
if (null == componentId)
197
{
201
- this.Core.OnMessage(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
198
+ this.Messaging.Write(SqlErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName));
199
}
200
204
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
201
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
202
{
203
attributes |= DbDropOnUninstall;
204
}
205
break;
206
case "Instance":
210
- instance = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
207
+ instance = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
208
break;
209
case "Server":
213
- server = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
210
+ server = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
211
break;
212
case "User":
216
- user = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
217
- if (!this.Core.ContainsProperty(user))
213
+ user = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
214
+ if (!this.ParseHelper.ContainsProperty(user))
215
{
219
- user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
220
- this.Core.CreateSimpleReference(sourceLineNumbers, "User", user);
216
+ user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
217
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user);
218
}
219
break;
220
default:
224
- this.Core.UnexpectedAttribute(node, attrib);
221
+ this.ParseHelper.UnexpectedAttribute(element, attrib);
222
break;
223
}
224
}
225
else
226
{
230
- this.Core.ParseExtensionAttribute(node, attrib);
227
+ this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
228
}
229
}
230
231
if (null == id)
232
{
236
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
233
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
234
}
235
236
if (null == database)
237
{
241
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Database"));
238
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Database"));
239
}
240
else if (128 < database.Length)
241
{
245
- this.Core.OnMessage(WixErrors.IdentifierTooLongError(sourceLineNumbers, node.Name.LocalName, "Database", database, 128));
242
+ this.Messaging.Write(ErrorMessages.IdentifierTooLongError(sourceLineNumbers, element.Name.LocalName, "Database", database, 128));
243
}
244
245
if (null == server)
246
{
250
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Server"));
247
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Server"));
248
}
249
250
if (0 == attributes && null != componentId)
251
{
255
- this.Core.OnMessage(SqlErrors.OneOfAttributesRequiredUnderComponent(sourceLineNumbers, node.Name.LocalName, "CreateOnInstall", "CreateOnUninstall", "DropOnInstall", "DropOnUninstall"));
252
+ this.Messaging.Write(SqlErrors.OneOfAttributesRequiredUnderComponent(sourceLineNumbers, element.Name.LocalName, "CreateOnInstall", "CreateOnUninstall", "DropOnInstall", "DropOnUninstall"));
253
}
254
258
- foreach (XElement child in node.Elements())
255
+ foreach (XElement child in element.Elements())
256
{
257
if (this.Namespace == child.Name.Namespace)
258
{
262
- SourceLineNumber childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child);
259
+ SourceLineNumber childSourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(child);
260
switch (child.Name.LocalName)
261
{
262
case "SqlScript":
263
if (null == componentId)
264
{
268
- this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
265
+ this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
266
}
267
271
- this.ParseSqlScriptElement(child, componentId, id);
268
+ this.ParseSqlScriptElement(intermediate, section, child, componentId, id.Id);
269
break;
270
case "SqlString":
271
if (null == componentId)
272
{
276
- this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
273
+ this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
274
}
275
279
- this.ParseSqlStringElement(child, componentId, id);
276
+ this.ParseSqlStringElement(intermediate, section, child, componentId, id.Id);
277
break;
278
case "SqlFileSpec":
279
if (null == componentId)
280
{
284
- this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
281
+ this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
282
}
283
else if (null != fileSpec)
284
{
288
- this.Core.OnMessage(WixErrors.TooManyElements(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, 1));
285
+ this.Messaging.Write(ErrorMessages.TooManyElements(sourceLineNumbers, element.Name.LocalName, child.Name.LocalName, 1));
286
}
287
291
- fileSpec = this.ParseSqlFileSpecElement(child);
288
+ fileSpec = this.ParseSqlFileSpecElement(intermediate, section, child);
289
break;
290
case "SqlLogFileSpec":
291
if (null == componentId)
292
{
296
- this.Core.OnMessage(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
293
+ this.Messaging.Write(SqlErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName));
294
}
295
else if (null != logFileSpec)
296
{
300
- this.Core.OnMessage(WixErrors.TooManyElements(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, 1));
297
+ this.Messaging.Write(ErrorMessages.TooManyElements(sourceLineNumbers, element.Name.LocalName, child.Name.LocalName, 1));
298
}
299
303
- logFileSpec = this.ParseSqlFileSpecElement(child);
300
+ logFileSpec = this.ParseSqlFileSpecElement(intermediate, section, child);
301
break;
302
default:
306
- this.Core.UnexpectedElement(node, child);
303
+ this.ParseHelper.UnexpectedElement(element, child);
304
break;
305
}
306
}
307
else
308
{
312
- this.Core.ParseExtensionElement(node, child);
309
+ this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, element, child);
310
}
311
}
312
313
if (null != componentId)
314
{
315
// Reference InstallSqlData and UninstallSqlData since nothing will happen without it
319
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData");
320
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData");
316
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData");
317
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData");
318
}
319
323
- if (!this.Core.EncounteredError)
320
+ if (!this.Messaging.EncounteredError)
321
{
325
- Row row = this.Core.CreateRow(sourceLineNumbers, "SqlDatabase");
326
- row[0] = id;
327
- row[1] = server;
328
- row[2] = instance;
329
- row[3] = database;
330
- row[4] = componentId;
331
- row[5] = user;
332
- row[6] = fileSpec;
333
- row[7] = logFileSpec;
322
+ var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlDatabase", id);
323
+ row.Set(1, server);
324
+ row.Set(2, instance);
325
+ row.Set(3, database);
326
+ row.Set(4, componentId);
327
+ row.Set(5, user);
328
+ row.Set(6, fileSpec.Id);
329
+ row.Set(7, logFileSpec.Id);
330
if (0 != attributes)
331
{
336
- row[8] = attributes;
332
+ row.Set(8, attributes);
333
}
334
}
335
}
@@ -341,89 +337,90 @@ namespace WixToolset.Extensions
337
/// <summary>
338
/// Parses a sql file specification element.
339
/// </summary>
344
- /// <param name="node">Element to parse.</param>
340
+ /// <param name="intermediate"></param>
341
+ /// <param name="section"></param>
342
+ /// <param name="element">Element to parse.</param>
343
/// <returns>Identifier of sql file specification.</returns>
346
- private string ParseSqlFileSpecElement(XElement node)
344
+ private Identifier ParseSqlFileSpecElement(Intermediate intermediate, IntermediateSection section, XElement element)
345
{
348
- SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
349
- string id = null;
346
+ SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
347
+ Identifier id = null;
348
string fileName = null;
349
string growthSize = null;
350
string maxSize = null;
351
string name = null;
352
string size = null;
353
356
- foreach (XAttribute attrib in node.Attributes())
354
+ foreach (XAttribute attrib in element.Attributes())
355
{
356
if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
357
{
358
switch (attrib.Name.LocalName)
359
{
360
case "Id":
363
- id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
361
+ id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
362
break;
363
case "Name":
366
- name = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
364
+ name = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
365
break;
366
case "Filename":
369
- fileName = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
367
+ fileName = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
368
break;
369
case "Size":
372
- size = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
370
+ size = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
371
break;
372
case "MaxSize":
375
- maxSize = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
373
+ maxSize = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
374
break;
375
case "GrowthSize":
378
- growthSize = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
376
+ growthSize = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
377
break;
378
default:
381
- this.Core.UnexpectedAttribute(node, attrib);
379
+ this.ParseHelper.UnexpectedAttribute(element, attrib);
380
break;
381
}
382
}
383
else
384
{
387
- this.Core.ParseExtensionAttribute(node, attrib);
385
+ this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
386
}
387
}
388
389
if (null == id)
390
{
393
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
391
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
392
}
393
394
if (null == name)
395
{
398
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name"));
396
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name"));
397
}
398
399
if (null == fileName)
400
{
403
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Filename"));
401
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Filename"));
402
}
403
406
- this.Core.ParseForExtensionElements(node);
404
+ this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
405
408
- if (!this.Core.EncounteredError)
406
+ if (!this.Messaging.EncounteredError)
407
{
410
- Row row = this.Core.CreateRow(sourceLineNumbers, "SqlFileSpec");
411
- row[0] = id;
412
- row[1] = name;
413
- row[2] = fileName;
408
+ var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlFileSpec", id);
409
+ row.Set(1, name);
410
+ row.Set(2, fileName);
411
if (null != size)
412
{
416
- row[3] = size;
413
+ row.Set(3, size);
414
}
415
416
if (null != maxSize)
417
{
421
- row[4] = maxSize;
418
+ row.Set(4, maxSize);
419
}
420
421
if (null != growthSize)
422
{
426
- row[5] = growthSize;
423
+ row.Set(5, growthSize);
424
}
425
}
426
@@ -433,13 +430,13 @@ namespace WixToolset.Extensions
430
/// <summary>
431
/// Parses a sql script element.
432
/// </summary>
436
- /// <param name="node">Element to parse.</param>
433
+ /// <param name="element">Element to parse.</param>
434
/// <param name="componentId">Identifier for parent component.</param>
435
/// <param name="sqlDb">Optional database to execute script against.</param>
439
- private void ParseSqlScriptElement(XElement node, string componentId, string sqlDb)
436
+ private void ParseSqlScriptElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string sqlDb)
437
{
441
- SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
442
- string id = null;
438
+ SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
439
+ Identifier id = null;
440
int attributes = 0;
441
bool rollbackAttribute = false;
442
bool nonRollbackAttribute = false;
@@ -447,38 +444,38 @@ namespace WixToolset.Extensions
444
int sequence = CompilerConstants.IntegerNotSet;
445
string user = null;
446
450
- foreach (XAttribute attrib in node.Attributes())
447
+ foreach (XAttribute attrib in element.Attributes())
448
{
449
if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
450
{
451
switch (attrib.Name.LocalName)
452
{
453
case "Id":
457
- id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
454
+ id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
455
break;
456
case "BinaryKey":
460
- binary = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
461
- this.Core.CreateSimpleReference(sourceLineNumbers, "Binary", binary);
457
+ binary = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
458
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "Binary", binary);
459
break;
460
case "Sequence":
464
- sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue);
461
+ sequence = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue);
462
break;
463
case "SqlDb":
464
if (null != sqlDb)
465
{
469
- this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, node.Parent.Name.LocalName));
466
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, element.Parent.Name.LocalName));
467
}
471
- sqlDb = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
472
- this.Core.CreateSimpleReference(sourceLineNumbers, "SqlDatabase", sqlDb);
468
+ sqlDb = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
469
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "SqlDatabase", sqlDb);
470
break;
471
case "User":
475
- user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
476
- this.Core.CreateSimpleReference(sourceLineNumbers, "User", user);
472
+ user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
473
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user);
474
break;
475
476
// Flag-setting attributes
477
case "ContinueOnError":
481
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
478
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
479
{
480
attributes |= SqlContinueOnError;
481
}
@@ -486,11 +483,11 @@ namespace WixToolset.Extensions
483
case "ExecuteOnInstall":
484
if (rollbackAttribute)
485
{
489
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
486
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
487
}
488
nonRollbackAttribute = true;
489
493
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
490
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
491
{
492
attributes |= SqlExecuteOnInstall;
493
}
@@ -498,11 +495,11 @@ namespace WixToolset.Extensions
495
case "ExecuteOnReinstall":
496
if (rollbackAttribute)
497
{
501
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
498
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
499
}
500
nonRollbackAttribute = true;
501
505
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
502
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
503
{
504
attributes |= SqlExecuteOnReinstall;
505
}
@@ -510,11 +507,11 @@ namespace WixToolset.Extensions
507
case "ExecuteOnUninstall":
508
if (rollbackAttribute)
509
{
513
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
510
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
511
}
512
nonRollbackAttribute = true;
513
517
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
514
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
515
{
516
attributes |= SqlExecuteOnUninstall;
517
}
@@ -522,11 +519,11 @@ namespace WixToolset.Extensions
519
case "RollbackOnInstall":
520
if (nonRollbackAttribute)
521
{
525
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
522
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
523
}
524
rollbackAttribute = true;
525
529
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
526
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
527
{
528
attributes |= SqlExecuteOnInstall;
529
attributes |= SqlRollback;
@@ -535,11 +532,11 @@ namespace WixToolset.Extensions
532
case "RollbackOnReinstall":
533
if (nonRollbackAttribute)
534
{
538
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
535
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
536
}
537
rollbackAttribute = true;
538
542
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
539
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
540
{
541
attributes |= SqlExecuteOnReinstall;
542
attributes |= SqlRollback;
@@ -548,65 +545,64 @@ namespace WixToolset.Extensions
545
case "RollbackOnUninstall":
546
if (nonRollbackAttribute)
547
{
551
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
548
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
549
}
550
rollbackAttribute = true;
551
555
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
552
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
553
{
554
attributes |= SqlExecuteOnUninstall;
555
attributes |= SqlRollback;
556
}
557
break;
558
default:
562
- this.Core.UnexpectedAttribute(node, attrib);
559
+ this.ParseHelper.UnexpectedAttribute(element, attrib);
560
break;
561
}
562
}
563
else
564
{
568
- this.Core.ParseExtensionAttribute(node, attrib);
565
+ this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
566
}
567
}
568
569
if (null == id)
570
{
574
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
571
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
572
}
573
574
if (null == binary)
575
{
579
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "BinaryKey"));
576
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "BinaryKey"));
577
}
578
579
if (null == sqlDb)
580
{
584
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SqlDb"));
581
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SqlDb"));
582
}
583
584
if (0 == attributes)
585
{
589
- this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
586
+ this.Messaging.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, element.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
587
}
588
592
- this.Core.ParseForExtensionElements(node);
589
+ this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
590
591
// Reference InstallSqlData and UninstallSqlData since nothing will happen without it
595
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData");
596
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData");
592
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData");
593
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData");
594
598
- if (!this.Core.EncounteredError)
595
+ if (!this.Messaging.EncounteredError)
596
{
600
- Row row = this.Core.CreateRow(sourceLineNumbers, "SqlScript");
601
- row[0] = id;
602
- row[1] = sqlDb;
603
- row[2] = componentId;
604
- row[3] = binary;
605
- row[4] = user;
606
- row[5] = attributes;
597
+ var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlScript", id);
598
+ row.Set(1, sqlDb);
599
+ row.Set(2, componentId);
600
+ row.Set(3, binary);
601
+ row.Set(4, user);
602
+ row.Set(5, attributes);
603
if (CompilerConstants.IntegerNotSet != sequence)
604
{
609
- row[6] = sequence;
605
+ row.Set(6, sequence);
606
}
607
}
608
}
@@ -614,13 +610,13 @@ namespace WixToolset.Extensions
610
/// <summary>
611
/// Parses a sql string element.
612
/// </summary>
617
- /// <param name="node">Element to parse.</param>
613
+ /// <param name="element">Element to parse.</param>
614
/// <param name="componentId">Identifier for parent component.</param>
615
/// <param name="sqlDb">Optional database to execute string against.</param>
620
- private void ParseSqlStringElement(XElement node, string componentId, string sqlDb)
616
+ private void ParseSqlStringElement(Intermediate intermediate, IntermediateSection section, XElement element, string componentId, string sqlDb)
617
{
622
- SourceLineNumber sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
623
- string id = null;
618
+ SourceLineNumber sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element);
619
+ Identifier id = null;
620
int attributes = 0;
621
bool rollbackAttribute = false;
622
bool nonRollbackAttribute = false;
@@ -628,17 +624,17 @@ namespace WixToolset.Extensions
624
string sql = null;
625
string user = null;
626
631
- foreach (XAttribute attrib in node.Attributes())
627
+ foreach (XAttribute attrib in element.Attributes())
628
{
629
if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
630
{
631
switch (attrib.Name.LocalName)
632
{
633
case "Id":
638
- id = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
634
+ id = this.ParseHelper.GetAttributeIdentifier(sourceLineNumbers, attrib);
635
break;
636
case "ContinueOnError":
641
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
637
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
638
{
639
attributes |= SqlContinueOnError;
640
}
@@ -646,11 +642,11 @@ namespace WixToolset.Extensions
642
case "ExecuteOnInstall":
643
if (rollbackAttribute)
644
{
649
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
645
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
646
}
647
nonRollbackAttribute = true;
648
653
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
649
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
650
{
651
attributes |= SqlExecuteOnInstall;
652
}
@@ -658,11 +654,11 @@ namespace WixToolset.Extensions
654
case "ExecuteOnReinstall":
655
if (rollbackAttribute)
656
{
661
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
657
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
658
}
659
nonRollbackAttribute = true;
660
665
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
661
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
662
{
663
attributes |= SqlExecuteOnReinstall;
664
}
@@ -670,11 +666,11 @@ namespace WixToolset.Extensions
666
case "ExecuteOnUninstall":
667
if (rollbackAttribute)
668
{
673
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
669
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
670
}
671
nonRollbackAttribute = true;
672
677
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
673
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
674
{
675
attributes |= SqlExecuteOnUninstall;
676
}
@@ -682,11 +678,11 @@ namespace WixToolset.Extensions
678
case "RollbackOnInstall":
679
if (nonRollbackAttribute)
680
{
685
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
681
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
682
}
683
rollbackAttribute = true;
684
689
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
685
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
686
{
687
attributes |= SqlExecuteOnInstall;
688
attributes |= SqlRollback;
@@ -695,11 +691,11 @@ namespace WixToolset.Extensions
691
case "RollbackOnReinstall":
692
if (nonRollbackAttribute)
693
{
698
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
694
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
695
}
696
rollbackAttribute = true;
697
702
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
698
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
699
{
700
attributes |= SqlExecuteOnReinstall;
701
attributes |= SqlRollback;
@@ -708,84 +704,83 @@ namespace WixToolset.Extensions
704
case "RollbackOnUninstall":
705
if (nonRollbackAttribute)
706
{
711
- this.Core.OnMessage(WixErrors.IllegalAttributeWithOtherAttributes(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
707
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttributes(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall"));
708
}
709
rollbackAttribute = true;
710
715
- if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
711
+ if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib))
712
{
713
attributes |= SqlExecuteOnUninstall;
714
attributes |= SqlRollback;
715
}
716
break;
717
case "Sequence":
722
- sequence = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue);
718
+ sequence = this.ParseHelper.GetAttributeIntegerValue(sourceLineNumbers, attrib, 1, short.MaxValue);
719
break;
720
case "SQL":
725
- sql = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
721
+ sql = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
722
break;
723
case "SqlDb":
724
if (null != sqlDb)
725
{
730
- this.Core.OnMessage(WixErrors.IllegalAttributeWhenNested(sourceLineNumbers, node.Name.LocalName, "SqlDb", "SqlDatabase"));
726
+ this.Messaging.Write(ErrorMessages.IllegalAttributeWhenNested(sourceLineNumbers, element.Name.LocalName, "SqlDb", "SqlDatabase"));
727
}
728
733
- sqlDb = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
734
- this.Core.CreateSimpleReference(sourceLineNumbers, "SqlDatabase", sqlDb);
729
+ sqlDb = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
730
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "SqlDatabase", sqlDb);
731
break;
732
case "User":
737
- user = this.Core.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
738
- this.Core.CreateSimpleReference(sourceLineNumbers, "User", user);
733
+ user = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib);
734
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "User", user);
735
break;
736
default:
741
- this.Core.UnexpectedAttribute(node, attrib);
737
+ this.ParseHelper.UnexpectedAttribute(element, attrib);
738
break;
739
}
740
}
741
else
742
{
747
- this.Core.ParseExtensionAttribute(node, attrib);
743
+ this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, element, attrib);
744
}
745
}
746
747
if (null == id)
748
{
753
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Id"));
749
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Id"));
750
}
751
752
if (null == sql)
753
{
758
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SQL"));
754
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SQL"));
755
}
756
757
if (null == sqlDb)
758
{
763
- this.Core.OnMessage(WixErrors.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "SqlDb"));
759
+ this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "SqlDb"));
760
}
761
762
if (0 == attributes)
763
{
768
- this.Core.OnMessage(WixErrors.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
764
+ this.Messaging.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, element.Name.LocalName, "ExecuteOnInstall", "ExecuteOnReinstall", "ExecuteOnUninstall", "RollbackOnInstall", "RollbackOnReinstall", "RollbackOnUninstall"));
765
}
766
771
- this.Core.ParseForExtensionElements(node);
767
+ this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element);
768
769
// Reference InstallSqlData and UninstallSqlData since nothing will happen without it
774
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "InstallSqlData");
775
- this.Core.CreateSimpleReference(sourceLineNumbers, "CustomAction", "UninstallSqlData");
770
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "InstallSqlData");
771
+ this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, "CustomAction", "UninstallSqlData");
772
777
- if (!this.Core.EncounteredError)
773
+ if (!this.Messaging.EncounteredError)
774
{
779
- Row row = this.Core.CreateRow(sourceLineNumbers, "SqlString");
780
- row[0] = id;
781
- row[1] = sqlDb;
782
- row[2] = componentId;
783
- row[3] = sql;
784
- row[4] = user;
785
- row[5] = attributes;
775
+ var row = this.ParseHelper.CreateRow(section, sourceLineNumbers, "SqlString", id);
776
+ row.Set(1, sqlDb);
777
+ row.Set(2, componentId);
778
+ row.Set(3, sql);
779
+ row.Set(4, user);
780
+ row.Set(5, attributes);
781
if (CompilerConstants.IntegerNotSet != sequence)
782
{
788
- row[6] = sequence;
783
+ row.Set(6, sequence);
784
}
785
}
786
}
src/wixext/SqlDecompiler.cs
+3
-1
@@ -1,7 +1,8 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Extensions
3
+namespace WixToolset.Sql
4
{
5
+#if TODO_CONSIDER_DECOMPILER
6
using System.Collections;
7
using WixToolset.Data;
8
using WixToolset.Extensibility;
@@ -509,4 +510,5 @@ namespace WixToolset.Extensions
510
}
511
}
512
}
513
+#endif
514
}
src/wixext/SqlErrors.cs
+29
-13
@@ -1,32 +1,48 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Extensions
3
+namespace WixToolset.Sql
4
{
5
- public sealed class SqlErrors
5
+ using System.Resources;
6
+ using WixToolset.Data;
7
+
8
+ public static class SqlErrors
9
{
7
-
8
- private SqlErrors()
10
+ public static Message IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName)
11
{
12
+ return Message(sourceLineNumbers, Ids.IllegalAttributeWithoutComponent, "The {0}/@{1} attribute cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName, attributeName);
13
}
14
12
- public static MessageEventArgs IllegalAttributeWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName)
15
+ public static Message IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName)
16
{
14
- return new SqlErrorEventArgs(sourceLineNumbers, 5100, "SqlErrors_IllegalAttributeWithoutComponent_1", elementName, attributeName);
17
+ return Message(sourceLineNumbers, Ids.IllegalElementWithoutComponent, "The {0} element cannot be specified unless the element has a Component as an ancestor. A {0} that does not have a Component ancestor is not installed.", elementName);
18
}
19
17
- public static MessageEventArgs IllegalElementWithoutComponent(SourceLineNumber sourceLineNumbers, string elementName)
20
+ public static Message OneOfAttributesRequiredUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2, string attributeName3, string attributeName4)
21
{
19
- return new SqlErrorEventArgs(sourceLineNumbers, 5101, "SqlErrors_IllegalElementWithoutComponent_1", elementName);
22
+ return Message(sourceLineNumbers, Ids.OneOfAttributesRequiredUnderComponent, "When nested under a Component, the {0} element must have one of the following attributes specified: {1}, {2}, {3} or {4}.", elementName, attributeName1, attributeName2, attributeName3, attributeName4);
23
}
24
22
- public static MessageEventArgs OneOfAttributesRequiredUnderComponent(SourceLineNumber sourceLineNumbers, string elementName, string attributeName1, string attributeName2, string attributeName3, string attributeName4)
25
+ public static Message DeprecatedBinaryChildElement(SourceLineNumber sourceLineNumbers, string elementName)
26
{
24
- return new SqlErrorEventArgs(sourceLineNumbers, 5102, "SqlErrors_OneOfAttributesRequiredUnderComponent_1", elementName, attributeName1, attributeName2, attributeName3, attributeName4);
27
+ return Message(sourceLineNumbers, Ids.DeprecatedBinaryChildElement, "The {0} element contains a deprecated child Binary element. Please move the Binary element under a Fragment, Module, or Product element and set the {0}/@BinaryKey attribute to the value of the Binary/@Id attribute.", elementName);
28
}
26
-
27
- public static MessageEventArgs DeprecatedBinaryChildElement(SourceLineNumber sourceLineNumbers, string elementName)
29
+
30
+ private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
31
+ {
32
+ return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args);
33
+ }
34
+
35
+ private static Message Message(SourceLineNumber sourceLineNumber, Ids id, ResourceManager resourceManager, string resourceName, params object[] args)
36
+ {
37
+ return new Message(sourceLineNumber, MessageLevel.Error, (int)id, resourceManager, resourceName, args);
38
+ }
39
+
40
+ public enum Ids
41
{
29
- return new SqlErrorEventArgs(sourceLineNumbers, 5103, "SqlErrors_DeprecatedBinaryChildElement_1", elementName);
42
+ IllegalAttributeWithoutComponent = 5100,
43
+ IllegalElementWithoutComponent = 5101,
44
+ OneOfAttributesRequiredUnderComponent = 5102,
45
+ DeprecatedBinaryChildElement = 5103,
46
}
47
}
48
}
\ No newline at end of file
src/wixext/SqlExtensionData.cs
+8
-42
@@ -1,64 +1,30 @@
1
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3
-namespace WixToolset.Extensions
3
+namespace WixToolset.Sql
4
{
5
- using System;
6
- using System.Reflection;
5
using WixToolset.Data;
6
using WixToolset.Extensibility;
7
8
/// <summary>
9
/// The WiX Toolset SQL Server Extension.
10
/// </summary>
13
- public sealed class SqlExtensionData : ExtensionData
11
+ public sealed class SqlExtensionData : BaseExtensionData
12
{
13
/// <summary>
14
/// Gets the default culture.
15
/// </summary>
16
/// <value>The default culture.</value>
19
- public override string DefaultCulture
20
- {
21
- get { return "en-us"; }
22
- }
23
-
24
- /// <summary>
25
- /// Gets the optional table definitions for this extension.
26
- /// </summary>
27
- /// <value>The optional table definitions for this extension.</value>
28
- public override TableDefinitionCollection TableDefinitions
29
- {
30
- get
31
- {
32
- return SqlExtensionData.GetExtensionTableDefinitions();
33
- }
34
- }
35
-
36
- /// <summary>
37
- /// Gets the library associated with this extension.
38
- /// </summary>
39
- /// <param name="tableDefinitions">The table definitions to use while loading the library.</param>
40
- /// <returns>The loaded library.</returns>
41
- public override Library GetLibrary(TableDefinitionCollection tableDefinitions)
42
- {
43
- return SqlExtensionData.GetExtensionLibrary(tableDefinitions);
44
- }
17
+ public override string DefaultCulture => "en-US";
18
46
- /// <summary>
47
- /// Internal mechanism to access the extension's table definitions.
48
- /// </summary>
49
- /// <returns>Extension's table definitions.</returns>
50
- internal static TableDefinitionCollection GetExtensionTableDefinitions()
19
+ public override bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition)
20
{
52
- return ExtensionData.LoadTableDefinitionHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.tables.xml");
21
+ tupleDefinition = null;
22
+ return tupleDefinition != null;
23
}
24
55
- /// <summary>
56
- /// Internal mechanism to access the extension's library.
57
- /// </summary>
58
- /// <returns>Extension's library.</returns>
59
- internal static Library GetExtensionLibrary(TableDefinitionCollection tableDefinitions)
25
+ public override Intermediate GetLibrary(ITupleDefinitionCreator tupleDefinitions)
26
{
61
- return ExtensionData.LoadLibraryHelper(Assembly.GetExecutingAssembly(), "WixToolset.Extensions.Data.sql.wixlib", tableDefinitions);
27
+ return Intermediate.Load(typeof(SqlExtensionData).Assembly, "WixToolset.Sql.sql.wixlib", tupleDefinitions);
28
}
29
}
30
}
src/wixext/SqlExtensionFactory.cs
new
+18
@@ -0,0 +1,18 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+namespace WixToolset.Sql
4
+{
5
+ using System;
6
+ using System.Collections.Generic;
7
+ using WixToolset.Extensibility;
8
+
9
+ public class SqlExtensionFactory : BaseExtensionFactory
10
+ {
11
+ protected override IEnumerable<Type> ExtensionTypes => new[]
12
+ {
13
+ typeof(SqlCompiler),
14
+ typeof(SqlExtensionData),
15
+ typeof(SqlWindowsInstallerBackendBinderExtension),
16
+ };
17
+ }
18
+}
src/wixext/SqlWindowsInstallerBackendExtension.cs
new
+31
@@ -0,0 +1,31 @@
1
+// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
+
3
+namespace WixToolset.Sql
4
+{
5
+ using System.Linq;
6
+ using System.Xml;
7
+ using WixToolset.Data.WindowsInstaller;
8
+ using WixToolset.Extensibility;
9
+
10
+ public class SqlWindowsInstallerBackendBinderExtension : BaseWindowsInstallerBackendBinderExtension
11
+ {
12
+ public SqlWindowsInstallerBackendBinderExtension()
13
+ {
14
+
15
+ }
16
+
17
+ private static readonly TableDefinition[] Tables = LoadTables();
18
+
19
+ protected override TableDefinition[] TableDefinitionsForTuples => Tables;
20
+
21
+ private static TableDefinition[] LoadTables()
22
+ {
23
+ using (var resourceStream = typeof(SqlWindowsInstallerBackendBinderExtension).Assembly.GetManifestResourceStream("WixToolset.Sql.tables.xml"))
24
+ using (var reader = XmlReader.Create(resourceStream))
25
+ {
26
+ var tables = TableDefinitionCollection.Load(reader);
27
+ return tables.ToArray();
28
+ }
29
+ }
30
+ }
31
+}
src/wixext/WixToolset.Sql.wixext.csproj
new
+36
@@ -0,0 +1,36 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project Sdk="Microsoft.NET.Sdk">
5
+ <PropertyGroup>
6
+ <TargetFramework>netstandard2.0</TargetFramework>
7
+ <RootNamespace>WixToolset.Sql</RootNamespace>
8
+ <Description>WiX Toolset Sql Extension</Description>
9
+ <Title>WiX Toolset Sql Extension</Title>
10
+ <IsTool>true</IsTool>
11
+ <ContentTargetFolders>build</ContentTargetFolders>
12
+ </PropertyGroup>
13
+
14
+ <ItemGroup>
15
+ <Content Include="$(MSBuildThisFileName).targets" />
16
+ <Content Include="sql.xsd" PackagePath="tools" />
17
+ <EmbeddedResource Include="tables.xml" />
18
+ <EmbeddedResource Include="$(OutputPath)..\sql.wixlib" />
19
+ </ItemGroup>
20
+
21
+ <ItemGroup>
22
+ <ProjectReference Include="$(WixToolsetRootFolder)\Data\src\WixToolset.Data\WixToolset.Data.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Data\README.md') " />
23
+ <PackageReference Include="WixToolset.Data" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Data\README.md') " PrivateAssets="all" />
24
+
25
+ <ProjectReference Include="$(WixToolsetRootFolder)\Extensibility\src\WixToolset.Extensibility\WixToolset.Extensibility.csproj" Condition=" '$(Configuration)' == 'Debug' And Exists('$(WixToolsetRootFolder)\Extensibility\README.md') " />
26
+ <PackageReference Include="WixToolset.Extensibility" Version="4.0.*" Condition=" '$(Configuration)' == 'Release' Or !Exists('$(WixToolsetRootFolder)\Extensibility\README.md') " PrivateAssets="all" />
27
+ </ItemGroup>
28
+
29
+ <ItemGroup>
30
+ <ProjectReference Include="..\wixlib\sql.wixproj" ReferenceOutputAssembly="false" Condition=" '$(NCrunch)'=='' " />
31
+ </ItemGroup>
32
+
33
+ <ItemGroup>
34
+ <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
35
+ </ItemGroup>
36
+</Project>
src/wixext/WixToolset.Sql.wixext.targets
new
+11
@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+
4
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
5
+ <PropertyGroup>
6
+ <WixToolsetSqlWixextPath Condition=" '$(WixToolsetSqlWixextPath)' == '' ">$(MSBuildThisFileDirectory)..\tools\WixToolset.Sql.wixext.dll</WixToolsetSqlWixextPath>
7
+ </PropertyGroup>
8
+ <ItemGroup>
9
+ <WixExtension Include="$(WixToolsetSqlWixextPath)" />
10
+ </ItemGroup>
11
+</Project>
src/wixlib/SqlExtension.wxs
+8
-9
@@ -24,13 +24,13 @@
24
</UI>
25
26
<!-- The SQL custom actions should impersonate the user because the user"s cridentials are used when connected to the database if none are provided -->
27
- <CustomAction Id="InstallSqlData" BinaryKey="ScaSchedule2" DllEntry="InstallSqlData" Execute="immediate" Return="check" />
28
- <CustomAction Id="UninstallSqlData" BinaryKey="ScaSchedule2" DllEntry="UninstallSqlData" Execute="immediate" Return="check" />
29
- <CustomAction Id="CreateDatabase" BinaryKey="ScaExecute2" DllEntry="CreateDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
30
- <CustomAction Id="RollbackCreateDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
31
- <CustomAction Id="DropDatabase" BinaryKey="ScaExecute2" DllEntry="DropDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
32
- <CustomAction Id="ExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
33
- <CustomAction Id="RollbackExecuteSqlStrings" BinaryKey="ScaExecute2" DllEntry="ExecuteSqlStrings" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
27
+ <CustomAction Id="InstallSqlData" BinaryKey="SqlCA" DllEntry="InstallSqlData" Execute="immediate" Return="check" />
28
+ <CustomAction Id="UninstallSqlData" BinaryKey="SqlCA" DllEntry="UninstallSqlData" Execute="immediate" Return="check" />
29
+ <CustomAction Id="CreateDatabase" BinaryKey="SqlCA" DllEntry="CreateDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
30
+ <CustomAction Id="RollbackCreateDatabase" BinaryKey="SqlCA" DllEntry="DropDatabase" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
31
+ <CustomAction Id="DropDatabase" BinaryKey="SqlCA" DllEntry="DropDatabase" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
32
+ <CustomAction Id="ExecuteSqlStrings" BinaryKey="SqlCA" DllEntry="ExecuteSqlStrings" Execute="deferred" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
33
+ <CustomAction Id="RollbackExecuteSqlStrings" BinaryKey="SqlCA" DllEntry="ExecuteSqlStrings" Execute="rollback" Return="check" HideTarget="yes" SuppressModularization="yes" TerminalServerAware="yes" />
34
35
<InstallExecuteSequence>
36
<Custom Action="UninstallSqlData" Before="RemoveFiles" Overridable="yes">NOT SKIPUNINSTALLSQLDATA AND VersionNT > 400</Custom>
@@ -40,7 +40,6 @@
40
41
<!-- Server Custom Action DLL Definitions -->
42
<Fragment>
43
- <Binary Id="ScaSchedule2" SourceFile="scasched.dll" />
44
- <Binary Id="ScaExecute2" SourceFile="scaexec.dll" />
43
+ <Binary Id="SqlCA" SourceFile="sqlca.dll" />
44
</Fragment>
45
</Wix>
src/wixlib/caerr.wxi
new
+96
@@ -0,0 +1,96 @@
1
+<Include>
2
+ <?define msierrSecureObjectsFailedCreateSD = 25520?>
3
+ <?define msierrSecureObjectsFailedSet = 25521?>
4
+ <?define msierrSecureObjectsUnknownType = 25522?>
5
+ <?define msierrXmlFileFailedRead = 25530?>
6
+ <?define msierrXmlFileFailedOpen = 25531?>
7
+ <?define msierrXmlFileFailedSelect = 25532?>
8
+ <?define msierrXmlFileFailedSave = 25533?>
9
+ <?define msierrXmlConfigFailedRead = 25540?>
10
+ <?define msierrXmlConfigFailedOpen = 25541?>
11
+ <?define msierrXmlConfigFailedSelect = 25542?>
12
+ <?define msierrXmlConfigFailedSave = 25543?>
13
+ <?define msierrFirewallCannotConnect = 25580?>
14
+ <?define msierrIISCannotConnect = 26001?>
15
+ <?define msierrIISFailedReadWebSite = 26002?>
16
+ <?define msierrIISFailedReadWebDirs = 26003?>
17
+ <?define msierrIISFailedReadVDirs = 26004?>
18
+ <?define msierrIISFailedReadFilters = 26005?>
19
+ <?define msierrIISFailedReadAppPool = 26006?>
20
+ <?define msierrIISFailedReadMimeMap = 26007?>
21
+ <?define msierrIISFailedReadProp = 26008?>
22
+ <?define msierrIISFailedReadWebSvcExt = 26009?>
23
+ <?define msierrIISFailedReadWebError = 26010?>
24
+ <?define msierrIISFailedReadHttpHeader = 26011?>
25
+ <?define msierrIISFailedSchedTransaction = 26031?>
26
+ <?define msierrIISFailedSchedInstallWebs = 26032?>
27
+ <?define msierrIISFailedSchedInstallWebDirs = 26033?>
28
+ <?define msierrIISFailedSchedInstallVDirs = 26034?>
29
+ <?define msierrIISFailedSchedInstallFilters = 26035?>
30
+ <?define msierrIISFailedSchedInstallAppPool = 26036?>
31
+ <?define msierrIISFailedSchedInstallProp = 26037?>
32
+ <?define msierrIISFailedSchedInstallWebSvcExt = 26038?>
33
+ <?define msierrIISFailedSchedUninstallWebs = 26051?>
34
+ <?define msierrIISFailedSchedUninstallWebDirs = 26052?>
35
+ <?define msierrIISFailedSchedUninstallVDirs = 26053?>
36
+ <?define msierrIISFailedSchedUninstallFilters = 26054?>
37
+ <?define msierrIISFailedSchedUninstallAppPool = 26055?>
38
+ <?define msierrIISFailedSchedUninstallProp = 26056?>
39
+ <?define msierrIISFailedSchedUninstallWebSvcExt = 26057?>
40
+ <?define msierrIISFailedStartTransaction = 26101?>
41
+ <?define msierrIISFailedOpenKey = 26102?>
42
+ <?define msierrIISFailedCreateKey = 26103?>
43
+ <?define msierrIISFailedWriteData = 26104?>
44
+ <?define msierrIISFailedCreateApp = 26105?>
45
+ <?define msierrIISFailedDeleteKey = 26106?>
46
+ <?define msierrIISFailedDeleteApp = 26107?>
47
+ <?define msierrIISFailedDeleteValue = 26108?>
48
+ <?define msierrIISFailedCommitInUse = 26109?>
49
+ <?define msierrSQLFailedCreateDatabase = 26201?>
50
+ <?define msierrSQLFailedDropDatabase = 26202?>
51
+ <?define msierrSQLFailedConnectDatabase = 26203?>
52
+ <?define msierrSQLFailedExecString = 26204?>
53
+ <?define msierrSQLDatabaseAlreadyExists = 26205?>
54
+ <?define msierrPERFMONFailedRegisterDLL = 26251?>
55
+ <?define msierrPERFMONFailedUnregisterDLL = 26252?>
56
+ <?define msierrInstallPerfCounterData = 26253?>
57
+ <?define msierrUninstallPerfCounterData = 26254?>
58
+ <?define msierrSMBFailedCreate = 26301?>
59
+ <?define msierrSMBFailedDrop = 26302?>
60
+ <?define msierrCERTFailedOpen = 26351?>
61
+ <?define msierrCERTFailedAdd = 26352?>
62
+ <?define msierrUSRFailedUserCreate = 26401?>
63
+ <?define msierrUSRFailedUserCreatePswd = 26402?>
64
+ <?define msierrUSRFailedUserGroupAdd = 26403?>
65
+ <?define msierrUSRFailedUserCreateExists = 26404?>
66
+ <?define msierrUSRFailedGrantLogonAsService = 26405?>
67
+ <?define msierrDependencyMissingDependencies = 26451?>
68
+ <?define msierrDependencyHasDependents = 26452?>
69
+ <?define msierrDotNetRuntimeRequired = 27000?>
70
+ <?define msierrComPlusCannotConnect = 28001?>
71
+ <?define msierrComPlusPartitionReadFailed = 28002?>
72
+ <?define msierrComPlusPartitionRoleReadFailed = 28003?>
73
+ <?define msierrComPlusUserInPartitionRoleReadFailed = 28004?>
74
+ <?define msierrComPlusPartitionUserReadFailed = 28005?>
75
+ <?define msierrComPlusApplicationReadFailed = 28006?>
76
+ <?define msierrComPlusApplicationRoleReadFailed = 28007?>
77
+ <?define msierrComPlusUserInApplicationRoleReadFailed = 28008?>
78
+ <?define msierrComPlusAssembliesReadFailed = 28009?>
79
+ <?define msierrComPlusSubscriptionReadFailed = 28010?>
80
+ <?define msierrComPlusPartitionDependency = 28011?>
81
+ <?define msierrComPlusPartitionNotFound = 28012?>
82
+ <?define msierrComPlusPartitionIdConflict = 28013?>
83
+ <?define msierrComPlusPartitionNameConflict = 28014?>
84
+ <?define msierrComPlusApplicationDependency = 28015?>
85
+ <?define msierrComPlusApplicationNotFound = 28016?>
86
+ <?define msierrComPlusApplicationIdConflict = 28017?>
87
+ <?define msierrComPlusApplicationNameConflict = 28018?>
88
+ <?define msierrComPlusApplicationRoleDependency = 28019?>
89
+ <?define msierrComPlusApplicationRoleNotFound = 28020?>
90
+ <?define msierrComPlusApplicationRoleConflict = 28021?>
91
+ <?define msierrComPlusAssemblyDependency = 28022?>
92
+ <?define msierrComPlusSubscriptionIdConflict = 28023?>
93
+ <?define msierrComPlusSubscriptionNameConflict = 28024?>
94
+ <?define msierrComPlusFailedLookupNames = 28025?>
95
+ <?define msierrMsmqCannotConnect = 28101?>
96
+</Include>
\ No newline at end of file
src/wixlib/packages.config
new
+5
@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+ <package id="Nerdbank.GitVersioning" version="2.1.65" developmentDependency="true" targetFramework="net40" />
4
+ <package id="WixToolset.MSBuild" version="4.0.0-build-0005" developmentDependency="true" targetFramework="net40" />
5
+</packages>
\ No newline at end of file
src/wixlib/sql.v3.ncrunchproject
new
+5
@@ -0,0 +1,5 @@
1
+<ProjectConfiguration>
2
+ <Settings>
3
+ <IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
4
+ </Settings>
5
+</ProjectConfiguration>
\ No newline at end of file
src/wixlib/sql.wixproj
new
+46
@@ -0,0 +1,46 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
+<Project DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
4
+ <Import Project="..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props" Condition="Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" />
5
+ <Import Project="..\FindLocalWix.props" />
6
+ <PropertyGroup>
7
+ <ProjectGuid>{9ACF1A20-D801-45CC-A463-F9D13E506AA3}</ProjectGuid>
8
+ <OutputName>sql</OutputName>
9
+ <OutputType>Library</OutputType>
10
+ <BindFiles>true</BindFiles>
11
+ <Pedantic>true</Pedantic>
12
+ <Cultures>en-us</Cultures>
13
+ </PropertyGroup>
14
+ <ItemGroup>
15
+ <Compile Include="SqlExtension.wxs" />
16
+ <EmbeddedResource Include="de-de.wxl" />
17
+ <EmbeddedResource Include="en-us.wxl" />
18
+ <EmbeddedResource Include="es-es.wxl" />
19
+ <EmbeddedResource Include="ja-jp.wxl" />
20
+ <EmbeddedResource Include="pl-pl.wxl" />
21
+ <EmbeddedResource Include="pt-br.wxl" />
22
+ <EmbeddedResource Include="pt-pt.wxl" />
23
+ </ItemGroup>
24
+ <ItemGroup>
25
+ <None Include="packages.config" />
26
+ </ItemGroup>
27
+ <ItemGroup>
28
+ <ProjectReference Include="..\ca\sqlca.vcxproj">
29
+ <Name>sqlca</Name>
30
+ <Project>{4DCA6E4B-A1F1-4450-BC2D-94AC20F31935}</Project>
31
+ </ProjectReference>
32
+ </ItemGroup>
33
+ <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' AND Exists('$(WixTargetsPath)') " />
34
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\wix.targets') " />
35
+ <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
36
+ <Error Text="WiX Toolset build tools (v4.0 or later) must be installed to build this project. To download the WiX Toolset, go to http://wixtoolset.org/releases/." />
37
+ </Target>
38
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
39
+ <PropertyGroup>
40
+ <ErrorText>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}.</ErrorText>
41
+ </PropertyGroup>
42
+ <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
43
+ <Error Condition="!Exists('..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.MSBuild.4.0.0-build-0005\build\WixToolset.MSBuild.props'))" />
44
+ </Target>
45
+ <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
46
+</Project>
\ No newline at end of file
version.json
new
+11
@@ -0,0 +1,11 @@
1
+{
2
+ "version": "4.0",
3
+ "publicReleaseRefSpec": [
4
+ "^refs/heads/master$"
5
+ ],
6
+ "cloudBuild": {
7
+ "buildNumber": {
8
+ "enabled": true
9
+ }
10
+ }
11
+}