Skip to content

Commit

Permalink
(GH-866) Fix - packages.config fails on licensed config
Browse files Browse the repository at this point in the history
Attempting install packages.config fails when choco attempts to copy
the licensed config but can't find the licensed assembly. Ensure when
the licensed assembly isn't found by normal means the assembly resolver
will attempt to load it from its known location.
  • Loading branch information
ferventcoder committed Aug 11, 2016
1 parent 2cbb40f commit f98f610
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,19 @@ private static void add_assembly_resolver()
return typeof(ConsoleApplication).Assembly;
}

try
{
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
&& requestedAssembly.Name.is_equal_to("chocolatey.licensed"))
{
return Assembly.LoadFile(ApplicationParameters.LicensedAssemblyLocation).UnderlyingType;
}
}
catch (Exception ex)
{
"chocolatey".Log().Warn("Unable to load chocolatey.licensed assembly. {0}".format_with(ex.Message));
}

return null;
};

Expand Down
13 changes: 13 additions & 0 deletions src/chocolatey/GetChocolatey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ private static void add_assembly_resolver()
return typeof(Lets).Assembly;
}

try
{
if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey)
&& requestedAssembly.Name.is_equal_to("chocolatey.licensed"))
{
return Assembly.LoadFile(ApplicationParameters.LicensedAssemblyLocation).UnderlyingType;
}
}
catch (Exception ex)
{
"chocolatey".Log().Warn("Unable to load chocolatey.licensed assembly. {0}".format_with(ex.Message));
}

return null;
};

Expand Down

0 comments on commit f98f610

Please sign in to comment.