dcsimg
Results 1 to 33 of 33

Thread: [RESOLVED] Setup Installer Errors

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Resolved [RESOLVED] Setup Installer Errors

    I am developing a VB Forms Application under Visual Studio 2017. The App function works perfectly under Debug or Release but when installed using Smart Installer I get a File Access Denied. Why is there a difference if testing under Debug works?

    Everybody has assisted me a lot. I am on the last leg now and need this last point resolved:
    1) I used the following to setup a Function: Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FDS", "FDSPro", filename)
    2) This causes the following error: System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'C:\Users\Admin\AppData\Local\FDS\FDSPro\FileStartup.txt'.'
    FileStartup is the first file to be read.
    3) If I use the following instead: Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), filename)
    Everything works OK except ahat all of the files are placed in the: User\Admin\AppData\Local folder.
    I would like the additional folders so that it resembles other installed Apps

    Can anybody help with this please
    NB: My App ensures that ALL of the files needed are created using Try/Catch/EndTry...thanks all, Paul
    Last edited by BasicBasic; Aug 5th, 2019 at 01:25 PM.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,752

    Re: Setup Installer Errors

    What file is it trying to access?

  3. #3
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,553

    Re: Setup Installer Errors

    Are you installing it on your own machine or someone elses ?
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    In this project, there are several Text Files. The first to be loaded is the one denied. The application does not need any files to exist prior to running. On Initializing, the App attempts to read all of the required files and makes an empty file if it is not there using Try/Catch/EndTry. the code to read the files is:

    Dim fileIN As StreamReader
    fileIN = IO.File.OpenText("Filename.txt")
    While Not fileIN.EndOfStream
    StringLine = fileIN.ReadLine()
    End While
    fileIN.Close()

    I am installing on my own machine. Also, If I copy the contents of the Debug or Release folders to a USB drive, it all works fine

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    As you have only specified the name of the file and not the location of it, the location will be unpredictable... it turns out that whatever location you are attempting to read from isn't somewhere that your program has permission for.

    If you specify a valid location then you will avoid the error.

    As to what location(s) will be valid, that depends a bit on what what the circumstances are. If your program is running on a USB drive then the same folder as the program might be OK, but for an installed program that isn't valid. For any Windows based computer (whether the program is installed or not), the various ApplicationData folders are valid options for data files.

    You can see the various ApplicationData options (and a code example) here: https://docs.microsoft.com/en-us/dot...tframework-4.8

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Quote Originally Posted by si_the_geek View Post
    As you have only specified the name of the file and not the location of it, the location will be unpredictable... it turns out that whatever location you are attempting to read from isn't somewhere that your program has permission for.

    If you specify a valid location then you will avoid the error.

    As to what location(s) will be valid, that depends a bit on what what the circumstances are. If your program is running on a USB drive then the same folder as the program might be OK, but for an installed program that isn't valid. For any Windows based computer (whether the program is installed or not), the various ApplicationData folders are valid options for data files.

    You can see the various ApplicationData options (and a code example) here: https://docs.microsoft.com/en-us/dot...tframework-4.8
    "I see. I was under the impression that as long as the Application and the data were in the same folder, it would find it OK. One problem with this situation is that I will have to dictate where the installation goes and not allow the installer to change the default location directory, right? Is this how the problem can be solved, or are there a more satisfactory solution."

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Hi jmcilhinney:
    I dont know it you can see the other threads to my post. It appears that the issue is that I have not implicitly defined the Path of the file. I did not do this because I had no idea if the person installing the App would agree with my default directory structure. If this is indeed the solution, then I have 26 files being accessed in dozens of locations thought the App...a big editing job. Is there a way of telling the App that ALL of the files can be located in the same folder as the App.Exe, this would be a very simple way of testing if this is the problem...what are your thoughts?
    Regards, Paul

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Hi si_the_geek:
    There is probably a good solution in the LINK you gave me. As I am new to PC Programming (Embedded C Programmer), I dont have the experience to make a good choice. Could you help me with the syntax to set the working directory to where ever the App was placed? This way the person making the installation can choose any location. If not, I have a tonn of work making all the changes. Is there not a DefaultDirectoryDefine statement in VB? Still need more help.

  9. #9
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    The ApplicationData folders already exist (they are created and managed by Windows itself), and the location of your program is irrelevant to whether or not you use them - it doesn't affect the code in any way (the example I linked to is valid no matter where it is running from).

    Using them only affects your installation to a minor degree, in that you need to specify that the install path for the data files is within whichever ApplicationData folder you choose to use. If the installer doesn't have the option of specifying an ApplicationData folder, it isn't worth using (the folders have been "must use" for at least 20 years).

    Is there a way of telling the App that ALL of the files can be located in the same folder as the App.Exe
    You need to specify the location for each file, every time you refer to the name of it.

    Specifying the App folder takes almost exactly the same effort as specifying an ApplicationData folder, but using the App folder will fail in a large percentage of situations.

    Is there not a DefaultDirectoryDefine statement in VB
    Nope, if you don't specify a location you are subject to the unpredictable magic of "the current working directory"... which can change at any moment due to many different reasons (some are within your control, and some are not).

    Could you help me with the syntax ...
    Here is one option (LocalApplicationData might not be what you want, the link above has info):
    Code:
    Dim fileIN As StreamReader
    Dim filePath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "YourCompanyOrAppName", "Filename.txt")
    fileIN = IO.File.OpenText(filePath)

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    OK. However, does this allow the person who installs the App to change the installation directory structure. If not, then I could specify the installation path to say C:\Program Files\CompanyName\AppName"Filename.txt" and use this for the installation AND the path to retrieve the files, is this correct? What advantage is there in doing it the "SpecialFolder" method unless it somehow (by VB Magic) capture where everyuthing was installed...Advice

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Quote Originally Posted by si_the_geek View Post
    The ApplicationData folders already exist (they are created and managed by Windows itself), and the location of your program is irrelevant to whether or not you use them - it doesn't affect the code in any way (the example I linked to is valid no matter where it is running from).

    Using them only affects your installation to a minor degree, in that you need to specify that the install path for the data files is within whichever ApplicationData folder you choose to use. If the installer doesn't have the option of specifying an ApplicationData folder, it isn't worth using (the folders have been "must use" for at least 20 years).

    You need to specify the location for each file, every time you refer to the name of it.

    Specifying the App folder takes almost exactly the same effort as specifying an ApplicationData folder, but using the App folder will fail in a large percentage of situations.

    Nope, if you don't specify a location you are subject to the unpredictable magic of "the current working directory"... which can change at any moment due to many different reasons (some are within your control, and some are not).

    Here is one option (LocalApplicationData might not be what you want, the link above has info):
    Code:
    Dim fileIN As StreamReader
    Dim filePath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "YourCompanyOrAppName", "Filename.txt")
    fileIN = IO.File.OpenText(filePath)
    "One last question please...Do I have to type ALL of this every time I want to open or Save to a file? Is there a way I can create a DEFINE statement such as:
    DEFINE As Mypath=Dim filePath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "YourCompanyOrAppName", "Filename.txt"). I know that does not exist in VB but is there something similar?

    I am desperately trying to find a solution to avoid altering so much code"

  12. #12
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,410

    Re: Setup Installer Errors

    the SpecialFolders class has nothing to do with the installation ... that's part of the point of it. It's not VB Magic either... it's Windows magic. It's Windows telling VB, these are special folders you can use. So, no matter where the user installs your application, whether it's in Program Files (where it should be) or in C:\, or on a USB drive, or where ever... if you use SpecialFolders properly, it will always work.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    OK. However, does this allow the person who installs the App to change the installation directory structure.
    The location of the data files has no effect on the location of the other files (the .exe files etc). The location of the other files is irrelevant to the data files.

    What advantage is there in doing it the "SpecialFolder" method unless it somehow (by VB Magic) capture where everyuthing was installed...Advice
    The special folder works, the other options lead to problems which vary based on circumstances (such as the one at the start of this thread).

    In terms of un-installing your app, whichever installation tool you are using should allow the option of deleting the data files even if they have changed, but whether you want them deleted is up to you (leaving them means that if the user installs your app again, the data is still there).

    Quote Originally Posted by BasicBasic View Post
    "One last question please...Do I have to type ALL of this every time I want to open or Save to a file? Is there a way I can create a DEFINE statement such as:
    DEFINE As Mypath=Dim filePath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "YourCompanyOrAppName", "Filename.txt"). I know that does not exist in VB but is there something similar?

    I am desperately trying to find a solution to avoid altering so much code"
    You can simplify it a lot by creating a function to do the work (and it only needs to exist once in your project), eg:
    Code:
    Public Function GetFullFilePath(filename as String) as String 
      Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "YourCompanyOrAppName", filename)
    End Function
    ...and to use it:
    Code:
    Dim fileIN As StreamReader
    fileIN = IO.File.OpenText(GetFullFilePath("Filename.txt"))
    Last edited by si_the_geek; Aug 2nd, 2019 at 01:37 PM. Reason: typo in code

  14. #14
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,080

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    OK. However, does this allow the person who installs the App to change the installation directory structure. If not, then I could specify the installation path to say C:\Program Files\CompanyName\AppName"Filename.txt" and use this for the installation AND the path to retrieve the files, is this correct? What advantage is there in doing it the "SpecialFolder" method unless it somehow (by VB Magic) capture where everyuthing was installed...Advice
    Putting your data files in the c:\program files\ directory will result in permission errors if the user is a non-admin, it is assuming the user hasn't redirected the program files directory to another location and is also assuming the user is running an English copy of windows.

    The program files folder is for the program files, don't put writable files there - that is what the program various ApplicationData folders are for.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Hi tg...thanks for the reply.
    As you know, knowing half of the truth can get you in a lot of trouble, especially when we are dealing with magic, no matter what the type of magic. I will digest this for a while and then coma back and thank everybody for their outstanding assistance in this regard. I thank everybody concerned.

  16. #16

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Hi PlausiblyDamp:
    This is valuable information, than you. My first App in VB is a wonderful learning experience. I am very lucky you guys (or girls?) spend your valuable time with Nubie's like me...to everybody, thank you

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    ...the light is coming on a litthe now. However:
    1) If I specify \CompanyName\AppName\File.txt, where will the Installer actually place it on the HDD. Although I can specify where the App goes C:\Program Files\CompanyName\AppName...where is the AppData going to be stored using this method? Also, I assume that I will use the same method for Dim fileOUT ...etc using StringWriter, correct?

  18. #18

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Sorry, that was supposed to be "thank you"

  19. #19
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    ...the light is coming on a litthe now. However:
    1) If I specify \CompanyName\AppName\File.txt, where will the Installer actually place it on the HDD.
    You don't need to worry, because Windows will sort it out (and the installer will somehow allow you to specify AppDataLocal etc as part of the path).

    It might be in a path like "C:\Users\<username>\AppData\Local" , but it might be somewhere else entirely (based on the version of Windows, which language was being used when Windows was installed, and several other things).

    To find out manually what it is on your computer, open Explorer and enter an address of: %LocalAppData%

    Also, I assume that I will use the same method for Dim fileOUT ...etc using StringWriter, correct?
    Correct, everywhere you refer to a file name you should build the full path to the file... if you are using the function in post #13, anywhere you currently have just "Filename.txt" change it to GetFullFilePath("Filename.txt")

  20. #20

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    I will give this my best over the weekend and see how it goes, thank you so much for all your support...Paul

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    One last question: If I Try to open a file, I can use the Function. If I want to Create.Text using the StreamWriter, same procedure?

  22. #22
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    One last question: If I Try to open a file, I can use the Function. If I want to Create.Text using the StreamWriter, same procedure?
    Yes, the end of my previous post applies to all uses of files.

    By the way there was a typo in the function (an extra bracket), I've updated the post with the fixed version.

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Quote Originally Posted by si_the_geek View Post
    The location of the data files has no effect on the location of the other files (the .exe files etc). The location of the other files is irrelevant to the data files.

    The special folder works, the other options lead to problems which vary based on circumstances (such as the one at the start of this thread).

    In terms of un-installing your app, whichever installation tool you are using should allow the option of deleting the data files even if they have changed, but whether you want them deleted is up to you (leaving them means that if the user installs your app again, the data is still there).

    You can simplify it a lot by creating a function to do the work (and it only needs to exist once in your project), eg:
    Code:
    Public Function GetFullFilePath(filename as String) as String 
      Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "YourCompanyOrAppName", filename)
    End Function
    ...and to use it:
    Code:
    Dim fileIN As StreamReader
    fileIN = IO.File.OpenText(GetFullFilePath("Filename.txt"))
    "It looks the same as before, 2-in and 2-out"

  24. #24
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,410

    Re: Setup Installer Errors

    And what is that supposed to mean?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  25. #25

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Hi techgnome:
    I never posted this. I believe that there might be a BUG in this Forum Code

  26. #26

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Quote Originally Posted by si_the_geek View Post
    The ApplicationData folders already exist (they are created and managed by Windows itself), and the location of your program is irrelevant to whether or not you use them - it doesn't affect the code in any way (the example I linked to is valid no matter where it is running from).

    Using them only affects your installation to a minor degree, in that you need to specify that the install path for the data files is within whichever ApplicationData folder you choose to use. If the installer doesn't have the option of specifying an ApplicationData folder, it isn't worth using (the folders have been "must use" for at least 20 years).

    You need to specify the location for each file, every time you refer to the name of it.

    Specifying the App folder takes almost exactly the same effort as specifying an ApplicationData folder, but using the App folder will fail in a large percentage of situations.

    Nope, if you don't specify a location you are subject to the unpredictable magic of "the current working directory"... which can change at any moment due to many different reasons (some are within your control, and some are not).

    Here is one option (LocalApplicationData might not be what you want, the link above has info):
    Code:
    Dim fileIN As StreamReader
    Dim filePath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "YourCompanyOrAppName", "Filename.txt")
    fileIN = IO.File.OpenText(filePath)
    "I am not sure how to drive this Forum Bus yet. I posted a Thank you for everybody and it did not upload, possibly it was too large. Anyway, your solution worked. Thank you everybody for all of your kind assistance. One last thing Si, in your notation you showed: "YourCompanyOrAppName", "Filename.txt"). I put "My companyName", "ApplicationName", "Filename.txt" and the System notified than it could not find all of the Path. What is the correct syntax please. You can mark this RESOLVED after your reply...again, Thanks Everybody"

  27. #27
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    I put "My companyName", "ApplicationName", "Filename.txt"
    That is good.

    and the System notified than it could not find all of the Path. What is the correct syntax please.
    How to deal with that is debatable... one way is to get the installer to create it for you (it will probably need to anyway, as you will probably want to put some files in there as part of the installation), and another is to have code which runs when your program starts that creates the folder(s) if they don't already exist.

    Using the installer to do it is a good idea, because it will run with high permissions and make sure permissions are set up appropriately for the folder(s).

    Having code to do it is also a good idea, because it copes with situations where the folder hasn't been created yet (or the user foolishly deleted it). This also copes with setting it up for development, which is useful if other people might work on the project later (or you might use another computer).

    I would personally probably do both.

    The simple version of the code to create a folder (including any parent folders that need to be created first) is:
    Code:
    Dim folderPath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "My companyName", "ApplicationName")
    System.IO.Directory.CreateDirectory(folderPath)
    (but as unexpected errors are possible you'll want appropriate exception handling, and you may need to consider setting permissions)

    You can mark this RESOLVED after your reply...again, Thanks Everybody"
    Actually that is for you to do when you think everything is complete (because we can't tell if you actually think that or not - you might have questions on the details).

    You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).

  28. #28

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Quote Originally Posted by si_the_geek View Post
    That is good.

    How to deal with that is debatable... one way is to get the installer to create it for you (it will probably need to anyway, as you will probably want to put some files in there as part of the installation), and another is to have code which runs when your program starts that creates the folder(s) if they don't already exist.

    Using the installer to do it is a good idea, because it will run with high permissions and make sure permissions are set up appropriately for the folder(s).

    Having code to do it is also a good idea, because it copes with situations where the folder hasn't been created yet (or the user foolishly deleted it). This also copes with setting it up for development, which is useful if other people might work on the project later (or you might use another computer).

    I would personally probably do both.

    The simple version of the code to create a folder (including any parent folders that need to be created first) is:
    Code:
    Dim folderPath as String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)), "My companyName", "ApplicationName")
    System.IO.Directory.CreateDirectory(folderPath)
    (but as unexpected errors are possible you'll want appropriate exception handling, and you may need to consider setting permissions)

    Actually that is for you to do when you think everything is complete (because we can't tell if you actually think that or not - you might have questions on the details).

    You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).
    My code already does this and the files are created but they are all in the ...\Users\Admin\AppData\Local folder. All the other Apps have their own folder, all of mine are at the end listed one under the other...looks amateur. I am using the Advanced Install but the documentation is non-existent. Is there an Installer you recommend?

  29. #29
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    My code already does this and the files are created but they are all in the ...\Users\Admin\AppData\Local folder. All the other Apps have their own folder, all of mine are at the end listed one under the other...looks amateur.
    I'm not sure what you mean here... most apps store things in folders under \Users\(username)\AppData\Local (or one of the other folders under AppData, or in ProgramData... the link in post #5 tells you the alternatives to LocalApplicationData that get the others).

    For example, on my computer there are (among many others): ...\AppData\Local\Microsoft\VisualStudio\15.0 and ...\AppData\Roaming\Microsoft\VisualStudio\15.0

    Bear in mind that most users wont ever look in those folders, and generally you shouldn't put files there that are supposed to be directly visible to the user... instead you can use the Documents folder (eg: I have ...\Documents\Visual Studio 2017\Projects), which again the link in post #5 has info to find.
    I am using the Advanced Install but the documentation is non-existent. Is there an Installer you recommend?
    I haven't distributed desktop apps for many years, so haven't got any suggestions... hopefully somebody else will.

  30. #30

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    Meaning:
    On initialization, I attempt to open a files (12) using "Try". It will obviously fail the first time the App is installed and the files will be created. I used the method you advised and the System placed all the User files
    in ...AppData\Local. I would like to add further folders such as: AppData\Local\Company\AppName. However, when I include them (according to your CODE), the System throws a notification that the Path is not complete. When I look at the Folder Structure I see that the \Company\AppName has not been added, this is why the notification came.

    For some reason, I fine very little Concise information in Book form that would fully explain how to accomplish everything I want to do. Is there such a book or website? I am using Advanced Installer and there is no documentation on this either and it is Brand New built for Visual Studio 2017/2019. Why is it like this, whats going on. Is VB abandoned by Microsoft?

  31. #31

    Thread Starter
    Junior Member
    Join Date
    Aug 2019
    Posts
    27

    Re: Setup Installer Errors

    ERRORS:
    Everybody has assisted me a lot. I am on the last leg now and need this last point resolved:
    1) I used the following to setup a Function: Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FDS", "FDSPro", filename)
    2) This causes the following error: System.IO.DirectoryNotFoundException: 'Could not find a part of the path 'C:\Users\Admin\AppData\Local\FDS\FDSPro\FileStartup.txt'.'
    FileStartup is the first file to be read.
    3) If I use the following instead: Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), filename)
    Everything works OK except ahat all of the files are placed in the: User\Admin\AppData\Local folder.
    I would like the additional folders so that it resembles other installed Apps

    Can anybody help with this please
    NB: My App ensures that ALL of the files needed are created using Try/Catch/EndTry...thanks all, Paul

    I have just thought. I used: fileOUT = IO.File.CreateText(GetFullFilePath("FileStartup.txt")). Do I need to add the additional directory folders here as well? If I need to add, what is the syntax please...thanks.
    I am using the Advanced Installer with Visual Studio, the documentation is useless. Does anybody know of a good, easy to use Installer please.

  32. #32
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    791

    Re: Setup Installer Errors

    Prior to any code that attempts to access files from that path, add code to check to make sure that the ...\FDS\FDSPro\ folder exists.

    If that path doesn't exist, add code that will create the ...\FDS folder, and then the ...\FDS\FDSPro folder before proceeding with any code that tries to access files.


    Regarding this:

    For some reason, I fine very little Concise information in Book form that would fully explain how to accomplish everything I want to do.
    Welcome to programming. There wouldn't be enough trees in the world to produce the paper necessary to contain an exact explanation of how to write every possible program anyone could ever want to write.

  33. #33
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,091

    Re: Setup Installer Errors

    Quote Originally Posted by BasicBasic View Post
    I have just thought. I used: fileOUT = IO.File.CreateText(GetFullFilePath("FileStartup.txt")). Do I need to add the additional directory folders here as well?
    Once you have added the additional folder names inside GetFullFilePath, you don't need them when you are using GetFullFilePath.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width