VB.net application is keeping previous versions

那年仲夏 提交于 2020-07-23 08:23:06

问题


I have a visual basic project that is being published and increments the version number each time.

When I install a new version, it opens but as soon as the application restarts, it seems to revert back to the previous version and I cannot work out why.


回答1:


Try to update a minimum version required when you publish the application go to application proprties -> publish -> Updates...:

If you want to do this automatically and force the user to work on latest version only, you can update the vbproj file with MSBuild

  1. In Visual Studio, right click on the project and click on Unload Project

  2. Right click on the project and click on Edit

  3. Copy and Paste the following code before the close </Project> element

    <Target Name="AutoSetMinimumRequiredVersion" BeforeTargets="GenerateDeploymentManifest">
      <FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)">
        <Output PropertyName="MinimumRequiredVersion" TaskParameter="OutputVersion"  />
      </FormatVersion>
      <FormatVersion Version="$(ApplicationVersion)" Revision="$(ApplicationRevision)">
        <Output PropertyName="_DeploymentBuiltMinimumRequiredVersion" TaskParameter="OutputVersion"  />
      </FormatVersion>
    </Target>
    
  4. Save and Reload the project




回答2:


The whole point of a Click-once app is that it is uploaded to some URL where clients can fetch the latest version of it, automatically install it, and check for updates later. You can specify these under Publish in your project settings.

Once the correct data is provided here, you can publish your app, and have your users install it from the Installation Folder URL.

Under Updates (button in the pic above), you can specify whether the app should be available offline, what the minimum required version should be (make sure to update this to force updates!), and when the app should check for updates.

If you set this up correctly, then the application should update itself whenever a user starts it on a client, and a new version is available on the server.

PS: The full URL to download your application should then be as follows:

http://publicaddress.to.that.folder/YorApp/Your.Project.Name.application

Here Your.Project.Name is the name of your project in Visual Studio, and .application is the file extention for the installation file.




回答3:


Try to Clean and Rebuild the Project.



来源:https://stackoverflow.com/questions/62764227/vb-net-application-is-keeping-previous-versions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!