From e786dafb7f2f46607b3fc87997aeff3a739b1065 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 17:30:36 -0700 Subject: [PATCH 1/9] Created Winforms app --- App.config | 6 ++ Form1.Designer.cs | 39 +++++++++++ Form1.cs | 20 ++++++ Program.cs | 22 ++++++ Properties/AssemblyInfo.cs | 36 ++++++++++ Properties/Resources.Designer.cs | 71 +++++++++++++++++++ Properties/Resources.resx | 117 +++++++++++++++++++++++++++++++ Properties/Settings.Designer.cs | 30 ++++++++ Properties/Settings.settings | 7 ++ Windows-Add-To-Start.csproj | 87 +++++++++++++++++++++++ Windows-Add-To-Start.sln | 22 ++++++ 11 files changed, 457 insertions(+) create mode 100644 App.config create mode 100644 Form1.Designer.cs create mode 100644 Form1.cs create mode 100644 Program.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 Windows-Add-To-Start.csproj create mode 100644 Windows-Add-To-Start.sln diff --git a/App.config b/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Form1.Designer.cs b/Form1.Designer.cs new file mode 100644 index 0000000..948f62e --- /dev/null +++ b/Form1.Designer.cs @@ -0,0 +1,39 @@ +namespace Windows_Add_To_Start +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Text = "Form1"; + } + + #endregion + } +} + diff --git a/Form1.cs b/Form1.cs new file mode 100644 index 0000000..e0c42c2 --- /dev/null +++ b/Form1.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Windows_Add_To_Start +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..f3271a9 --- /dev/null +++ b/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Windows_Add_To_Start +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..faac423 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Windows-Add-To-Start")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Windows-Add-To-Start")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("0868d3ef-a3f7-4340-a618-23cf4378bca7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..febdad5 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Windows_Add_To_Start.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Windows_Add_To_Start.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3bc4181 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Windows_Add_To_Start.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Windows-Add-To-Start.csproj b/Windows-Add-To-Start.csproj new file mode 100644 index 0000000..1a34e36 --- /dev/null +++ b/Windows-Add-To-Start.csproj @@ -0,0 +1,87 @@ + + + + + Debug + AnyCPU + {0868D3EF-A3F7-4340-A618-23CF4378BCA7} + WinExe + Properties + Windows_Add_To_Start + Windows-Add-To-Start + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff --git a/Windows-Add-To-Start.sln b/Windows-Add-To-Start.sln new file mode 100644 index 0000000..3dd772a --- /dev/null +++ b/Windows-Add-To-Start.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windows-Add-To-Start", "Windows-Add-To-Start.csproj", "{0868D3EF-A3F7-4340-A618-23CF4378BCA7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From eab70ef40e380059a0339a3a96b180e74ad5a827 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 18:48:47 -0700 Subject: [PATCH 2/9] Adding Installer --- Windows-Add-To-Start.sln | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Windows-Add-To-Start.sln b/Windows-Add-To-Start.sln index 3dd772a..af319e4 100644 --- a/Windows-Add-To-Start.sln +++ b/Windows-Add-To-Start.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windows-Add-To-Start", "Windows-Add-To-Start.csproj", "{0868D3EF-A3F7-4340-A618-23CF4378BCA7}" EndProject +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Installer", "..\Installer\Installer.vdproj", "{9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,8 @@ Global {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.Build.0 = Release|Any CPU + {9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}.Debug|Any CPU.ActiveCfg = Debug + {9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}.Release|Any CPU.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 213d11c28e4008d9de92cf264969dbe8a517cac5 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 18:55:33 -0700 Subject: [PATCH 3/9] Installer config. --- Installer/Installer.vdproj | 740 +++++++++++++++++++++++++++++++++++++ Windows-Add-To-Start.sln | 6 +- 2 files changed, 743 insertions(+), 3 deletions(-) create mode 100644 Installer/Installer.vdproj diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj new file mode 100644 index 0000000..f190da5 --- /dev/null +++ b/Installer/Installer.vdproj @@ -0,0 +1,740 @@ +"DeployProject" +{ +"VSVersion" = "3:800" +"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}" +"IsWebType" = "8:FALSE" +"ProjectName" = "8:Installer" +"LanguageId" = "3:1033" +"CodePage" = "3:1252" +"UILanguageId" = "3:1033" +"SccProjectName" = "8:" +"SccLocalPath" = "8:" +"SccAuxPath" = "8:" +"SccProvider" = "8:" + "Hierarchy" + { + "Entry" + { + "MsmKey" = "8:_304FD04105324F89A71841DCA21938FD" + "OwnerKey" = "8:_UNDEFINED" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_6BA249B0C068A588DEA08E88E42CA032" + "OwnerKey" = "8:_304FD04105324F89A71841DCA21938FD" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_6BA249B0C068A588DEA08E88E42CA032" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_UNDEFINED" + "OwnerKey" = "8:_304FD04105324F89A71841DCA21938FD" + "MsmSig" = "8:_UNDEFINED" + } + } + "Configurations" + { + "Debug" + { + "DisplayName" = "8:Debug" + "IsDebugOnly" = "11:TRUE" + "IsReleaseOnly" = "11:FALSE" + "OutputFilename" = "8:Debug\\Installer.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + } + "Release" + { + "DisplayName" = "8:Release" + "IsDebugOnly" = "11:FALSE" + "IsReleaseOnly" = "11:TRUE" + "OutputFilename" = "8:Release\\Installer.msi" + "PackageFilesAs" = "3:2" + "PackageFileSize" = "3:-2147483648" + "CabType" = "3:1" + "Compression" = "3:2" + "SignOutput" = "11:FALSE" + "CertificateFile" = "8:" + "PrivateKeyFile" = "8:" + "TimeStampServer" = "8:" + "InstallerBootstrapper" = "3:2" + } + } + "Deployable" + { + "CustomAction" + { + } + "DefaultFeature" + { + "Name" = "8:DefaultFeature" + "Title" = "8:" + "Description" = "8:" + } + "ExternalPersistence" + { + "LaunchCondition" + { + "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_4DC61CB6C8504BCCB8BCAB24F245EC33" + { + "Name" = "8:.NET Framework" + "Message" = "8:[VSDNETMSG]" + "FrameworkVersion" = "8:.NETFramework,Version=v4.5" + "AllowLaterVersions" = "11:FALSE" + "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=395269" + } + } + } + "File" + { + "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_6BA249B0C068A588DEA08E88E42CA032" + { + "AssemblyRegister" = "3:1" + "AssemblyIsInGAC" = "11:FALSE" + "AssemblyAsmDisplayName" = "8:System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" + "ScatterAssemblies" + { + "_6BA249B0C068A588DEA08E88E42CA032" + { + "Name" = "8:System.Net.Http.dll" + "Attributes" = "3:512" + } + } + "SourcePath" = "8:System.Net.Http.dll" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_1B551DEF29D44DBD8894B3EBFEC1BCD5" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + } + "FileType" + { + } + "Folder" + { + "{3C67513D-01DD-4637-8A68-80971EB9504F}:_1B551DEF29D44DBD8894B3EBFEC1BCD5" + { + "DefaultLocation" = "8:[ProgramFilesFolder][Manufacturer]\\[ProductName]" + "Name" = "8:#1925" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:TARGETDIR" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_73E0AEDF6C3241D98733BFBF7C9118D8" + { + "Name" = "8:#1916" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:DesktopFolder" + "Folders" + { + } + } + "{1525181F-901A-416C-8A58-119130FE478E}:_E94CBE4759E84BBDA9C70C625B7852BF" + { + "Name" = "8:#1919" + "AlwaysCreate" = "11:FALSE" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Property" = "8:ProgramMenuFolder" + "Folders" + { + } + } + } + "LaunchCondition" + { + } + "Locator" + { + } + "MsiBootstrapper" + { + "LangId" = "3:1033" + "RequiresElevation" = "11:FALSE" + } + "Product" + { + "Name" = "8:Microsoft Visual Studio" + "ProductName" = "8:Installer" + "ProductCode" = "8:{B1AD9AF9-329B-4F86-AB7B-1F77F4A9EF32}" + "PackageCode" = "8:{BB7944BB-586B-431A-A575-01F3B7741D7E}" + "UpgradeCode" = "8:{6C2CD18A-9717-40F1-95D3-9DD378E9B947}" + "AspNetVersion" = "8:4.0.30319.0" + "RestartWWWService" = "11:FALSE" + "RemovePreviousVersions" = "11:FALSE" + "DetectNewerInstalledVersion" = "11:TRUE" + "InstallAllUsers" = "11:FALSE" + "ProductVersion" = "8:1.0.0" + "Manufacturer" = "8:Default Company Name" + "ARPHELPTELEPHONE" = "8:" + "ARPHELPLINK" = "8:" + "Title" = "8:Installer" + "Subject" = "8:" + "ARPCONTACT" = "8:Ashwin Sinha" + "Keywords" = "8:" + "ARPCOMMENTS" = "8:Add programs or shortcuts to the start menu using right-clicks in Windows Explorer." + "ARPURLINFOABOUT" = "8:" + "ARPPRODUCTICON" = "8:" + "ARPIconIndex" = "3:0" + "SearchPath" = "8:" + "UseSystemSearchPath" = "11:TRUE" + "TargetPlatform" = "3:0" + "PreBuildEvent" = "8:" + "PostBuildEvent" = "8:" + "RunPostBuildEvent" = "3:0" + } + "Registry" + { + "HKLM" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_FA75165DB16D415B980F5FD4B19A4456" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_A1671F0BAAC343CB9D2E9DD8C120D1D3" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCU" + { + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_4CEAD751F81B4028B72851652C6F6C9D" + { + "Name" = "8:Software" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_9BA7B87811524E638E5D8560337A73DC" + { + "Name" = "8:[Manufacturer]" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + } + } + } + "Values" + { + } + } + } + } + "HKCR" + { + "Keys" + { + } + } + "HKU" + { + "Keys" + { + } + } + "HKPU" + { + "Keys" + { + } + } + } + "Sequences" + { + } + "Shortcut" + { + } + "UserInterface" + { + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_067F44A9B6A44097924862CA5EA8D5AB" + { + "Name" = "8:#1900" + "Sequence" = "3:1" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_3E02306026B9472F9924B9E0703F51CB" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_B8182A86777348E99EB367FF018F5FBB" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "InstallAllUsersVisible" + { + "Name" = "8:InstallAllUsersVisible" + "DisplayName" = "8:#1059" + "Description" = "8:#1159" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_D1DE0B36DC654035AFAA341F8B92CB4E" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_2B630C7BF3C649E7A2E6563301FF5FFB" + { + "Name" = "8:#1901" + "Sequence" = "3:2" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_6F80B4C3E37D4FC19DC859497560D706" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_481B12C38B664F06A0D1F6B638832ABB" + { + "Name" = "8:#1902" + "Sequence" = "3:2" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_A0B5F9D1E6314FDC8A4B489546DFBA3D" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_5F5C09C9EEC241E39CDFE89AF204D203" + { + "Name" = "8:#1902" + "Sequence" = "3:1" + "Attributes" = "3:3" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_94F7CC8DE7FA42F4BED0F58C02B5978B" + { + "Sequence" = "3:100" + "DisplayName" = "8:Finished" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdFinishedDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "UpdateText" + { + "Name" = "8:UpdateText" + "DisplayName" = "8:#1058" + "Description" = "8:#1158" + "Type" = "3:15" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1258" + "DefaultValue" = "8:#1258" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_959D2D7386864328BFAD59FCED721D3B" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdBasicDialogs.wim" + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_B454FB233F584AD3B1A665705CF3DF57" + { + "Name" = "8:#1901" + "Sequence" = "3:1" + "Attributes" = "3:2" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_BCBCB3746D6A40ECAF1C74D2200557C1" + { + "Sequence" = "3:100" + "DisplayName" = "8:Progress" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdProgressDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "ShowProgress" + { + "Name" = "8:ShowProgress" + "DisplayName" = "8:#1009" + "Description" = "8:#1109" + "Type" = "3:5" + "ContextData" = "8:1;True=1;False=0" + "Attributes" = "3:0" + "Setting" = "3:0" + "Value" = "3:1" + "DefaultValue" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_BEE5C85BB89743BAB78B332FC06651BF" + { + "Name" = "8:#1900" + "Sequence" = "3:2" + "Attributes" = "3:1" + "Dialogs" + { + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_306E81BDFD8048F7A7B5922B71AFAF7F" + { + "Sequence" = "3:300" + "DisplayName" = "8:Confirm Installation" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminConfirmDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_3DEA999BD06A42F6B6D68B79208672D9" + { + "Sequence" = "3:200" + "DisplayName" = "8:Installation Folder" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminFolderDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + } + } + "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_9762019F4893415D830B7804BD26BE60" + { + "Sequence" = "3:100" + "DisplayName" = "8:Welcome" + "UseDynamicProperties" = "11:TRUE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdAdminWelcomeDlg.wid" + "Properties" + { + "BannerBitmap" + { + "Name" = "8:BannerBitmap" + "DisplayName" = "8:#1001" + "Description" = "8:#1101" + "Type" = "3:8" + "ContextData" = "8:Bitmap" + "Attributes" = "3:4" + "Setting" = "3:1" + "UsePlugInResources" = "11:TRUE" + } + "CopyrightWarning" + { + "Name" = "8:CopyrightWarning" + "DisplayName" = "8:#1002" + "Description" = "8:#1102" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1202" + "DefaultValue" = "8:#1202" + "UsePlugInResources" = "11:TRUE" + } + "Welcome" + { + "Name" = "8:Welcome" + "DisplayName" = "8:#1003" + "Description" = "8:#1103" + "Type" = "3:3" + "ContextData" = "8:" + "Attributes" = "3:0" + "Setting" = "3:1" + "Value" = "8:#1203" + "DefaultValue" = "8:#1203" + "UsePlugInResources" = "11:TRUE" + } + } + } + } + } + "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_F1F81625E0C04662B073E05AFCA94182" + { + "UseDynamicProperties" = "11:FALSE" + "IsDependency" = "11:FALSE" + "SourcePath" = "8:\\VsdUserInterface.wim" + } + } + "MergeModule" + { + } + "ProjectOutput" + { + "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_304FD04105324F89A71841DCA21938FD" + { + "SourcePath" = "8:..\\obj\\Debug\\Windows-Add-To-Start.exe" + "TargetName" = "8:" + "Tag" = "8:" + "Folder" = "8:_1B551DEF29D44DBD8894B3EBFEC1BCD5" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:FALSE" + "IsolateTo" = "8:" + "ProjectOutputGroupRegister" = "3:1" + "OutputConfiguration" = "8:" + "OutputGroupCanonicalName" = "8:Built" + "OutputProjectGuid" = "8:{0868D3EF-A3F7-4340-A618-23CF4378BCA7}" + "ShowKeyOutput" = "11:TRUE" + "ExcludeFilters" + { + } + } + } + } +} diff --git a/Windows-Add-To-Start.sln b/Windows-Add-To-Start.sln index af319e4..a58d025 100644 --- a/Windows-Add-To-Start.sln +++ b/Windows-Add-To-Start.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Windows-Add-To-Start", "Windows-Add-To-Start.csproj", "{0868D3EF-A3F7-4340-A618-23CF4378BCA7}" EndProject -Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Installer", "..\Installer\Installer.vdproj", "{9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}" +Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Installer", "Installer\Installer.vdproj", "{94372225-8F00-4687-8C70-7AE3EFBCF4CB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -17,8 +17,8 @@ Global {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0868D3EF-A3F7-4340-A618-23CF4378BCA7}.Release|Any CPU.Build.0 = Release|Any CPU - {9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}.Debug|Any CPU.ActiveCfg = Debug - {9B9ED963-7F94-4FD6-BEB7-C68CAEE8F7BD}.Release|Any CPU.ActiveCfg = Release + {94372225-8F00-4687-8C70-7AE3EFBCF4CB}.Debug|Any CPU.ActiveCfg = Debug + {94372225-8F00-4687-8C70-7AE3EFBCF4CB}.Release|Any CPU.ActiveCfg = Release EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 8a5d78d658ff68e598e98728dfff0419cc42f778 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 18:57:57 -0700 Subject: [PATCH 4/9] added registry action --- Installer/Installer.vdproj | 64 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj index f190da5..7037860 100644 --- a/Installer/Installer.vdproj +++ b/Installer/Installer.vdproj @@ -288,6 +288,70 @@ { "Keys" { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_1685838729DB48CBAECB44E22DECE02C" + { + "Name" = "8:*" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_6D4E0CBBD7B943138CCCEB5C05E47C99" + { + "Name" = "8:shell" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_9775E4A5B2F4410A8943E2088EF462D1" + { + "Name" = "8:Add to Start Menu" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_FDD2517551BC4760A6725383829C58AE" + { + "Name" = "8:command" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_2CE47517B5F74DD79E4A6FB1833083A0" + { + "Name" = "8:Add to Start Menu" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } } } "HKU" From ade48782c5a53924dc016beb48718a372ac2f824 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 20:30:44 -0700 Subject: [PATCH 5/9] Getting context input --- Form1.cs | 14 ++++++++++++++ Installer/Installer.vdproj | 20 ++++++++++---------- Program.cs | 7 ++++--- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Form1.cs b/Form1.cs index e0c42c2..3ae425a 100644 --- a/Form1.cs +++ b/Form1.cs @@ -12,9 +12,23 @@ namespace Windows_Add_To_Start { public partial class Form1 : Form { + /// + /// Setting default form visibility to hidden on load. + /// Form is only set to be visible when user input is required. + /// + /// + protected override void OnLoad(EventArgs e) + { + Visible = false; + ShowInTaskbar = false; + base.OnLoad(e); + } + public Form1() { InitializeComponent(); + string[] args = Environment.GetCommandLineArgs(); + MessageBox.Show(args[1]); } } } diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj index 7037860..534c639 100644 --- a/Installer/Installer.vdproj +++ b/Installer/Installer.vdproj @@ -186,17 +186,17 @@ "Product" { "Name" = "8:Microsoft Visual Studio" - "ProductName" = "8:Installer" - "ProductCode" = "8:{B1AD9AF9-329B-4F86-AB7B-1F77F4A9EF32}" - "PackageCode" = "8:{BB7944BB-586B-431A-A575-01F3B7741D7E}" + "ProductName" = "8:Add to Start Menu" + "ProductCode" = "8:{329FA9E6-1673-4A4B-8B0A-64DDDE5F559B}" + "PackageCode" = "8:{7E900E5A-7E60-4948-B35E-9DED51464085}" "UpgradeCode" = "8:{6C2CD18A-9717-40F1-95D3-9DD378E9B947}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:FALSE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.0.0" - "Manufacturer" = "8:Default Company Name" + "ProductVersion" = "8:0.0.1" + "Manufacturer" = "8:Ashwinning" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" "Title" = "8:Installer" @@ -320,7 +320,7 @@ "Name" = "8:command" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" "Transitive" = "11:FALSE" "Keys" { @@ -329,11 +329,11 @@ { "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_2CE47517B5F74DD79E4A6FB1833083A0" { - "Name" = "8:Add to Start Menu" + "Name" = "8:" "Condition" = "8:" "Transitive" = "11:FALSE" "ValueTypes" = "3:1" - "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe" + "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe %1" } } } @@ -410,8 +410,8 @@ "Type" = "3:3" "ContextData" = "8:" "Attributes" = "3:0" - "Setting" = "3:1" - "Value" = "8:#1202" + "Setting" = "3:2" + "Value" = "8:" "DefaultValue" = "8:#1202" "UsePlugInResources" = "11:TRUE" } diff --git a/Program.cs b/Program.cs index f3271a9..7831a86 100644 --- a/Program.cs +++ b/Program.cs @@ -12,11 +12,12 @@ static class Program /// The main entry point for the application. /// [STAThread] - static void Main() + static void Main(string[] args) { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); + //Application.EnableVisualStyles(); + //Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); + //Application.Run(); } } } From 881108740fa7638deeabf874a214220df8ec9d13 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 21:16:41 -0700 Subject: [PATCH 6/9] Can write to ProgramData as admin now. updated app manifest to require admin permission. --- Form1.cs | 54 +++++++++++++++++++++++++- Windows-Add-To-Start.csproj | 15 ++++++++ app.manifest | 76 +++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 app.manifest diff --git a/Form1.cs b/Form1.cs index 3ae425a..211e1b9 100644 --- a/Form1.cs +++ b/Form1.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -8,6 +9,8 @@ using System.Threading.Tasks; using System.Windows.Forms; +using IWshRuntimeLibrary; //For creating shortcuts (Add References > COM > Windows Script Host Object) + namespace Windows_Add_To_Start { public partial class Form1 : Form @@ -28,7 +31,56 @@ public Form1() { InitializeComponent(); string[] args = Environment.GetCommandLineArgs(); - MessageBox.Show(args[1]); + //MessageBox.Show(args[1]); + CopyToStartMenu(args[1]); + //close the form + Close(); + } + + void CopyToStartMenu(string path) + { + //Get win root + string windowsDrive = Path.GetPathRoot(Environment.SystemDirectory); + //path to start menu + string startMenuPath = "ProgramData\\Microsoft\\Windows\\Start Menu\\Programs"; + //Get filename from path + string fileName = Path.GetFileNameWithoutExtension(path); + //Get extension + string extension = Path.GetExtension(path); + + //If the path is not a shortcut + if (extension != ".lnk" || extension != ".url") + { + CreateShortcut(fileName, windowsDrive + startMenuPath, path); + } + else + { + + } + //return; } + + public static void CreateShortcut(string shortcutName, string shortcutPath, string targetFileLocation) + { + string shortcutLocation = System.IO.Path.Combine(shortcutPath, shortcutName + ".lnk"); + MessageBox.Show(shortcutLocation); + WshShell shell = new WshShell(); + IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation); + shortcut.WorkingDirectory = Application.StartupPath; //? + //shortcut.IconLocation = @"c:\myicon.ico"; // The icon of the shortcut + shortcut.TargetPath = targetFileLocation; // The path of the file that will launch when the shortcut is run + + try + { + shortcut.Save(); + MessageBox.Show("created"); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } + + } + } } diff --git a/Windows-Add-To-Start.csproj b/Windows-Add-To-Start.csproj index 1a34e36..3ee886e 100644 --- a/Windows-Add-To-Start.csproj +++ b/Windows-Add-To-Start.csproj @@ -32,6 +32,9 @@ prompt 4 + + app.manifest + @@ -63,6 +66,7 @@ True Resources.resx + SettingsSingleFileGenerator Settings.Designer.cs @@ -76,6 +80,17 @@ + + + {F935DC20-1CF0-11D0-ADB9-00C04FD58A0B} + 1 + 0 + 0 + tlbimp + False + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5d07b3efc509b9d30391b49e9d50c7dc8b47327a Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 22:04:46 -0700 Subject: [PATCH 7/9] Added \ and deleting reg entries on uninstall now. --- Form1.cs | 16 ++++--- Installer/Installer.vdproj | 94 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 101 insertions(+), 9 deletions(-) diff --git a/Form1.cs b/Form1.cs index 211e1b9..6e39ee6 100644 --- a/Form1.cs +++ b/Form1.cs @@ -49,13 +49,20 @@ void CopyToStartMenu(string path) string extension = Path.GetExtension(path); //If the path is not a shortcut - if (extension != ".lnk" || extension != ".url") + if (extension != ".lnk" && extension != ".url" && extension != ".appref-ms") { CreateShortcut(fileName, windowsDrive + startMenuPath, path); } - else + else //If the path is a shortcut { - + try + { + System.IO.File.Copy(path, windowsDrive + startMenuPath + Path.DirectorySeparatorChar + fileName + extension); + } + catch (Exception e) + { + MessageBox.Show(e.ToString()); + } } //return; } @@ -69,17 +76,14 @@ public static void CreateShortcut(string shortcutName, string shortcutPath, stri shortcut.WorkingDirectory = Application.StartupPath; //? //shortcut.IconLocation = @"c:\myicon.ico"; // The icon of the shortcut shortcut.TargetPath = targetFileLocation; // The path of the file that will launch when the shortcut is run - try { shortcut.Save(); - MessageBox.Show("created"); } catch (Exception e) { MessageBox.Show(e.ToString()); } - } } diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj index 534c639..5a42501 100644 --- a/Installer/Installer.vdproj +++ b/Installer/Installer.vdproj @@ -28,13 +28,13 @@ "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_6BA249B0C068A588DEA08E88E42CA032" + "OwnerKey" = "8:_304FD04105324F89A71841DCA21938FD" "MsmSig" = "8:_UNDEFINED" } "Entry" { "MsmKey" = "8:_UNDEFINED" - "OwnerKey" = "8:_304FD04105324F89A71841DCA21938FD" + "OwnerKey" = "8:_6BA249B0C068A588DEA08E88E42CA032" "MsmSig" = "8:_UNDEFINED" } } @@ -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.5" + { + "Name" = "8:Microsoft .NET Framework 4.5 (x86 and x64)" + "ProductCode" = "8:.NETFramework,Version=v4.5" + } + } + } } "Release" { @@ -71,6 +87,14 @@ "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:" + } } } "Deployable" @@ -188,7 +212,7 @@ "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Add to Start Menu" "ProductCode" = "8:{329FA9E6-1673-4A4B-8B0A-64DDDE5F559B}" - "PackageCode" = "8:{7E900E5A-7E60-4948-B35E-9DED51464085}" + "PackageCode" = "8:{B2F46451-0CAC-4E84-8ADC-23B28E3B94BD}" "UpgradeCode" = "8:{6C2CD18A-9717-40F1-95D3-9DD378E9B947}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" @@ -352,6 +376,70 @@ { } } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_2E046F77DB624BA388BFA3457EDF011E" + { + "Name" = "8:lnkfile" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_CE90AA37F04941498BC9A7D7CC95E8BC" + { + "Name" = "8:shell" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_686F86BCCF634AD98C5D228F0FFA875D" + { + "Name" = "8:Add to Start Menu" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_CD9A4BDDD6F542DBB2296297CE6751D6" + { + "Name" = "8:command" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_71A4C6A691604447A197B4351ED01A1C" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe %1" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } } } "HKU" From c1dc340b3508da6d71c49cb073dc0388b3555f21 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 22:07:11 -0700 Subject: [PATCH 8/9] Added comments. --- Form1.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Form1.cs b/Form1.cs index 6e39ee6..4e24da4 100644 --- a/Form1.cs +++ b/Form1.cs @@ -37,6 +37,12 @@ public Form1() Close(); } + /// + /// Takes the filepath. + /// Copies it to the start menu if the file is a shortcut. + /// Creates a shortcut in the start menu for all other file types. + /// + /// void CopyToStartMenu(string path) { //Get win root @@ -67,6 +73,12 @@ void CopyToStartMenu(string path) //return; } + /// + /// Creates a shortcut. + /// + /// + /// + /// public static void CreateShortcut(string shortcutName, string shortcutPath, string targetFileLocation) { string shortcutLocation = System.IO.Path.Combine(shortcutPath, shortcutName + ".lnk"); From 9de9bc16d932e9e6e9b2012c5de3d19f2a65d136 Mon Sep 17 00:00:00 2001 From: Ashwin Sinha Date: Mon, 30 May 2016 22:29:30 -0700 Subject: [PATCH 9/9] updated package codes -- because build. --- Installer/Installer.vdproj | 136 +++++++++++++++++++++++++++++++++++-- 1 file changed, 132 insertions(+), 4 deletions(-) diff --git a/Installer/Installer.vdproj b/Installer/Installer.vdproj index 5a42501..77bb34f 100644 --- a/Installer/Installer.vdproj +++ b/Installer/Installer.vdproj @@ -212,7 +212,7 @@ "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:Add to Start Menu" "ProductCode" = "8:{329FA9E6-1673-4A4B-8B0A-64DDDE5F559B}" - "PackageCode" = "8:{B2F46451-0CAC-4E84-8ADC-23B28E3B94BD}" + "PackageCode" = "8:{FA61B0E1-E929-41B7-BCDA-85B5E4F5E6DF}" "UpgradeCode" = "8:{6C2CD18A-9717-40F1-95D3-9DD378E9B947}" "AspNetVersion" = "8:4.0.30319.0" "RestartWWWService" = "11:FALSE" @@ -335,7 +335,7 @@ "Name" = "8:Add to Start Menu" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" "Transitive" = "11:FALSE" "Keys" { @@ -376,12 +376,140 @@ { } } - "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_2E046F77DB624BA388BFA3457EDF011E" + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_6C5D8004D5DF4F168D7CF7B5B8A03E11" { "Name" = "8:lnkfile" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_34D7113918D247D889E4DAD197A35731" + { + "Name" = "8:shell" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_BC232C9EA77945379FE6D2BD6C0DE18C" + { + "Name" = "8:Add to Start Menu" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_35E8A69E3C9145C28F0F1CF6B932FA4C" + { + "Name" = "8:command" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_DE8221FBA6B247BAA8EDF11C2A48EDA2" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe %1" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_AAA7BD8898974F799BCA8E157A917EE1" + { + "Name" = "8:.appref-ms" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_A014FCD751434569B69593AEFA5000F3" + { + "Name" = "8:shell" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_607F0CECA5104EB3B3F6BB978CEFD85B" + { + "Name" = "8:Add to Start Menu" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" + "Transitive" = "11:FALSE" + "Keys" + { + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_F5FA136D9757408B90263F890AB816FC" + { + "Name" = "8:command" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" + "Transitive" = "11:FALSE" + "Keys" + { + } + "Values" + { + "{ADCFDA98-8FDD-45E4-90BC-E3D20B029870}:_27B1E578990444479D25852380D8D1C9" + { + "Name" = "8:" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "ValueTypes" = "3:1" + "Value" = "8:[TARGETDIR]Windows-Add-To-Start.exe %1" + } + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + } + "Values" + { + } + } + "{60EA8692-D2D5-43EB-80DC-7906BF13D6EF}:_ACC071B455434A4CB577D7C3BCB54FDC" + { + "Name" = "8:.url" + "Condition" = "8:" + "AlwaysCreate" = "11:FALSE" + "DeleteAtUninstall" = "11:FALSE" "Transitive" = "11:FALSE" "Keys" { @@ -399,7 +527,7 @@ "Name" = "8:Add to Start Menu" "Condition" = "8:" "AlwaysCreate" = "11:FALSE" - "DeleteAtUninstall" = "11:FALSE" + "DeleteAtUninstall" = "11:TRUE" "Transitive" = "11:FALSE" "Keys" {