Display Publish Version Error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike L

    #1

    Display Publish Version Error


    Error occurs on
    "System.Deploym ent.Application .ApplicationDep loyment.Current Deployment"


    ** Here is my code

    private void frmMain_Load(ob ject sender, System.EventArg s e)
    {
    System.Deployme nt.Application. ApplicationDepl oyment ad =
    System.Deployme nt.Application. ApplicationDepl oyment.CurrentD eployment;
    this.Text = "Dealer Sales " + ad.CurrentVersi on;

    }


    ** Here is the error message

    System.Deployme nt.Application. InvalidDeployme ntException was unhandled
    Message="Applic ation is not installed."
    Source="System. Deployment"
    StackTrace:
    at System.Deployme nt.Application. ApplicationDepl oyment..ctor(St ring
    fullAppId)
    at
    System.Deployme nt.Application. ApplicationDepl oyment.get_Curr entDeployment()
    at LicenseDealerSa les.frmMain.frm Main_Load(Objec t sender, EventArgs
    e) in C:\Documents and Settings\mikel\ My Documents\Visua l Studio
    Projects\Licens eDealerSales\fr mMain.cs:line 131
    at System.Windows. Forms.Form.OnLo ad(EventArgs e)
    at System.Windows. Forms.Form.OnCr eateControl()
    at System.Windows. Forms.Control.C reateControl(Bo olean fIgnoreVisible)
    at System.Windows. Forms.Control.C reateControl()
    at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
    at System.Windows. Forms.Control.W ndProc(Message& m)
    at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
    at System.Windows. Forms.Container Control.WndProc (Message& m)
    at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
    at System.Windows. Forms.Form.WndP roc(Message& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
    at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
    at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
    Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows. Forms.UnsafeNat iveMethods.Send Message(HandleR ef
    hWnd, Int32 msg, Int32 wParam, Int32 lParam)
    at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
    at System.Windows. Forms.Control.s et_Visible(Bool ean value)
    at
    System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
    reason, ApplicationCont ext context)
    at
    System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
    ApplicationCont ext context)
    at System.Windows. Forms.Applicati on.Run(Form mainForm)
    at LicenseDealerSa les.frmMain.Mai n() in C:\Documents and
    Settings\mikel\ My Documents\Visua l Studio
    Projects\Licens eDealerSales\fr mMain.cs:line 106
    at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[] args)
    at System.Runtime. Hosting.Manifes tRunner.Run(Boo lean checkAptModel)
    at System.Runtime. Hosting.Manifes tRunner.Execute AsAssembly()
    at
    System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
    activationConte xt, String[] activationCusto mData)
    at
    System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
    activationConte xt)
    at
    Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem blyDebugInZone( )
    at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
    at System.Threadin g.ExecutionCont ext.Run(Executi onContext
    executionContex t, ContextCallback callback, Object state)
    at System.Threadin g.ThreadHelper. ThreadStart()

  • Marc Gravell

    #2
    Re: Display Publish Version Error

    You need to check ApplicationDepl oyment.IsNetwor kDeployed; if this returns
    false there is no publication to get an application version from - so the
    best you can use is the assembly version via something like
    System.Reflecti on.Assembly.Get EntryAssembly() .GetName().Vers ion

    Marc


    Comment

    • TerryFei

      #3
      RE: Display Publish Version Error

      Hi Cadel,
      Thanks for Marc's reply!

      I just wanted to check how things are going and whether Marc's suggestion
      is useful for you. If there is any question, please feel free to join the
      community and we are here to support you at your convenience. Thanks for
      your understanding!

      Best Regards,

      Terry Fei[MSFT]
      Microsoft Community Support
      Get Secure! www.microsoft.com/security
      (This posting is provided "AS IS", with no warranties, and confers no
      rights.)


      --------------------[color=blue]
      >Thread-Topic: Display Publish Version Error
      >thread-index: AcY4ktXA/ASPLjhKQMuzDVzX cMDU0w==
      >X-WBNR-Posting-Host: 204.87.106.66
      >From: =?Utf-8?B?TWlrZSBM?= <Cadel@nospam.n ospam>
      >Subject: Display Publish Version Error
      >Date: Thu, 23 Feb 2006 08:04:32 -0800
      >Lines: 74
      >Message-ID: <85E1EDFB-6E83-4163-85B8-D56316775F7E@mi crosoft.com>
      >MIME-Version: 1.0
      >Content-Type: text/plain;
      > charset="Utf-8"
      >Content-Transfer-Encoding: 7bit
      >X-Newsreader: Microsoft CDO for Windows 2000
      >Content-Class: urn:content-classes:message
      >Importance: normal
      >Priority: normal
      >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
      >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
      >NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
      >Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
      >Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3879 90
      >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
      >
      >
      >Error occurs on
      >"System.Deploy ment.Applicatio n.ApplicationDe ployment.Curren tDeployment"
      >
      >
      >** Here is my code
      >
      > private void frmMain_Load(ob ject sender, System.EventArg s[/color]
      e)[color=blue]
      > {
      > System.Deployme nt.Application. ApplicationDepl oyment ad =
      >System.Deploym ent.Application .ApplicationDep loyment.Current Deployment;
      > this.Text = "Dealer Sales " + ad.CurrentVersi on;
      >
      > }
      >
      >
      >** Here is the error message
      >
      >System.Deploym ent.Application .InvalidDeploym entException was unhandled
      > Message="Applic ation is not installed."
      > Source="System. Deployment"
      > StackTrace:
      > at System.Deployme nt.Application. ApplicationDepl oyment..ctor(St ring
      >fullAppId)
      > at
      >System.Deploym ent.Application .ApplicationDep loyment.get_Cur rentDeployment( )
      > at LicenseDealerSa les.frmMain.frm Main_Load(Objec t sender, EventArgs
      >e) in C:\Documents and Settings\mikel\ My Documents\Visua l Studio
      >Projects\Licen seDealerSales\f rmMain.cs:line 131
      > at System.Windows. Forms.Form.OnLo ad(EventArgs e)
      > at System.Windows. Forms.Form.OnCr eateControl()
      > at System.Windows. Forms.Control.C reateControl(Bo olean[/color]
      fIgnoreVisible)[color=blue]
      > at System.Windows. Forms.Control.C reateControl()
      > at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
      > at System.Windows. Forms.Control.W ndProc(Message& m)
      > at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
      > at System.Windows. Forms.Container Control.WndProc (Message& m)
      > at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
      > at System.Windows. Forms.Form.WndP roc(Message& m)
      > at
      >System.Windows .Forms.Control. ControlNativeWi ndow.OnMessage( Message& m)
      > at[/color]
      System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)[color=blue]
      > at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr[/color]
      hWnd,[color=blue]
      >Int32 msg, IntPtr wparam, IntPtr lparam)
      > at System.Windows. Forms.UnsafeNat iveMethods.Send Message(HandleR ef
      >hWnd, Int32 msg, Int32 wParam, Int32 lParam)
      > at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
      > at System.Windows. Forms.Control.s et_Visible(Bool ean value)
      > at
      >System.Windows .Forms.Applicat ion.ThreadConte xt.RunMessageLo opInner(Int32
      >reason, ApplicationCont ext context)
      > at
      >System.Windows .Forms.Applicat ion.ThreadConte xt.RunMessageLo op(Int32[/color]
      reason,[color=blue]
      >ApplicationCon text context)
      > at System.Windows. Forms.Applicati on.Run(Form mainForm)
      > at LicenseDealerSa les.frmMain.Mai n() in C:\Documents and
      >Settings\mikel \My Documents\Visua l Studio
      >Projects\Licen seDealerSales\f rmMain.cs:line 106
      > at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[][/color]
      args)[color=blue]
      > at System.Runtime. Hosting.Manifes tRunner.Run(Boo lean checkAptModel)
      > at System.Runtime. Hosting.Manifes tRunner.Execute AsAssembly()
      > at
      >System.Runtime .Hosting.Applic ationActivator. CreateInstance( ActivationConte x[/color]
      t[color=blue]
      >activationCont ext, String[] activationCusto mData)
      > at
      >System.Runtime .Hosting.Applic ationActivator. CreateInstance( ActivationConte x[/color]
      t[color=blue]
      >activationCont ext)
      > at
      >Microsoft.Visu alStudio.Hostin gProcess.HostPr oc.RunUsersAsse mblyDebugInZone ([/color]
      )[color=blue]
      > at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
      > at System.Threadin g.ExecutionCont ext.Run(Executi onContext
      >executionConte xt, ContextCallback callback, Object state)
      > at System.Threadin g.ThreadHelper. ThreadStart()
      >
      >[/color]

      Comment

      • Mike L

        #4
        Re: Display Publish Version Error

        The code brought a number back, but I don't know what it is.
        I have the publish version set to 1.0.8.0 but the code brings back
        1.0.2249.26117


        My new code.

        this.Text = "Dealer Sales " +
        System.Reflecti on.Assembly.Get EntryAssembly() .GetName().Vers ion.ToString();


        "Marc Gravell" wrote:
        [color=blue]
        > You need to check ApplicationDepl oyment.IsNetwor kDeployed; if this returns
        > false there is no publication to get an application version from - so the
        > best you can use is the assembly version via something like
        > System.Reflecti on.Assembly.Get EntryAssembly() .GetName().Vers ion
        >
        > Marc
        >
        >
        >[/color]

        Comment

        • TerryFei

          #5
          Re: Display Publish Version Error

          Hi Cadel,
          Thanks for your response!

          The version is composed by four parts. They are Major Version, Minor
          Version, Build Number and Revision Number. Based on my knowledge, we can
          ignore Build Number and Revision Number. In another word, if Major Version
          and Minor Version are equal, these two versions are match. In your current
          situation, Major Version and Minor Version of "1.0.8.0" is 1 and 0; Major
          Version and Minor Version of "1.0. 2249.26117" is also 1 and 0. So you can
          think these two versions are same.

          I hope the above information is helpful for you. Thanks for your
          understanding!

          Best Regards,

          Terry Fei [MSFT]
          Microsoft Community Support
          Get Secure! www.microsoft.com/security

          --------------------[color=blue]
          >Thread-Topic: Display Publish Version Error
          >thread-index: AcY73Vf3er5uhAV dRhqWSiFc3DuhRQ ==
          >X-WBNR-Posting-Host: 204.87.106.66
          >From: =?Utf-8?B?TWlrZSBM?= <Cadel@nospam.n ospam>
          >References: <85E1EDFB-6E83-4163-85B8-D56316775F7E@mi crosoft.com>[/color]
          <Oj6ChcJOGHA.37 88@TK2MSFTNGP09 .phx.gbl>[color=blue]
          >Subject: Re: Display Publish Version Error
          >Date: Mon, 27 Feb 2006 12:35:27 -0800
          >Lines: 22
          >Message-ID: <8FFB803C-0AF2-47BB-9125-E03CA14C275C@mi crosoft.com>
          >MIME-Version: 1.0
          >Content-Type: text/plain;
          > charset="Utf-8"
          >Content-Transfer-Encoding: 7bit
          >X-Newsreader: Microsoft CDO for Windows 2000
          >Content-Class: urn:content-classes:message
          >Importance: normal
          >Priority: normal
          >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
          >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
          >NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
          >Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
          >Xref: TK2MSFTNGXA01.p hx.gbl microsoft.publi c.dotnet.langua ges.csharp:3887 37
          >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
          >
          >The code brought a number back, but I don't know what it is.
          >I have the publish version set to 1.0.8.0 but the code brings back
          >1.0.2249.261 17
          >
          >
          >My new code.
          >
          >this.Text = "Dealer Sales " +
          >System.Reflect ion.Assembly.Ge tEntryAssembly( ).GetName().Ver sion.ToString() ;
          >
          >
          >"Marc Gravell" wrote:
          >[color=green]
          >> You need to check ApplicationDepl oyment.IsNetwor kDeployed; if this[/color][/color]
          returns[color=blue][color=green]
          >> false there is no publication to get an application version from - so[/color][/color]
          the[color=blue][color=green]
          >> best you can use is the assembly version via something like
          >> System.Reflecti on.Assembly.Get EntryAssembly() .GetName().Vers ion
          >>
          >> Marc
          >>
          >>
          >>[/color]
          >[/color]

          Comment

          Working...