Skip to content

Commit 8c95abb

Browse files
author
Roelant Vos
committed
Added roll-up of assemblies into single exe for convenience.
1 parent 41a0fab commit 8c95abb

6 files changed

Lines changed: 189 additions & 18 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
2+
<Costura />
3+
</Weavers>
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3+
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
4+
<xs:element name="Weavers">
5+
<xs:complexType>
6+
<xs:all>
7+
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
8+
<xs:complexType>
9+
<xs:all>
10+
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
11+
<xs:annotation>
12+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
13+
</xs:annotation>
14+
</xs:element>
15+
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
16+
<xs:annotation>
17+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
18+
</xs:annotation>
19+
</xs:element>
20+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
21+
<xs:annotation>
22+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
23+
</xs:annotation>
24+
</xs:element>
25+
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
26+
<xs:annotation>
27+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
28+
</xs:annotation>
29+
</xs:element>
30+
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
31+
<xs:annotation>
32+
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
33+
</xs:annotation>
34+
</xs:element>
35+
</xs:all>
36+
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
37+
<xs:annotation>
38+
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
39+
</xs:annotation>
40+
</xs:attribute>
41+
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
42+
<xs:annotation>
43+
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
44+
</xs:annotation>
45+
</xs:attribute>
46+
<xs:attribute name="DisableCompression" type="xs:boolean">
47+
<xs:annotation>
48+
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
49+
</xs:annotation>
50+
</xs:attribute>
51+
<xs:attribute name="DisableCleanup" type="xs:boolean">
52+
<xs:annotation>
53+
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
54+
</xs:annotation>
55+
</xs:attribute>
56+
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
57+
<xs:annotation>
58+
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
59+
</xs:annotation>
60+
</xs:attribute>
61+
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
62+
<xs:annotation>
63+
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
64+
</xs:annotation>
65+
</xs:attribute>
66+
<xs:attribute name="ExcludeAssemblies" type="xs:string">
67+
<xs:annotation>
68+
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
69+
</xs:annotation>
70+
</xs:attribute>
71+
<xs:attribute name="IncludeAssemblies" type="xs:string">
72+
<xs:annotation>
73+
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
74+
</xs:annotation>
75+
</xs:attribute>
76+
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
77+
<xs:annotation>
78+
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
79+
</xs:annotation>
80+
</xs:attribute>
81+
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
82+
<xs:annotation>
83+
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
84+
</xs:annotation>
85+
</xs:attribute>
86+
<xs:attribute name="PreloadOrder" type="xs:string">
87+
<xs:annotation>
88+
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
89+
</xs:annotation>
90+
</xs:attribute>
91+
</xs:complexType>
92+
</xs:element>
93+
</xs:all>
94+
<xs:attribute name="VerifyAssembly" type="xs:boolean">
95+
<xs:annotation>
96+
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
97+
</xs:annotation>
98+
</xs:attribute>
99+
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
100+
<xs:annotation>
101+
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
102+
</xs:annotation>
103+
</xs:attribute>
104+
<xs:attribute name="GenerateXsd" type="xs:boolean">
105+
<xs:annotation>
106+
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
107+
</xs:annotation>
108+
</xs:attribute>
109+
</xs:complexType>
110+
</xs:element>
111+
</xs:schema>

ClassLibrary/DataWarehouseAutomation/RunDwhAutomation/Program.cs

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,32 @@ static int Main(string[] args)
1414
// An optimistic start.
1515
Environment.ExitCode = (int)ExitCode.Success;
1616

17+
#region unit testing
1718
// Unit testing only.
18-
var testArgs = new string[]
19-
{
20-
// "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\sampleBasic.json"
21-
"-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\"
22-
,"-p", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Templates\TemplateSampleBasic.Handlebars"
23-
,"-o"
24-
,"-d", @"C:\Files\"
25-
,"-e", "sql"
26-
,"-f", "roelant"
27-
,"-v"
28-
};
29-
30-
CommandLineArgumentHelper environmentHelper = new CommandLineArgumentHelper(testArgs);
19+
//var testArgs = new string[]
20+
//{
21+
// // "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\sampleBasic.json"
22+
// "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\"
23+
// ,"-p", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Templates\TemplateSampleBasic.Handlebars"
24+
// ,"-o"
25+
// ,"-d", @"C:\Files\"
26+
// ,"-e", "sql"
27+
// ,"-f", "roelant"
28+
// ,"-v"
29+
//};
30+
31+
//var testArgs = new string[]
32+
//{
33+
// "-i", @"C:\Github\Data-Warehouse-Automation-Metadata-Schema\ClassLibrary\DataWarehouseAutomation\Sample_Metadata\sampleBasic.json"
34+
// "-i", @"C:\Files\Test\"
35+
// ,"-p", @"C:\Files\Test\TemplateSampleBasic.Handlebars"
36+
// ,"-o"
37+
// ,"-f", "roelant"
38+
// ,"-v"
39+
//};
40+
#endregion
41+
42+
CommandLineArgumentHelper environmentHelper = new CommandLineArgumentHelper();
3143
string[] localArgs = environmentHelper.args;
3244

3345
Parser.Default.ParseArguments<Options>(localArgs).WithParsed(options =>
@@ -89,7 +101,7 @@ static int Main(string[] args)
89101
Console.WriteLine($"The File Exension for output file(s) is {options.OutputFileExtension}");
90102
}
91103

92-
Console.WriteLine();
104+
//Console.WriteLine();
93105
}
94106

95107
#region Core
@@ -98,7 +110,7 @@ static int Main(string[] args)
98110

99111
if (IsPath)
100112
{
101-
var localFiles = Directory.GetFiles(options.Input);
113+
var localFiles = Directory.GetFiles(options.Input, "*.json");
102114

103115
foreach (var file in localFiles)
104116
{
@@ -137,7 +149,7 @@ static int Main(string[] args)
137149
//Console.WriteLine(helpText);
138150

139151

140-
Console.ReadKey();
152+
//Console.ReadKey();
141153

142154
return Environment.ExitCode;
143155
}
@@ -165,6 +177,8 @@ private static void RunAutomation(Options options, string inputFileName, string
165177
outputFileName = deserialisedMapping.dataObjectMappings[0].mappingName;
166178
}
167179

180+
Console.WriteLine($"Generating {outputFileName}.{options.OutputFileExtension} to {options.OutputDirectory}.");
181+
168182
using (StreamWriter file = new StreamWriter($"{options.OutputDirectory}\\{outputFileName}.{options.OutputFileExtension}"))
169183
{
170184
file.WriteLine(result);
@@ -196,7 +210,7 @@ class Options
196210
public string Pattern { get; set; }
197211

198212
// Outputs
199-
[Option('o', "output", Required = false, HelpText = "Enable output to be spooled to disk.")]
213+
[Option('o', "output", Required = false, HelpText = "Enable output to be spooled to disk (enable/disable) - default is disable.")]
200214
public bool Output { get; set; }
201215

202216
[Option('d', "outputdirectory", Required = false, HelpText = "The directory where spool files (output) are placed. If not provided, the execution directory will be assumed.")]

ClassLibrary/DataWarehouseAutomation/RunDwhAutomation/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[assembly: AssemblyTitle("RunDwhAutomation")]
99
[assembly: AssemblyDescription("")]
1010
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyCompany("Roelant Vos")]
1212
[assembly: AssemblyProduct("RunDwhAutomation")]
1313
[assembly: AssemblyCopyright("Copyright © 2020")]
1414
[assembly: AssemblyTrademark("")]

ClassLibrary/DataWarehouseAutomation/RunDwhAutomation/RunDwhAutomation.csproj

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" />
34
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
45
<PropertyGroup>
56
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -12,6 +13,23 @@
1213
<FileAlignment>512</FileAlignment>
1314
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1415
<Deterministic>true</Deterministic>
16+
<PublishUrl>publish\</PublishUrl>
17+
<Install>true</Install>
18+
<InstallFrom>Disk</InstallFrom>
19+
<UpdateEnabled>false</UpdateEnabled>
20+
<UpdateMode>Foreground</UpdateMode>
21+
<UpdateInterval>7</UpdateInterval>
22+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
23+
<UpdatePeriodically>false</UpdatePeriodically>
24+
<UpdateRequired>false</UpdateRequired>
25+
<MapFileExtensions>true</MapFileExtensions>
26+
<ApplicationRevision>0</ApplicationRevision>
27+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
28+
<IsWebBootstrapper>false</IsWebBootstrapper>
29+
<UseApplicationTrust>false</UseApplicationTrust>
30+
<BootstrapperEnabled>true</BootstrapperEnabled>
31+
<NuGetPackageImportStamp>
32+
</NuGetPackageImportStamp>
1533
</PropertyGroup>
1634
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1735
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -36,6 +54,9 @@
3654
<Reference Include="CommandLine, Version=2.8.0.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
3755
<HintPath>..\packages\CommandLineParser.2.8.0\lib\net461\CommandLine.dll</HintPath>
3856
</Reference>
57+
<Reference Include="Costura, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
58+
<HintPath>..\packages\Costura.Fody.4.1.0\lib\net40\Costura.dll</HintPath>
59+
</Reference>
3960
<Reference Include="Handlebars, Version=1.11.5.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661, processorArchitecture=MSIL">
4061
<HintPath>..\packages\Handlebars.Net.1.11.5\lib\net452\Handlebars.dll</HintPath>
4162
</Reference>
@@ -66,5 +87,25 @@
6687
<Name>DataWarehouseAutomation</Name>
6788
</ProjectReference>
6889
</ItemGroup>
90+
<ItemGroup>
91+
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
92+
<Visible>False</Visible>
93+
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 and x64%29</ProductName>
94+
<Install>true</Install>
95+
</BootstrapperPackage>
96+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
97+
<Visible>False</Visible>
98+
<ProductName>.NET Framework 3.5 SP1</ProductName>
99+
<Install>false</Install>
100+
</BootstrapperPackage>
101+
</ItemGroup>
69102
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
103+
<Import Project="..\packages\Fody.6.0.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.0.0\build\Fody.targets')" />
104+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
105+
<PropertyGroup>
106+
<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>
107+
</PropertyGroup>
108+
<Error Condition="!Exists('..\packages\Fody.6.0.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.0.0\build\Fody.targets'))" />
109+
<Error Condition="!Exists('..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.4.1.0\build\Costura.Fody.props'))" />
110+
</Target>
70111
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="CommandLineParser" version="2.8.0" targetFramework="net472" />
4+
<package id="Costura.Fody" version="4.1.0" targetFramework="net472" />
5+
<package id="Fody" version="6.0.0" targetFramework="net472" developmentDependency="true" />
46
<package id="Handlebars.Net" version="1.11.5" targetFramework="net472" />
57
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
68
</packages>

0 commit comments

Comments
 (0)