George George - 1 month ago 5x
C# Question

Online ClickOnce Deployment Application and place an icon on the desktop/start menu

I'm working on a online only winform application which I deploy using ClickOnce feature it uploads through FTP to the server and the user executes it online through http.

As you may already know, the Online only feature doesn't place any icons on the desktop, so everytime it runs the user got to run the setup.exe file to do it.

My question is, if there is anyway I could actually create an icon that may point to the setup file or any workaround to make sure the user got an accesible and easy way to run the app without having to look for the setup file everytime?

Users may not know a lot about computers so it can be a hard task to navigate all the way to the downloaded file everytime, and I want to make it easier for them.

I know that if I do an offline/online app it will solve the problem, but I would like it to be online only.

Any ideas?


you can create desktop shortcut manually on the first app run, and point it to either to your app's url, or path to downloaded file (I guess, url will be safer in case user deletes the file). Code can look something like this (need adjusting to your URL):

void CheckForShortcut()
    ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

    if (ad.IsFirstRun)
        Assembly code = Assembly.GetExecutingAssembly();

        string company = string.Empty;
        string description = string.Empty;

        if (Attribute.IsDefined(code, typeof(AssemblyCompanyAttribute)))
            AssemblyCompanyAttribute ascompany = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(code,
            company = ascompany.Company;

        if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute)))
            AssemblyDescriptionAttribute asdescription = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code,
            description = asdescription.Description;

        if (company != string.Empty && description != string.Empty)
            string desktopPath = string.Empty;
            desktopPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                "\\", description, ".appref-ms");

            string shortcutName = string.Empty;
            shortcutName = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs),
                "\\", company, "\\", description, ".appref-ms");

            System.IO.File.Copy(shortcutName, desktopPath, true);


credits to