Skip to content

Commit

Permalink
(GH-1054) Externalize the app.manifest
Browse files Browse the repository at this point in the history
If an app.manifest is embedded in an assembly, you can not override it
at all with a local manifest created next to it. However there is one
scenario that does allow for it to be adjusted, set the file outside
next to the executable to control the behavior of the assembly.

This allows it to be adjusted when folks need to control the behavior
of Chocolatey to suit their needs. This is a compromise to ensure good
default behavior with the ability to adjust it when necessary.
  • Loading branch information
ferventcoder committed Mar 22, 2017
1 parent 94a448d commit 9163fe8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/chocolatey.console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ private static void Main(string[] args)

remove_old_chocolatey_exe(fileSystem);

AssemblyFileExtractor.extract_all_resources_to_relative_directory(fileSystem, Assembly.GetAssembly(typeof(Program)), ApplicationParameters.InstallLocation, new List<string>(), "chocolatey.console");
//refactor - thank goodness this is temporary, cuz manifest resource streams are dumb
IList<string> folders = new List<string>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<assemblyIdentity version="1.0.0.0" name="choco.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
Expand All @@ -23,7 +23,7 @@

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<!-- Windows 10 / Windows Server 2016 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<!-- Windows 8.1 / Windows Server 2012 R2 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
Expand Down
7 changes: 4 additions & 3 deletions src/chocolatey.console/chocolatey.console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@
<PropertyGroup>
<StartupObject>chocolatey.console.Program</StartupObject>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AlphaFS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4d31a58f7d7ad5c9, processorArchitecture=MSIL">
Expand Down Expand Up @@ -116,9 +117,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.manifest">
<EmbeddedResource Include="choco.exe.manifest">
<SubType>Designer</SubType>
</None>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="targets\Microsoft.Application.targets" />
</ItemGroup>
Expand Down

0 comments on commit 9163fe8

Please sign in to comment.