示例#1
0
        private void DebugInstall()
        {
            string defaultPath = string.Format(@"{0}\Microsoft\Windows\Start Menu\Programs\{1}.Debug.lnk",
                                               Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                               Constants.ApplicationName);

            if (File.Exists(defaultPath))
            {
                return;
            }

            string fullPath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            using (ShellLink shellLink = new ShellLink())
            {
                shellLink.Path           = fullPath;
                shellLink.Arguments      = "";
                shellLink.AppUserModelId = Constants.ApplicationId;
                shellLink.Commit();
                shellLink.SaveTo(defaultPath);
            }
        }