Results 1 to 17 of 17

Thread: VB2008 Express Installation Question

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    VB2008 Express Installation Question

    I have created the setup and other files for an application written in VB2008 Express. It installs fine and then presents the application ready for use. However I simply cannot find the directory it is installed in. It is not the directory I entered into the install wizard - I thought it would be.

    This is a problem as I included a number of files to be installed with it and it needs them to run. I assumed that the application would start in this directory as the current directory and I could use the file open facility in VB2008 to list the files and choose one (I put a filter in the file open facility). However th files are not there and the directory it opens in is not the one I specified in the wizard. (This is the approach I use with VB6.)

    How should I get the application to open in the directory the .exe is in with the files?

    Thank you

    Punchy

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    This doesn't really sound like a VB.NET issue. How exactly did you create the installer? If you used the Publish functionality in VS then you're using ClickOnce, in which case you don't get to choose where the app is installed as it gets automatically installed to the ClickOnce cache. If that's not how you did it then it doesn't have anything at all to do with VS or VB and relates to your installation tool.

    That said, any VB app can determine the folder to which it was installed using the Application.StartupPath property. That is pretty much always how you should get to that path.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Hi jmcilhinney! Thank you for the prompt response. I have a followup question or two.

    I am using the Publish functionality in in VB 2008 Express.

    So if I use the following when the first form loads would that set the current directory to the directory the application started in? And so the files copied over in the install would now be visible?

    Directory.SetCurrentDirectory = Application.Startuppath

    Thank you

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    Quote Originally Posted by Punchy View Post
    Hi jmcilhinney! Thank you for the prompt response. I have a followup question or two.

    I am using the Publish functionality in in VB 2008 Express.

    So if I use the following when the first form loads would that set the current directory to the directory the application started in? And so the files copied over in the install would now be visible?

    Directory.SetCurrentDirectory = Application.Startuppath

    Thank you
    You don't have to do anything to make them visible. They already are visible. I'm guessing what you mean is so that you can access them without specifying a folder path but that is generally bad practice anyway. Unless you specifically want to follow the current directory even if it moves, you should always specify the folder path for a file. If the file is in the startup folder then you prepend the startup folder path, e.g.
    Code:
    Dim text = File.ReadAllText(Path.Combine(Application.StartupPath, "MyFile.txt"))
    Having said that, I don't use ClickOnce so it's possible that I'm wrong about where those files end up. ClickOnce might put somewhere else although I don't think that's the case other than for data files. Test out what I said and see and, if it doesn't work, post back and I'll look a bit closer, if someone else doesn't first.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Hi jmcilhinney.

    I tried what you suggested but got errors (Combine is not a member of string) when I typed
    Dim text = File.ReadAllText(Path.Combine(Application.StartupPath, "MyFile.txt"))
    into the load module of the first form.

    So I commented it out and tried in the initial form load
    Dim PathStart As String = Application.StartupPath
    Directory.SetCurrentDirectory(PathStart)

    but got an error that that SetCurrentDirectory was not a member of string.

    so I added to the Declarations of the code module
    Public Directory As String
    Public SetCurrentDirectory As String
    but this did not change the error.

    I think this is getting close. If I can just find out how to set the current directory to the start directory I think I will be OK.

    Can you (or anyone else) advise?

    Thank you

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    Path is a class. Specifically the System.IO.Path class.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Quote Originally Posted by jmcilhinney View Post
    Path is a class. Specifically the System.IO.Path class.
    Thanks.

    In the mean time I used
    PathStart = Application.StartupPath
    OpenFileDialog1.InitialDirectory = PathStart

    and this took me to the startup directory, however the files were not there. Any idea where they may be?

    Thank you

  8. #8

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    FYI that path was

    C:\Users\Joshua\AppData\Local\Apps\2.0\7Z9XX36D.B46\HYLHVVHK.DW3\iron..tion_cbbf966d7edb16b3_0001.00 00_4180c5b52f3febb5

    Thank you

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    Are you sure that the files are even being published? Have you checked the Application Files dialogue from the Publish page?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Hi

    I check the application Files and the drop down list had only two included, the .exe and the .exe.manifest files.

    The files (about 30 of them) are all there in the Resources tab, but I guess that if they are not listed in the Publish Page then they are not being published. True?

    How can I get them published?

    Thanks for the help.

  11. #11

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Hi

    I just checked the startup directory and the only files are the .exe and some manifest files. The other files were not there and so presumably have not been copied over.

    Thank you

  12. #12
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    Quote Originally Posted by Punchy View Post
    The files (about 30 of them) are all there in the Resources tab
    Argh! Resources are NOT files. They are resources, which is the whole point. A resource is data that is compiled into the EXE itself. If you want files then don't use resources and if you want resources then don't use files. So, which do you want?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  13. #13

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    Quote Originally Posted by jmcilhinney View Post
    Argh! Resources are NOT files. They are resources, which is the whole point. A resource is data that is compiled into the EXE itself. If you want files then don't use resources and if you want resources then don't use files. So, which do you want?
    Hi. I want files only. No resources.

    Thanks.

  14. #14
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    Quote Originally Posted by Punchy View Post
    Hi. I want files only. No resources.

    Thanks.
    So don't use resources then. Simply add the data file to your project and in the Solution Explorer and then set the Build Action and Copy To Output Directory properties to Content and Copy Always respectively. You should then find that that file will also be included in the Application Files dialogue. If you add the file to the root of the project then it will end up in the same folder as the EXE. You can also add a folder to your project and add the file to that and then you'll end up with the same folder structure in the program folder.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  15. #15

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    OK that seems to be working now. I will continue testing and let you know if I have any further issues.

    I can't say how much I appreciate the help! I would not have got there without your assistance.

    Thank you once again.

  16. #16
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VB2008 Express Installation Question

    You're not the first person to miss that, while "resource" can be used in a more general sense to just mean something used by an application, in this context it has a more specific meaning.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  17. #17

    Thread Starter
    Member
    Join Date
    Nov 2013
    Posts
    37

    Re: VB2008 Express Installation Question

    It is working well. I have installed on Win 8.1, Vista and XP with no problems.

    Can you tell me the name of any installers that are simple and self explanatory but allow more options such as allowing you to choose the directory you would like to install in?

    Thank you

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width