Skip to content

Commit

Permalink
Fixes #52 (Windows 10 support) by upgrading all projects to .NET 4.0.…
Browse files Browse the repository at this point in the history
… Fixes extract command from Windows Explorer. Apparently it hasnt worked since the split of the gui and cli exes. Also renames the caption of the Windows Explorer shortcut menu items to begin with Lessmsi
  • Loading branch information
activescott committed Nov 6, 2015
1 parent 9a581a6 commit 2a6b3a4
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 61 deletions.
3 changes: 2 additions & 1 deletion src/ExplorerShortcutHelper/ExplorerShortcutHelper.csproj
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Willeke.Scott.ExplorerShortcutHelper</RootNamespace>
<AssemblyName>AddWindowsExplorerShortcut</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>
</StartupObject>
Expand All @@ -34,6 +34,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 0 additions & 2 deletions src/ExplorerShortcutHelper/Program.cs
Expand Up @@ -97,8 +97,6 @@ static int Main(string[] args)
}
Console.WriteLine("Shortcut removed.");
}
Console.WriteLine("Press enter to continue.");
Console.ReadLine();
return 0;
}

Expand Down
8 changes: 6 additions & 2 deletions src/ExplorerShortcutHelper/app.config
@@ -1,3 +1,7 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup/></configuration>
<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v4.5"/>
</startup>
</configuration>
2 changes: 1 addition & 1 deletion src/ExplorerShortcutHelper/app.manifest
@@ -1,6 +1,6 @@
<?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="Willeke.Scott.ExplorerShortcutHelper"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
8 changes: 4 additions & 4 deletions src/LessMsi.Cli/App.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
</startup>
<startup>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v4.5"/>
</startup>
</configuration>
5 changes: 3 additions & 2 deletions src/LessMsi.Cli/LessMsi.Cli.csproj
Expand Up @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LessMsi.Cli</RootNamespace>
<AssemblyName>lessmsi</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
5 changes: 3 additions & 2 deletions src/LessMsi.Core/LessMsi.Core.csproj
Expand Up @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LessMsi</RootNamespace>
<AssemblyName>lessmsi.core</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
5 changes: 3 additions & 2 deletions src/LessMsi.Gui/LessMsi.Gui.csproj
Expand Up @@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LessMsi.Gui</RootNamespace>
<AssemblyName>lessmsi-gui</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
Expand Down
31 changes: 17 additions & 14 deletions src/LessMsi.Gui/PreferencesForm.cs
Expand Up @@ -55,41 +55,40 @@ private void cmdAddRemoveShortcut_Click(object sender, EventArgs e)
* This code below is funky because apparently Win32 requires us to escape double quotes on the command line when passing them through the command line.
* So we have to actually espcape the escape char here to make sure double quotes are properly escaped
* Explained more at http://bytes.com/topic/net/answers/745324-console-application-command-line-parameter-issue and http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx
*/
*
* Also see https://github.com/activescott/lessmsi/wiki/Command-Line for commandline reference for the commands used below.
*/
const string escapedDoubleQuote = "\\" + "\"";
var shellCommand = escapedDoubleQuote + GetThisExeFile().FullName + escapedDoubleQuote + " x " + escapedDoubleQuote + "%1" + escapedDoubleQuote + " " + escapedDoubleQuote + "%1_extracted" + escapedDoubleQuote;

var shellCommand = escapedDoubleQuote + GetLessMsiExeFile() + escapedDoubleQuote + " x " + escapedDoubleQuote + "%1" + escapedDoubleQuote;
Debug.WriteLine("ShellCommand:[" + shellCommand + "]");
AddRemoveShortcut(isAdding, "extract", "Msi.Package", "&Extract Files", shellCommand);
AddRemoveShortcut(isAdding, "extract", "Msi.Package", "Lessmsi &Extract Files", shellCommand);

/* Fix for https://code.google.com/p/lessmsi/issues/detail?id=6&sort=-id
*/
shellCommand = escapedDoubleQuote + GetThisExeFile().FullName + escapedDoubleQuote + " o " + escapedDoubleQuote + "%1" + escapedDoubleQuote;
shellCommand = escapedDoubleQuote + GetLessMsiExeFile() + escapedDoubleQuote + " o " + escapedDoubleQuote + "%1" + escapedDoubleQuote;
Debug.WriteLine("ShellCommand:[" + shellCommand + "]");
AddRemoveShortcut(isAdding, "explore", "Msi.Package", "&Explore", shellCommand);

AddRemoveShortcut(isAdding, "explore", "Msi.Package", "&Lessmsi Explore", shellCommand);
}

void AddRemoveShortcut(bool isAdding, string commandName, string fileClass, string caption, string shellCommand)
{
var thisExe = GetThisExeFile();
string shortcutHelperExe = Path.Combine(thisExe.Directory.FullName, "AddWindowsExplorerShortcut.exe");
if (!File.Exists(shortcutHelperExe))
{
MessageBox.Show(this,
"File '" + Path.GetFileNameWithoutExtension(shortcutHelperExe) +
"' should be in the same directory as lessmsi-gui.exe.", "Missing File", MessageBoxButtons.OK,
MessageBoxIcon.Error);
"File '" + Path.GetFileNameWithoutExtension(shortcutHelperExe) +
"' should be in the same directory as lessmsi-gui.exe.", "Missing File", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}

var newProcess = new Process();
var info = new ProcessStartInfo("");
info.FileName = shortcutHelperExe;
info.UseShellExecute = true;
info.ErrorDialog = true;
info.ErrorDialogParentHandle = this.Handle;
//AddWindowsExplorerShortcut add|remove commandName fileClass [caption shellCommand]

var args = new StringBuilder();
if (isAdding)
args.Append("add");
Expand All @@ -99,15 +98,19 @@ void AddRemoveShortcut(bool isAdding, string commandName, string fileClass, stri
args.Append(' ').Append(fileClass);
if (isAdding)
{
args.Append(" \"").Append(caption).Append("\"");
args.Append(" \"").Append(caption).Append("\"");
args.Append(' ').Append('\"').Append(shellCommand).Append('\"');
}

info.Arguments = args.ToString();
newProcess.StartInfo = info;
newProcess.Start();
}

static string GetLessMsiExeFile()
{
return Path.Combine(GetThisExeFile().Directory.FullName, "lessmsi.exe");
}

static FileInfo GetThisExeFile()
{
return new FileInfo(typeof(PreferencesForm).Module.FullyQualifiedName);
Expand Down
2 changes: 1 addition & 1 deletion src/LessMsi.Gui/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/LessMsi.Gui/app.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v4.5"/>
</startup>
</configuration>
27 changes: 1 addition & 26 deletions src/LessMsi.sln
Expand Up @@ -41,71 +41,46 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Debug|Any CPU.ActiveCfg = Debug|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Debug|Mixed Platforms.Build.0 = Debug|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Debug|x86.ActiveCfg = Debug|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Debug|x86.Build.0 = Debug|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Release|Any CPU.ActiveCfg = Release|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Release|Mixed Platforms.ActiveCfg = Release|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Release|Mixed Platforms.Build.0 = Release|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Release|x86.ActiveCfg = Release|x86
{13F99803-59EF-4DEA-BE1C-68561A427B08}.Release|x86.Build.0 = Release|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Debug|Any CPU.ActiveCfg = Debug|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Debug|Mixed Platforms.Build.0 = Debug|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Debug|x86.ActiveCfg = Debug|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Debug|x86.Build.0 = Debug|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Release|Any CPU.ActiveCfg = Release|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Release|Mixed Platforms.ActiveCfg = Release|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Release|Mixed Platforms.Build.0 = Release|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Release|x86.ActiveCfg = Release|x86
{78591E05-341F-450F-B215-D23E959F49F1}.Release|x86.Build.0 = Release|x86
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|x86.ActiveCfg = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Debug|x86.Build.0 = Debug|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Release|Any CPU.Build.0 = Release|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{3903631A-A516-4A7C-B614-EF7DF4251E5F}.Release|x86.ActiveCfg = Release|Any CPU
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Debug|Any CPU.ActiveCfg = Debug|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Debug|Mixed Platforms.Build.0 = Debug|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Debug|x86.ActiveCfg = Debug|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Debug|x86.Build.0 = Debug|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Release|Any CPU.ActiveCfg = Release|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Release|Mixed Platforms.ActiveCfg = Release|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Release|Mixed Platforms.Build.0 = Release|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Release|x86.ActiveCfg = Release|x86
{1FD916F2-1DF6-42F6-9AD4-83565FBF8E5C}.Release|x86.Build.0 = Release|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Debug|Any CPU.ActiveCfg = Debug|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Debug|Mixed Platforms.Build.0 = Debug|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Debug|x86.ActiveCfg = Debug|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Debug|x86.Build.0 = Debug|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Release|Any CPU.ActiveCfg = Release|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Release|Mixed Platforms.ActiveCfg = Release|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Release|Mixed Platforms.Build.0 = Release|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Release|x86.ActiveCfg = Release|x86
{3D9AB5F1-2773-4403-8E50-771721572508}.Release|x86.Build.0 = Release|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Debug|Any CPU.ActiveCfg = Debug|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Debug|Mixed Platforms.Build.0 = Debug|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Debug|x86.ActiveCfg = Debug|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Debug|x86.Build.0 = Debug|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Release|Any CPU.ActiveCfg = Release|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Release|Mixed Platforms.ActiveCfg = Release|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Release|Mixed Platforms.Build.0 = Release|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Release|x86.ActiveCfg = Release|x86
{7ED32F80-2B7B-4F90-ADE9-22B8F3935C63}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
5 changes: 3 additions & 2 deletions src/Lessmsi.Tests/LessMsi.Tests.csproj
Expand Up @@ -10,9 +10,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LessMsi.Tests</RootNamespace>
<AssemblyName>LessMsi.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
Expand Down

0 comments on commit 2a6b3a4

Please sign in to comment.