Skip to content

Commit 5314694

Browse files
committed
(chocolateyGH-1949) New official release build configuration
This will be used when preparing for an official release of Chocolatey, to ensure that the correct strong name key is being used, and also that the necessary checks are being done when loading the Chocolatey Licensed assembly into the Chocolatey process. The FORCE_CHOCOLATEY_OFFICIAL_KEY compilation symbol if used in if/def statements to make this logic happen. A new build.official.bat file was also created to make the calling of this specific build easier to do as well.
1 parent 6b4d50b commit 5314694

File tree

13 files changed

+164
-14
lines changed

13 files changed

+164
-14
lines changed

.uppercut

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<property name="app.strongname" value="C:${path.separator}Program Files${path.separator}Microsoft SDKs${path.separator}Windows${path.separator}v7.0A${path.separator}Bin${path.separator}sn.exe" />
5454
<property name="app.strongname" value="C:${path.separator}Program Files (x86)${path.separator}Microsoft SDKs${path.separator}Windows${path.separator}v7.0A${path.separator}Bin${path.separator}sn.exe" if="${not file::exists(app.strongname)}" />
5555

56-
<property name="path.key.name.private" value="${environment::get-variable('CHOCOLATEY_OFFICIAL_KEY')}" if="${environment::variable-exists('CHOCOLATEY_OFFICIAL_KEY')}" />
56+
<property name="path.key.name.private" value="${environment::get-variable('CHOCOLATEY_OFFICIAL_KEY')}" if="${environment::variable-exists('CHOCOLATEY_OFFICIAL_KEY') and msbuild.configuration == 'ReleaseOfficial'}" />
5757

5858
<property name="app.signtool" value="C:${path.separator}Program Files${path.separator}Microsoft SDKs${path.separator}Windows${path.separator}v7.0A${path.separator}Bin${path.separator}signtool.exe" />
5959
<property name="app.signtool" value="C:${path.separator}Program Files (x86)${path.separator}Microsoft SDKs${path.separator}Windows${path.separator}v7.0A${path.separator}Bin${path.separator}signtool.exe" if="${not file::exists(app.signtool)}" />

build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET BUILD_DIR=%~d0%~p0%
1313
SET NANT="%BUILD_DIR%lib\Nant\nant.exe"
1414
SET build.config.settings="%DIR%\.uppercut"
1515

16-
%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% %*
16+
%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% -D:msbuild.configuration="Release" %*
1717

1818
if %ERRORLEVEL% NEQ 0 goto errors
1919

build.official.bat

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@echo off
2+
3+
::Project UppercuT - http://uppercut.googlecode.com
4+
::No edits to this file are required - http://uppercut.pbwiki.com
5+
6+
if '%1' == '/?' goto usage
7+
if '%1' == '-?' goto usage
8+
if '%1' == '?' goto usage
9+
if '%1' == '/help' goto usage
10+
11+
SET DIR=%cd%
12+
SET BUILD_DIR=%~d0%~p0%
13+
SET NANT="%BUILD_DIR%lib\Nant\nant.exe"
14+
SET build.config.settings="%DIR%\.uppercut"
15+
16+
%NANT% /logger:"NAnt.Core.DefaultLogger" /quiet /nologo /f:"%BUILD_DIR%.build\default.build" -D:build.config.settings=%build.config.settings% -D:msbuild.configuration="ReleaseOfficial" %*
17+
18+
if %ERRORLEVEL% NEQ 0 goto errors
19+
20+
call %DIR%\documentscenarios.bat
21+
22+
goto finish
23+
24+
:usage
25+
echo.
26+
echo Usage: build.official.bat
27+
echo.
28+
goto finish
29+
30+
:errors
31+
EXIT /B %ERRORLEVEL%
32+
33+
:finish

src/chocolatey.console/Program.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,11 @@ private static void add_assembly_resolver()
191191

192192
// There are things that are ILMerged into Chocolatey. Anything with
193193
// the right public key except licensed should use the choco/chocolatey assembly
194-
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
194+
if ((requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
195+
#if !FORCE_CHOCOLATEY_OFFICIAL_KEY
196+
|| requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.UnofficialChocolateyPublicKey)
197+
#endif
198+
)
195199
&& !requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName)
196200
&& !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase))
197201
{
@@ -200,13 +204,17 @@ private static void add_assembly_resolver()
200204

201205
try
202206
{
203-
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
207+
if ((requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
208+
#if !FORCE_CHOCOLATEY_OFFICIAL_KEY
209+
|| requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.UnofficialChocolateyPublicKey)
210+
#endif
211+
)
204212
&& requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName))
205213
{
206214
"chocolatey".Log().Debug(() => "Resolving reference to chocolatey.licensed...");
207215
return AssemblyResolution.resolve_or_load_assembly(
208216
ApplicationParameters.LicensedChocolateyAssemblySimpleName,
209-
ApplicationParameters.OfficialChocolateyPublicKey,
217+
requestedAssembly.get_public_key_token(),
210218
ApplicationParameters.LicensedAssemblyLocation).UnderlyingType;
211219
}
212220
}

src/chocolatey.console/chocolatey.console.csproj

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@
9898
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
9999
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
100100
</PropertyGroup>
101+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|x86'">
102+
<OutputPath>bin\x86\ReleaseOfficial\</OutputPath>
103+
<DefineConstants>TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
104+
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
105+
<Optimize>true</Optimize>
106+
<PlatformTarget>x86</PlatformTarget>
107+
<ErrorReport>prompt</ErrorReport>
108+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
109+
</PropertyGroup>
110+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
111+
<OutputPath>bin\ReleaseOfficial\</OutputPath>
112+
<DefineConstants>TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY</DefineConstants>
113+
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
114+
<Optimize>true</Optimize>
115+
<PlatformTarget>AnyCPU</PlatformTarget>
116+
<ErrorReport>prompt</ErrorReport>
117+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
118+
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
119+
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
120+
</PropertyGroup>
101121
<ItemGroup>
102122
<Reference Include="AlphaFS, Version=2.1.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
103123
<SpecificVersion>False</SpecificVersion>
@@ -174,4 +194,4 @@
174194
<Target Name="AfterBuild">
175195
</Target>
176196
-->
177-
</Project>
197+
</Project>

src/chocolatey.resources/chocolatey.resources.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
<ErrorReport>prompt</ErrorReport>
3939
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4040
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
42+
<OutputPath>bin\ReleaseOfficial\</OutputPath>
43+
<DefineConstants>TRACE</DefineConstants>
44+
<Optimize>true</Optimize>
45+
<PlatformTarget>AnyCPU</PlatformTarget>
46+
<ErrorReport>prompt</ErrorReport>
47+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
48+
</PropertyGroup>
4149
<ItemGroup>
4250
<Reference Include="System" />
4351
<Reference Include="System.Core" />

src/chocolatey.sln

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2010
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.902
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "chocolatey.console", "chocolatey.console\chocolatey.console.csproj", "{E24E3386-244F-4404-9E6E-5B53818EA903}"
57
EndProject
68
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "chocolatey.tests", "chocolatey.tests\chocolatey.tests.csproj", "{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}"
@@ -52,6 +54,9 @@ Global
5254
NoResources|Any CPU = NoResources|Any CPU
5355
NoResources|Mixed Platforms = NoResources|Mixed Platforms
5456
NoResources|x86 = NoResources|x86
57+
ReleaseOfficial|Any CPU = ReleaseOfficial|Any CPU
58+
ReleaseOfficial|Mixed Platforms = ReleaseOfficial|Mixed Platforms
59+
ReleaseOfficial|x86 = ReleaseOfficial|x86
5560
Release|Any CPU = Release|Any CPU
5661
Release|Mixed Platforms = Release|Mixed Platforms
5762
Release|x86 = Release|x86
@@ -66,6 +71,12 @@ Global
6671
{E24E3386-244F-4404-9E6E-5B53818EA903}.NoResources|Any CPU.ActiveCfg = NoResources|Any CPU
6772
{E24E3386-244F-4404-9E6E-5B53818EA903}.NoResources|Mixed Platforms.ActiveCfg = NoResources|x86
6873
{E24E3386-244F-4404-9E6E-5B53818EA903}.NoResources|x86.ActiveCfg = NoResources|x86
74+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU
75+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU
76+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|x86
77+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|x86
78+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|x86
79+
{E24E3386-244F-4404-9E6E-5B53818EA903}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|x86
6980
{E24E3386-244F-4404-9E6E-5B53818EA903}.Release|Any CPU.ActiveCfg = Release|Any CPU
7081
{E24E3386-244F-4404-9E6E-5B53818EA903}.Release|Any CPU.Build.0 = Release|Any CPU
7182
{E24E3386-244F-4404-9E6E-5B53818EA903}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -80,6 +91,12 @@ Global
8091
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.NoResources|Any CPU.ActiveCfg = NoResources|Any CPU
8192
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.NoResources|Mixed Platforms.ActiveCfg = NoResources|Any CPU
8293
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.NoResources|x86.ActiveCfg = NoResources|Any CPU
94+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU
95+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU
96+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU
97+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU
98+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|Any CPU
99+
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|Any CPU
83100
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
84101
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.Release|Any CPU.Build.0 = Release|Any CPU
85102
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -96,6 +113,12 @@ Global
96113
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.NoResources|Mixed Platforms.Build.0 = NoResources|Any CPU
97114
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.NoResources|x86.ActiveCfg = NoResources|Any CPU
98115
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.NoResources|x86.Build.0 = NoResources|Any CPU
116+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU
117+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU
118+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU
119+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU
120+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|Any CPU
121+
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|Any CPU
99122
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.Release|Any CPU.ActiveCfg = Release|Any CPU
100123
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.Release|Any CPU.Build.0 = Release|Any CPU
101124
{5563DC61-35FD-4FAB-B331-9AE1FDB23F80}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -109,6 +132,12 @@ Global
109132
{AF584111-FE32-448D-A1D0-63217AF8B43C}.NoResources|Any CPU.ActiveCfg = NoResources|Any CPU
110133
{AF584111-FE32-448D-A1D0-63217AF8B43C}.NoResources|Mixed Platforms.ActiveCfg = NoResources|Any CPU
111134
{AF584111-FE32-448D-A1D0-63217AF8B43C}.NoResources|x86.ActiveCfg = NoResources|Any CPU
135+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU
136+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU
137+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU
138+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU
139+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|Any CPU
140+
{AF584111-FE32-448D-A1D0-63217AF8B43C}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|Any CPU
112141
{AF584111-FE32-448D-A1D0-63217AF8B43C}.Release|Any CPU.ActiveCfg = Release|Any CPU
113142
{AF584111-FE32-448D-A1D0-63217AF8B43C}.Release|Any CPU.Build.0 = Release|Any CPU
114143
{AF584111-FE32-448D-A1D0-63217AF8B43C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -122,6 +151,12 @@ Global
122151
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.NoResources|Any CPU.ActiveCfg = NoResources|Any CPU
123152
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.NoResources|Mixed Platforms.ActiveCfg = NoResources|Any CPU
124153
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.NoResources|x86.ActiveCfg = NoResources|Any CPU
154+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU
155+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU
156+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU
157+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU
158+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|Any CPU
159+
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|Any CPU
125160
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.Release|Any CPU.ActiveCfg = Release|Any CPU
126161
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.Release|Any CPU.Build.0 = Release|Any CPU
127162
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -135,8 +170,8 @@ Global
135170
{5C4C60F0-47B1-498E-ABF7-D315E1A94BC9} = {7656D054-387D-409C-A9FB-62A44599AA77}
136171
{12ECAD4F-D463-4D72-A792-A4FCCFE9C456} = {7656D054-387D-409C-A9FB-62A44599AA77}
137172
{DAB29F30-149D-4005-A8D2-4FA56CF2784D} = {FB6236DD-17EF-4C36-943C-47792FBC3306}
138-
{DD9689F3-1D2D-41AE-A672-063EE70C0C9A} = {FB6236DD-17EF-4C36-943C-47792FBC3306}
139173
{E5C987F8-6B95-4835-BBDD-A25C9D370BB9} = {DAB29F30-149D-4005-A8D2-4FA56CF2784D}
174+
{DD9689F3-1D2D-41AE-A672-063EE70C0C9A} = {FB6236DD-17EF-4C36-943C-47792FBC3306}
140175
EndGlobalSection
141176
GlobalSection(ExtensibilityGlobals) = postSolution
142177
SolutionGuid = {998CAC46-A2B8-447C-B4CC-3B11DC35ED46}

src/chocolatey.tests.integration/chocolatey.tests.integration.csproj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
<ErrorReport>prompt</ErrorReport>
4242
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4343
</PropertyGroup>
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
45+
<OutputPath>bin\ReleaseOfficial\</OutputPath>
46+
<DefineConstants>TRACE</DefineConstants>
47+
<Optimize>true</Optimize>
48+
<DebugType>pdbonly</DebugType>
49+
<PlatformTarget>AnyCPU</PlatformTarget>
50+
<ErrorReport>prompt</ErrorReport>
51+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
52+
</PropertyGroup>
4453
<ItemGroup>
4554
<Reference Include="bdddoc">
4655
<HintPath>..\..\lib\bdddoc\bdddoc.dll</HintPath>
@@ -510,4 +519,4 @@
510519
<Target Name="AfterBuild">
511520
</Target>
512521
-->
513-
</Project>
522+
</Project>

src/chocolatey.tests/chocolatey.tests.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
<ErrorReport>prompt</ErrorReport>
4141
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4242
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseOfficial|AnyCPU'">
44+
<OutputPath>bin\ReleaseOfficial\</OutputPath>
45+
<DefineConstants>TRACE</DefineConstants>
46+
<Optimize>true</Optimize>
47+
<DebugType>pdbonly</DebugType>
48+
<PlatformTarget>AnyCPU</PlatformTarget>
49+
<ErrorReport>prompt</ErrorReport>
50+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
51+
</PropertyGroup>
4352
<ItemGroup>
4453
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
4554
<HintPath>..\packages\log4net.2.0.3\lib\net40-client\log4net.dll</HintPath>

src/chocolatey/GetChocolatey.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2017 - 2019 Chocolatey Software, Inc
1+
// Copyright © 2017 - 2019 Chocolatey Software, Inc
22
// Copyright © 2011 - 2017 RealDimensions Software, LLC
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -68,7 +68,11 @@ private static void add_assembly_resolver()
6868

6969
// There are things that are ILMerged into Chocolatey. Anything with
7070
// the right public key except licensed should use the choco/chocolatey assembly
71-
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
71+
if ((requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
72+
#if !FORCE_CHOCOLATEY_OFFICIAL_KEY
73+
|| requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.UnofficialChocolateyPublicKey)
74+
#endif
75+
)
7276
&& !requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName)
7377
&& !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase))
7478
{
@@ -77,13 +81,17 @@ private static void add_assembly_resolver()
7781

7882
try
7983
{
80-
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
84+
if ((requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
85+
#if !FORCE_CHOCOLATEY_OFFICIAL_KEY
86+
|| requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.UnofficialChocolateyPublicKey)
87+
#endif
88+
)
8189
&& requestedAssembly.Name.is_equal_to(ApplicationParameters.LicensedChocolateyAssemblySimpleName))
8290
{
8391
_logger.Debug("Resolving reference to chocolatey.licensed...");
8492
return AssemblyResolution.resolve_or_load_assembly(
8593
ApplicationParameters.LicensedChocolateyAssemblySimpleName,
86-
ApplicationParameters.OfficialChocolateyPublicKey,
94+
requestedAssembly.get_public_key_token(),
8795
ApplicationParameters.LicensedAssemblyLocation).UnderlyingType;
8896
}
8997
}

0 commit comments

Comments
 (0)