currently there are needs to add some shortcut based on ClickOnce Application that being deployed,
it's obvious we can't create it manually because of the installation path
here is some remedy :D, u need to add reference to System.Deployment, System.IO, System.Reflection
until then
it's obvious we can't create it manually because of the installation path
here is some remedy :D, u need to add reference to System.Deployment, System.IO, System.Reflection
if (ApplicationDeployment.IsNetworkDeployed)
{
string publisherName = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(),
typeof(AssemblyCompanyAttribute), false)).Company;
string productName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
string startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);
startupPath = Path.Combine(startupPath, productName) + ".appref-ms";
if (!File.Exists(startupPath))
{
string allProgramsPath = Environment.GetFolderPath(Environment.SpecialFolder.Programs);
string shortcutPath = Path.Combine(allProgramsPath, publisherName);
shortcutPath = Path.Combine(shortcutPath, productName) + ".appref-ms";
File.Copy(shortcutPath, startupPath);
}
}
until then
Comments