private static void add_assembly_resolver() { _handler = (sender, args) => { var requestedAssembly = new AssemblyName(args.Name); if (requestedAssembly.get_public_key_token().is_equal_to(ApplicationParameters.OfficialChocolateyPublicKey) && !requestedAssembly.Name.is_equal_to("chocolatey.licensed") && !requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase)) { 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); }; AppDomain.CurrentDomain.AssemblyResolve += _handler; }
private void extract_resources() { //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb IList <string> folders = new List <string> { "helpers", "functions", "redirects", "tools" }; try { AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance <IFileSystem>(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); } catch (Exception ex) { this.Log().Warn(ChocolateyLoggers.Important, "Please ensure that ChocolateyInstall environment variable is set properly and you've run once as an administrator to ensure all resources are extracted."); this.Log().Error("Unable to extract resources. Please ensure the ChocolateyInstall environment variable is set properly. You may need to run once as an admin to ensure all resources are extracted. Details:{0} {1}".format_with(Environment.NewLine, ex.ToString())); } }
private void extract_resources() { //refactor - thank goodness this is temporary, cuz manifest resource streams are dumb IList <string> folders = new List <string> { "helpers", "functions", "redirects", "tools" }; AssemblyFileExtractor.extract_all_resources_to_relative_directory(_container.GetInstance <IFileSystem>(), Assembly.GetAssembly(typeof(ChocolateyResourcesAssembly)), ApplicationParameters.InstallLocation, folders, ApplicationParameters.ChocolateyFileResources); }