获取程序发布版本号时出现问题
我在VS2008 中用debug编译运行 没有问题 可以正常弹窗显示发布的版本号
但是在debug文件夹下点击exe文件运行就会给我报错
【System.ArgumentNullException 值不能为空】
程序如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Policy;
namespace MyTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
try
{
var appSecurInf = new ApplicationSecurityInfo(AppDomain.CurrentDomain.ActivationContext);
var appId = appSecurInf.ApplicationId;
MessageBox.Show(appId.Version.ToString());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}