VS项目打包发布

If you want to do it with ClickOnce, please refer to the following documents:

ClickOnce - Quick steps to Deploy, Install and Update Windows Based Client Applications.

Deploying Windows applications using ClickOnce (Visual Studio 2008)

How-To: Use ClickOnce to deploy your Applications

If you want to use Windows Installer(MSI), please refer to the following document:

Creating an MSI Package for C# Windows Application Using a Visual Studio Setup Project

Updates to setup projects

For MSI, you need to install a Setup project to your VS:

Microsoft Visual Studio 2017 Installer Projects

How to install .vsix:

Developer Command Prompt for VS 2017

VSIXInstaller <path to vsix file>

中文参考:三五月儿 的 使用ClickOnce部署Windows应用程序

注意:与 Publishing Folder Location 相同

 

ClickOnce先决条件(Prerequisties)路径:C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages

ClickOnce安装路径:C:\Users\kylew\AppData\Local\Apps\2.0 (保留当前版本和上一个版本)

获取ClickOnce安装路径:

System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
string assemblyLocation = assemblyInfo.Location;
// MessageBox.Show(assemblyLocation);
Uri uriCodeBase = new Uri(assemblyInfo.CodeBase);
string ClickOnceLocation = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());//Path for cliconce installed location
MessageBox.Show(ClickOnceLocation);

ClickOnce自定义先决条件:

Add your own (custom) prerequisite to "ClickOnce" application

Visual Studio Install 打包安装项目2017

ClickOnce获取当前版本号:

ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();

ClickOnce获取项目中资源文件:

pictureBox1.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + @"/img/a.jpg");
ApplicationDeployment.CurrentDeployment.DataDirectory + @"\Database1.mdf"

中文参考:

ClickOnce部署Winform程序的方方面面

ClickOnce部署(1):一些发布方式

ClickOnce部署(2):自动更新

ClickOnce部署(3):使用证书

ClickOnce部署(4):下载多个安装包

ClickOnce部署(5):自定义安全权限

英文参考:

ClickOnce: Concurrent versions

Trusted Click Once WPF setting

VS设置注册表项:

private void Form1_Load(object sender, EventArgs e)
{
    label1.Text = GetRegistData("New Value #1");
    //label2.Text = GetRegistData("New Value #2");
    //label3.Text = GetRegistData("New Value #3");
}

// 读取注册表中相关数据
private static string GetRegistData(string name)
{
    string registData;
    RegistryKey hkml = Registry.CurrentUser;
    RegistryKey software = hkml.OpenSubKey("SOFTWARE", true);
    registData = software.GetValue(name).ToString();
    return registData;
}

转载于:https://www.cnblogs.com/jizhiqiliao/p/10065145.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值