如何解决InvalidDeploymentException:未设置应用程序标识

本文关键字:设置 应用程序 标识 InvalidDeploymentException 何解决 解决 | 更新日期: 2023-09-27 18:15:51

在form1的顶部,我声明了变量,我有这一行:

private string ArchiveLogFileDirectory = Path.GetDirectoryName(Application.LocalUserAppDataPath) + "''Archive log file";

在LocalUserAppDataPath中见:

C:'Users'000'AppData'Local'mws'mws'1.0.0.5

我有目录1.0.0.5,但它是空的,为什么它要到这个目录?

这是异常消息:

System.Deployment.Application.InvalidDeploymentException occurred
  _HResult=-2146233087
  _message=Application identity is not set.
  HResult=-2146233087
  IsTransient=false
  Message=Application identity is not set.
  Source=System.Deployment
  StackTrace:
       at System.Deployment.Application.ApplicationDeployment.get_CurrentDeployment()
  InnerException: 

如何解决InvalidDeploymentException:未设置应用程序标识

我刚刚禁用了异常:

从Debug菜单中打开Exceptions窗口。展开"公共语言运行时异常"->"System.Deployment.Application"。取消选中"System.Deployment.Application.InvalidDeploymentException"旁边的复选框。