kevin-Y

找了一段生成ClickOne的快捷方式的生成代码

找了一段生成ClickOne的快捷方式的生成代码,晚上回去试试能否可用。

 

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,

typeof(AssemblyCompanyAttribute));

company
= ascompany.Company;

}



if (Attribute.IsDefined(code, typeof(AssemblyDescriptionAttribute)))

{

AssemblyDescriptionAttribute asdescription
= (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(code,

typeof(AssemblyDescriptionAttribute));

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);

}



}

}

posted on 2011-09-08 10:23 生命体验之kevin-Y 阅读(17) 评论(0) 编辑 收藏

导航

统计信息

News

搜索

 
 

常用链接

我的标签

随笔分类

随笔档案

文章分类

关注站点

最新评论

阅读排行榜

评论排行榜

推荐排行榜