How do I retrieve my Published version?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thomasbihn
    New Member
    • Mar 2010
    • 6

    #1

    How do I retrieve my Published version?

    I am having a difficult time retrieving the Published Version as it appears in my project properties/Publish tab.

    The current "Publish Version" is 1.0.0.3, but no matter what I do, I get 1.0.0.0. I'm a newb to C#. I've been searching, but the closest thing I found was a reference to "System.Deploym ent.Application .ApplicationDep loyment.Current Deployment.Curr entVersion;" which gives me a nice error that the application is not installed.
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by thomasbihn
    I am having a difficult time retrieving the Published Version as it appears in my project properties/Publish tab.

    The current "Publish Version" is 1.0.0.3, but no matter what I do, I get 1.0.0.0. I'm a newb to C#. I've been searching, but the closest thing I found was a reference to "System.Deploym ent.Application .ApplicationDep loyment.Current Deployment.Curr entVersion;" which gives me a nice error that the application is not installed.
    what are you trying to achieve..
    Are you trying to get the version of the assembly you're referencing..
    If so then make sure you've an updated copy of the assembly in your application classpath

    Comment

    • thomasbihn
      New Member
      • Mar 2010
      • 6

      #3
      Originally posted by ThatThatGuy
      what are you trying to achieve..
      Are you trying to get the version of the assembly you're referencing..
      If so then make sure you've an updated copy of the assembly in your application classpath
      Thanks for the response ThatThatGuy. I found the solution after posting. I'm a total newbie to C# programming. But to answer your question, I believe I am getting the version of the assembly. If you right-click on the project in Solution Explorer and select Properties, a tab shows up with several side tabs. The bottom side-tab is titled "Publish". At the bottom of this section is "Publish Version", which shows Major, Minor, Build, and Revision. Automatically increment revision with each publish is checked. I wanted to show this revision in the caption of the form for the program so if someone has a problem with it, I could determine if they are working with the most recent copy. I thought Application.Pro ductVersion would do the trick, but it just shows 1.0.0.0. The method I found works, but it wasn't as intuitive as this seemed and doesn't actually show the version when running in debug mode. You have to build it and run the EXE to actually see the revision. The solution was as follows:

      Code:
                  if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
                  {
      
                      System.Deployment.Application.ApplicationDeployment ad = System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
      
                      this.Text = this.Text +  "    Version: " + ad.CurrentVersion.ToString();
      
                  }
      What is an "applicatio n classpath"? I kept seeing references to "ClickOnce" , but haven't seen a reference in Visual Studio 2008 to it. I assume that it is the installation method used when you publish. If this is wrong, please someone correct me.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Click once allows you to control some parts of the "install" for the publish, most imporantly that I have found is the ability to assign security privledges.
        For example: I have a piece of software used throughout the company.
        I publish this software to a location on a network drive. I wanted the users to be able to "run" the application from the network drive instead of installing it on their PCs. Generally this fails the default security checks(you can adjust them under admin tools->.NET configuration). With click once you can set it up so that those advanced security priveldges are requested: "Do you really wish to run this application" type prompt comes up.
        This also has the added bonus of always making sure users have the most updated version everytime they run the software

        EDIT: ok nm you found this part out:
        Unless you run the application from the published files, you won't get the published version?
        I check to see if this boolean is true first: ApplicationDepl oyment.IsNetwor kDeployed;
        Then I can access this:
        ApplicationDepl oyment.CurrentD eployment.Curre ntVersion;

        Comment

        • SimonHolzman
          New Member
          • Aug 2013
          • 1

          #5
          Code:
                  Dim ourVersion As String
                  If My.Application.IsNetworkDeployed Then
                      ourVersion = Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
                  Else
                      ourVersion = "Testing"
                  End If

          Comment

          Working...