• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 669
  • Last Modified:

How do i specify the "working directory" for shortcuts in Visual Studio Installer

The problem is when my exe tries to run, it cannot find my mdb file. I want to be able to add the app path in the shortcut's "Start In .." field (which is set to blank by Visual Studio Installer).
0
mixally
Asked:
mixally
  • 2
  • 2
1 Solution
 
supunrCommented:
two things.  One, you start your project in VB within the project folder. (i.e. you double click on the project file in explorer).  But I am not sure whether this will slove the problem.

Other option, which will work is to use App.Path along with your database name.  e.g.


Const DB_NAME = "MyDB.mdb"

Private DbPath as string

Private Sub OpenDBs()
    DBPath = app.Path
    if (Right(DBPath,1) = "\") then
        DBPath = DBPath & DB_NAME
    else
        DBPath = DBPath & "\" & DB_NAME
    End if
End Sub

Good Luck!
0
 
JRCSystemsCommented:
Here is a rule for file names and paths that if followed,
should solve your problems:

1. Drive Letters Should be a String * 2
   This allows for a: --> z:
   This also allows a verification of a UNC that starts
   as a "\\"

2. Paths contain Drive letters (or UNCs).
3. Paths should ALWAYS contain a trailing "\"
   IF you are unsure of whether a backslash is there,
   CALL the AddDirSep routine (See Below).

4. File Names are just that. File Names.
   You could use a CONST as suggested in previous example.

5. The concatenation of a PATH + FILE NAME is valid.

--------------

Public Sub AddDirSep (ByRef xsPath as string)

   If Right$(xsPath,1) <> "\" then
      xsPath = xsPath & "\"
   End If

End Sub

--------------

If you are still having problems, they may be related
to whether you are running in design-mode / "VB" or
running "real-time" compiled EXE.



0
 
mixallyAuthor Commented:
is this code i can type in visual studio installer?? how do i access the editor ?
                     
0
 
JRCSystemsCommented:
Ahhhhhhhhhhh! Now I see your problem.

Verify the installation setup to make sure you are not doing anything "weird". (sorry).

But when a normal installation program installs an program-link to an executuable, the "START IN" path is automatically setup to the installation directory.

If it is BLANK, somehow, you are overriding it.

Try a quick-and-simply setup, and don't make any changes to it... the "START IN" path should be filled in.
0
 
mixallyAuthor Commented:
the START IN still doesnt get filled in. let me tell you the steps i took to create the msi file:
Start->
  Programs->
    Micrososoft Visual Studio 6.0->
      Microsoft Visual Studio 6.0 Enterprise Tools->
        Visual Studio Installer

From here, in the New tab, I have Visual Studio Installer Projects folder selected (top left window)
At the bottom, the Name is: VBInstaller1
Below that in the Location I have: C:\Documents and Settings\Administrator\Desktop\VBInstaller1
I then proceed to the Visual Basic Installer icon on the right and double click it...

This presents me with a wizard. I click Browse and point to my vbp file and leave the preseleced radio selection of 'Create Installer'..then i click Finish.

Next, from the Project menu, I click Add File and select TAC.MDB which the executable needs as its database. This
adds the file to the Project explorer.
Next, I delete msado25.tlb from my project explorer since
this seems to crash when i run the installer. I dont
know how to fix this :(
Finally, i choose Build from the Build menu and this
creates a folder on my desktop called VBInstaller1.
Within that, is a folder called Output with some other files. In the Output folder i go to DISK_1 and within that
I get my msi file. When i try to install it (using defaults, nothing fancy), it adds a shortcut to my start menu but when i click the start menu item, i get the error:  "Could not find TAC.mdb"

Hope this makes sense
             
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now