"Application.UserAppDataPath" before and after a publish

When I run my VBEE app in the debugger Application.UserAppDataPath points to:
C:\Documents and Settings\username\Application Data\companyname\....
as outlined in the help file.

When I publish my application this path then changes to:
C:\Documents and Settings\username\Local Settings\Apps\2.0\Data\BKXYGCXL....

Why does it do this
Can I stop it changing the path when I publish the application

Thanks for your help
Tim




Answer this question

"Application.UserAppDataPath" before and after a publish

  • _dog_

    I'll disagree with Trucker about the expense: there are free installers available that work extremely well - I use the NSIS installer. It doesn't have a wizard interface, but is a 'script' language that is extremely versatile (most of the applications I write are installed in a folder of the root system drive, and need full control over the install - NSIS works quite nicely). It also doesn't need any 'installer files' to run the install.

    ClickOnce just annoys the heck out of me, but I'm sure someone finds it useful. The setup projects in VS Pro are much better, and provide everything you need to get the application installed, without having to worry about coding.



  • MBrr

    ClickOnce applications are supposed to be sandboxed in such a way that different applications don't affect each other. Simply using the company name/app name and version doesn't give a strong enough guarantee that two applications can't conflict with each other... If I wanted to, it would be trivial for me to create an application that used the same company name and app name as you, and voila, I've got read/write access to your application's data...

    See http://msdn2.microsoft.com/en-us/library/d8saf4wy.aspx for info on how you can upgrade your data between versions...

    Best regards,
    Johan Stenberg



  • Patricko

    Yes as I change the user, company name, application name, and publishing version parameters the directory changes with the following format when I run the application in the debugger:
    C:\Documents and Settings\USER\Application Data\COMPANY\APP\VERSION

    However when I publish my application this structure is not followed. The "Local Settings" directory is used instead of the "Application Data" directory, company name and version number do not appear to be used anywhere, I get a string of apparently random characters (I am sure these are some sort of hash or other) in the path. It appears to be a completely unpredictable directory such as:

    C:\Documents and Settings\tward\Local Settings\Apps\2.0\Data\BKXYGCXL.N1N\558DA53P.C7K\xmlf..tion_9cbcb62e7aa249f9_0000.0001_6ca0882f26c28df5\Data

    This is causing me a problem as I have written my application to remove the "VERSION" part of the path off the Application.UserAppDataPath string to enable me to store data between different versions of my application.

    Do you have any ideas what is causing Application.UserAppDataPath to return a different string when the application is published and what I can do to stop it doing this.

    BTW I am using XP professional

    Thanks
    Tim

  • Atreju

    I agree that there are free installers that are good. But, the few I have tried, didn't impress me that much. Besides, that, Visual Studio 2005 Standard Edition has the same Setup Projects that the PRO Edition does and can be found on Amazon for as little as $160.00. Let me clarify, the Standard Edition that I received at the Visual Studio 2005 Launch Event has Setup Projects in it. And a friend of mine who purchased his copy from Amazon said that his included Setup Projects. But, if cost is an issue then it would make sense to check out some of the free installers out there and decide from there if it would be worth the cost of either upgrading to the Standard Edition or above, or purchasing a 3rd party installer. ( which can cost much more than the Standard Edition of VS 2005).

    james

    aka:Trucker


  • hank voight

    He's on good behavior tonight.



  • 5216

    In the Express Edition, ClickOnce Deployment is your only choice for deployment from within Visual Basic. You can use a 3rd party installer to build a regular setup. Usually, those are very expensive. I would reccommend upgrading to Visual Studio 2005 Standard Edition which does include regular Setup Projects, if you are wanting more control over the setup proccess. That way, you can install your application the the User's, Program Files, folder, place Shortcuts on the Desktop and even make Registery enteries if needed. None of which you can do with ClickOnce Deployment. ClickOnce Deployment is fine for simple application deployment, but, for what you seem to want, you need the full Windows Installer.

    james

    aka:Trucker


  • AaronEd

    I just looked at Installshield...my, my, their price has gone up quite a bit!

    I cannot comment on the Standard version of VS [setup projects]. But if Trucker says it, there, then that's good enough for me (I use VS Professional and VB Express).



  • Seiryuu

    You mean you're not going to insist on a screenshot

    james

    aka:Trucker


  • swmiller

    Thanks for the good link Johan

    That explains why it is causing me problems, but is there anything I can do about it I have just tried to turn off OneClick but each time I publish the application it automatically re-enables it. (I am sure there are some good security reasons for this).

    I want to store some data (it's very boring and not a security risk at all) in a common place, are there any macros that will help me In my VB6 apps I could put small files in the application directory. These would remain when the application was uninstalled and be there waiting for the next version to use. This gave a lovely seamless user experience (This was probably not the correct way to do it but it worked beautifully). I would like to be able to do something similar in vb.net. Things like Application.StartupPath and Application.CommonAppDataPath appear to point somewhere usefull in the debugger but then point to the obscure directories outlined above once the application is published. What would you suggest is a good way to define some application space that will persist through different versions of my software.

    Thanks for your time
    Tim

  • Gabriel82


    Thanks Trucker

    I am slowly building up more reasons to move across to VS2005 and the installer seems to be another one. In the meantime I am going to use:

    Dim Path As String
    Path = My.Computer.FileSystem.SpecialDirectories.ProgramFiles & "\COMANY NAME\APP NAME"

    Even if the executable file is not in the Program Files directory is still serves as a useful place to keep my files with the rest of our company's applications.

    Thanks
    Tim

  • Tomas Srna

    Application.UserAppDataPath string isn't same for any system/user/program, try to change your program name/version, the user name and it will change...
    Hope this helps a bit.


  • "Application.UserAppDataPath" before and after a publish