I'm having this exception when trying to use any of the Deployment members like for example I try in this simple code:
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MsgBox(If(My.Application.Deployment.IsFirstRun, "Yes", "No"))
Application identity is not set
Is it a ClickOnce application? It is network deployed? Are you debugging? That would not work in debug mode.
If you are debugging, use this to test:
If Not System.Diagnostics.Debugger.IsAttached Then firstRun = My.Application.Deployment.IsFirstRun End If
As it is not a network deployed application, I would check if the application has been previously launched saving a user settings or establishing a value in the registry.