Skip to content

Commit

Permalink
Fix installer, add environment variable to installer
Browse files Browse the repository at this point in the history
  • Loading branch information
eksime committed Oct 4, 2017
1 parent 4faf3a1 commit 8a0dcc6
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 20 deletions.
14 changes: 10 additions & 4 deletions VDesk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ Global
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x64.ActiveCfg = Debug|x64
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x64.Build.0 = Debug|x64
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x86.ActiveCfg = Debug|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x86.Build.0 = Debug|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x86.ActiveCfg = Debug|x86
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Debug|x86.Build.0 = Debug|x86
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|Any CPU.Build.0 = Release|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x64.ActiveCfg = Release|x64
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x64.Build.0 = Release|x64
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x86.ActiveCfg = Release|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x86.Build.0 = Release|Any CPU
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x86.ActiveCfg = Release|x86
{7B6874C1-48E1-4C04-8132-888495CA8EF5}.Release|x86.Build.0 = Release|x86
{AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -47,11 +47,17 @@ Global
{AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x86.ActiveCfg = Release|x86
{AB848ECD-76AA-41C0-B63D-86A8591B25AA}.Release|x86.Build.0 = Release|x86
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|Any CPU.ActiveCfg = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|Any CPU.Build.0 = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|x64.ActiveCfg = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|x64.Build.0 = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|x86.ActiveCfg = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Debug|x86.Build.0 = Debug
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|Any CPU.ActiveCfg = Release
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|Any CPU.Build.0 = Release
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|x64.ActiveCfg = Release
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|x64.Build.0 = Release
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|x86.ActiveCfg = Release
{02FEF30B-30D5-46DA-8C41-0FA75D6067FF}.Release|x86.Build.0 = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
31 changes: 31 additions & 0 deletions VDesk/Installer.Designer.cs

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

57 changes: 57 additions & 0 deletions VDesk/Installer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;

namespace VDesk {
[RunInstaller(true)]
public partial class Installer : System.Configuration.Install.Installer {
public Installer() {
InitializeComponent();
}

public override void Install(IDictionary stateSaver) {
base.Install(stateSaver);

string targetDir = Context.Parameters["TARGETDIR"];
PathAdd(targetDir);
}

public override void Rollback(IDictionary savedState) {
base.Rollback(savedState);

string targetDir = Context.Parameters["TARGETDIR"];
PathRemove(targetDir);
}

public override void Uninstall(IDictionary savedState) {
base.Uninstall(savedState);

string targetDir = Context.Parameters["TARGETDIR"];
PathRemove(targetDir);
}


public void PathAdd(string directory) {
directory = directory.TrimEnd('\\');

List<string> path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine).Split(';').ToList();
path.Add(directory);

string pathStr = string.Join(";", path);
Environment.SetEnvironmentVariable("PATH", pathStr, EnvironmentVariableTarget.Machine);
}

public void PathRemove(string directory) {
directory = directory.TrimEnd('\\');

List<string> path = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine).Split(';').ToList();
path.Remove(directory);

string pathStr = string.Join(";", path);
Environment.SetEnvironmentVariable("PATH", pathStr, EnvironmentVariableTarget.Machine);
}
}
}
32 changes: 30 additions & 2 deletions VDesk/VDesk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<Install>false</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
Expand All @@ -29,7 +29,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationVersion>1.1.1.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down Expand Up @@ -82,11 +82,33 @@
<PropertyGroup>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Management" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
Expand All @@ -107,6 +129,12 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Installer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Installer.Designer.cs">
<DependentUpon>Installer.cs</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
Expand Down
102 changes: 88 additions & 14 deletions VDeskSetup/VDeskSetup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
"Entry"
{
"MsmKey" = "8:_9B923EA6E16199D6DCDB14FA72F430DC"
"MsmKey" = "8:_768545217EA6AFF13BA9D7384B845F3A"
"OwnerKey" = "8:_61C63DC29EE443F0B101A77A6EF3DC8F"
"MsmSig" = "8:_UNDEFINED"
}
Expand All @@ -34,7 +34,7 @@
"Entry"
{
"MsmKey" = "8:_UNDEFINED"
"OwnerKey" = "8:_9B923EA6E16199D6DCDB14FA72F430DC"
"OwnerKey" = "8:_768545217EA6AFF13BA9D7384B845F3A"
"MsmSig" = "8:_UNDEFINED"
}
}
Expand All @@ -55,6 +55,22 @@
"PrivateKeyFile" = "8:"
"TimeStampServer" = "8:"
"InstallerBootstrapper" = "3:2"
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
{
"Enabled" = "11:TRUE"
"PromptEnabled" = "11:TRUE"
"PrerequisitesLocation" = "2:1"
"Url" = "8:"
"ComponentsUrl" = "8:"
"Items"
{
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.6.1"
{
"Name" = "8:Microsoft .NET Framework 4.6.1 (x86 and x64)"
"ProductCode" = "8:.NETFramework,Version=v4.6.1"
}
}
}
}
"Release"
{
Expand All @@ -71,12 +87,70 @@
"PrivateKeyFile" = "8:"
"TimeStampServer" = "8:"
"InstallerBootstrapper" = "3:2"
"BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
{
"Enabled" = "11:TRUE"
"PromptEnabled" = "11:TRUE"
"PrerequisitesLocation" = "2:1"
"Url" = "8:"
"ComponentsUrl" = "8:"
"Items"
{
"{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:.NETFramework,Version=v4.6.1"
{
"Name" = "8:Microsoft .NET Framework 4.6.1 (x86 and x64)"
"ProductCode" = "8:.NETFramework,Version=v4.6.1"
}
}
}
}
}
"Deployable"
{
"CustomAction"
{
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_81B3185E3FD240CD85905A102FB2C523"
{
"Name" = "8:Primary output from VDesk (Active)"
"Condition" = "8:"
"Object" = "8:_61C63DC29EE443F0B101A77A6EF3DC8F"
"FileType" = "3:2"
"InstallAction" = "3:4"
"Arguments" = "8:"
"EntryPoint" = "8:"
"Sequence" = "3:1"
"Identifier" = "8:_747052EF_B938_494D_98AC_7AB779D35008"
"InstallerClass" = "11:TRUE"
"CustomActionData" = "8:/TARGETDIR=\"[TARGETDIR]\\\""
}
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_C05ADEF0F51B4F678508BD9F9AD3899B"
{
"Name" = "8:Primary output from VDesk (Active)"
"Condition" = "8:"
"Object" = "8:_61C63DC29EE443F0B101A77A6EF3DC8F"
"FileType" = "3:2"
"InstallAction" = "3:1"
"Arguments" = "8:"
"EntryPoint" = "8:"
"Sequence" = "3:1"
"Identifier" = "8:_397AFEFE_83AA_4BC7_A587_2056A3C86296"
"InstallerClass" = "11:TRUE"
"CustomActionData" = "8:/TARGETDIR=\"[TARGETDIR]\\\""
}
"{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_EB5D920660D949E0A8458CA666AD54F4"
{
"Name" = "8:Primary output from VDesk (Active)"
"Condition" = "8:"
"Object" = "8:_61C63DC29EE443F0B101A77A6EF3DC8F"
"FileType" = "3:2"
"InstallAction" = "3:3"
"Arguments" = "8:"
"EntryPoint" = "8:"
"Sequence" = "3:1"
"Identifier" = "8:_85D7B9AD_F0F8_4668_9E07_BB1CD7CE3B5C"
"InstallerClass" = "11:TRUE"
"CustomActionData" = "8:/TARGETDIR=\"[TARGETDIR]\\\""
}
}
"DefaultFeature"
{
Expand All @@ -100,14 +174,14 @@
}
"File"
{
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_9B923EA6E16199D6DCDB14FA72F430DC"
"{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_768545217EA6AFF13BA9D7384B845F3A"
{
"AssemblyRegister" = "3:1"
"AssemblyIsInGAC" = "11:FALSE"
"AssemblyAsmDisplayName" = "8:VirtualDesktop, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"
"AssemblyAsmDisplayName" = "8:VirtualDesktop, Version=2.0.0.0, Culture=neutral, processorArchitecture=x86"
"ScatterAssemblies"
{
"_9B923EA6E16199D6DCDB14FA72F430DC"
"_768545217EA6AFF13BA9D7384B845F3A"
{
"Name" = "8:VirtualDesktop.dll"
"Attributes" = "3:512"
Expand Down Expand Up @@ -165,19 +239,19 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:VDesk"
"ProductCode" = "8:{6D219652-D869-4DFA-859D-17B5DEB120BC}"
"PackageCode" = "8:{CEBDC285-67C1-4707-8D56-A7EEC28CA9D7}"
"ProductCode" = "8:{CF6178F9-74BB-4219-A51A-792704443594}"
"PackageCode" = "8:{403C6ABC-F2EE-44B8-8B22-E18FC554AABE}"
"UpgradeCode" = "8:{4D9EBDC4-C680-4253-B050-E1D4CC2AF3B7}"
"AspNetVersion" = "8:4.0.30319.0"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.0.0"
"InstallAllUsers" = "11:TRUE"
"ProductVersion" = "8:1.1.1"
"Manufacturer" = "8:Elliot Sime"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
"Title" = "8:VDeskSetup"
"ARPHELPLINK" = "8:https://github.com/eksime/VDesk/issues"
"Title" = "8:VDesk Setup"
"Subject" = "8:"
"ARPCONTACT" = "8:Elliot Sime"
"Keywords" = "8:"
Expand Down Expand Up @@ -373,7 +447,7 @@
"ContextData" = "8:1;True=1;False=0"
"Attributes" = "3:0"
"Setting" = "3:0"
"Value" = "3:1"
"Value" = "3:0"
"DefaultValue" = "3:1"
"UsePlugInResources" = "11:TRUE"
}
Expand Down Expand Up @@ -687,7 +761,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_61C63DC29EE443F0B101A77A6EF3DC8F"
{
"SourcePath" = "8:..\\VDesk\\obj\\Debug\\VDesk.exe"
"SourcePath" = "8:..\\VDesk\\obj\\x86\\Debug\\VDesk.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_AE4638A6FCFE46DB9463F41B12A1B971"
Expand Down

0 comments on commit 8a0dcc6

Please sign in to comment.