473,503 Members | 8,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

My.Application.Info.Directory wrong path (Urgent please)

9 New Member
Hi there ,

I have used app.path in VB6.0 and it gives me exact location of my VB Application that is on client pc normally it is C:\Program Files\ProductName and on my PC it is C:\Development\VB.
Using VS 2005 (VB) i am getting this kind of path :


C:\Documents and Settings\azia\Local Settings\Application Data\assembly\dl3\30YRGKJ9.HZC\74ELH8JC.ZZX\2722e3 ac\e67c828d_2b80c701



and my application is trying to find a particular file and obviously it won't be able to find this file in there.

and i actually wanted to get the exact location of the VB application (VS2005)

can anyone please help me in order to provide the similar thing like app.path (VB 6.0) in VB.NET

Thanks,
Asim.
Apr 16 '07 #1
13 5906
fauxanadu
60 New Member
in VB.NET, when you debug a program or build a program, it puts it in a directory such as bin/debug/yadayada. You can change this behavior in the My Project file of VB.NET... double click it and change the debug and build paths to the directory where the files they need to locate are located
Apr 16 '07 #2
asimzia
9 New Member
Hi,
Thanks for your reply. I have already tried that and it doesnt seem like its helping.

Thanks,
Asim.
Apr 16 '07 #3
fauxanadu
60 New Member
I have found that sometimes it works and sometimes it ignores the settings as well. When it ignores the settings your best bet is to just move the external files to the directory where it is intended to be. If you do not know where it is trying to run the program from, have a messagebox spit out the string for the path to the application and copy the files there. Let me know if this works. If not i'll look deeper into the issue.
Apr 16 '07 #4
Killer42
8,435 Recognized Expert Expert
Found this in the usenet archives. Don't know whether it will help or not...
Expand|Select|Wrap|Line Numbers
  1. Private Function ApplicationPath() As String
  2.   Return _
  3.   Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
  4. End Function
Apr 17 '07 #5
asimzia
9 New Member
I have found that sometimes it works and sometimes it ignores the settings as well. When it ignores the settings your best bet is to just move the external files to the directory where it is intended to be. If you do not know where it is trying to run the program from, have a messagebox spit out the string for the path to the application and copy the files there. Let me know if this works. If not i'll look deeper into the issue.

Thanks very much, let me have a look and i will let you know.

Thanks once again.
Apr 17 '07 #6
asimzia
9 New Member
Hi,
Thanks for your help, the thing is it is creating a required file in that strange location and picking the file information from there as well. My question is why it is not giving me the path which is actually the location of the product. I have installed my product on a test pc and its location is

C:\Program Files\My Product

So when i wanted to have this path (which is my application path), i should get this folder, so i can copy the file over to this folder. But when i am trying i am getting this path even on my pc (which is a development pc) and something to similar to this on test pc as well.

One thing i wanted to ask you is why my all assemblies (.NET one and interop ones) are copied into this path which is defined below:

C:\Documents and Settings\azia\Local Settings\Application Data\assembly\dl3\30YRGKJ9.HZC\74ELH8JC.ZZX

and in the above defined path i have all my assemblies in different folders and each folder hold one assembly file with one inf file which tells you the path of the actual folder.

If you see this will become bit harder, if i installed my product on test pc for everyone who uses that machine using Administrative privileges and logged on with other user and tried to run it will give me an error coz the folder azia (user) is only accessible by the user itself.



Do you think i am doing something wrong, how can i configure these path settings, i am bit confused as in VB6.0 there is nothing like this i just used the simple procedure which uses app.path which gives the location of the Folder. Please if you can tell me further on this , then i will be really greatful to you.

Thanks for your time and your help.
Asim
Apr 17 '07 #7
fauxanadu
60 New Member
I think the issue might be that VB.NET stores new projects in a folder based on your windows user name. There is an option that allows you to change the default location that VB.Net stores the projects in. If this is not the problem, please give me the following pieces of information so I can try to figure this one out:

Code Snippet you are using
Build Output from a standard debug build
Start a new project and let me know what the Application Directory is

Also, if you could clarify something: Does the path it save it in change everytime you build the application?

Sorry this is taking so long, but it is an odd error
Apr 17 '07 #8
asimzia
9 New Member
When I create a new project which is Extensibility based, it gives me exactly the path which is my development folder (C:\Development\VB.NET), So i think this is not the case.

The path is not changing it will seems like it is same everytime and always go to this path when i try to use My.Application.Info.Directorypath :

C:\Documents and Settings\azia\Local Settings\Application Data\assembly\dl3\30YRGKJ9.HZC\74ELH8JC.ZZX

I have also attached the code snippet and tried to attach build output from debug but it doesnt allow me to add, so is there any possibility i can email it to you, what i have done is i have copied and pasted the top few lines and the few lines from the end of the output build.

Thanks for you help and support.


Code Snippet:
Expand|Select|Wrap|Line Numbers
  1. If VB.Right(AppPath, 1) = "\" Then
  2.                 m_sApplicationPath = My.Application.Info.DirectoryPath 
  3.             Else
  4.                 m_sApplicationPath = My.Application.Info.DirectoryPath & "\"
  5.             End If
  6.             sLicFileName = m_sApplicationPath & m_sLicName
  7.  
  8.  
  9. ------ Rebuild All started: Project: MMSJrnEx, Configuration: Debug Any CPU ------
  10. C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\LC.exe /target:MMSJrnEx.dll /complist:"My Project\licenses.licx" /outdir:obj\Debug\ /i:"C:\Program Files\ComponentOne Studio.NET\bin\C1.Common.dll" /i:"C:\Program Files\ComponentOne Studio.NET\bin\c1.win.c1sizer.dll" /i:"C:\Program Files\ComponentOne Studio.NET\bin\C1.Win.C1TrueDBGrid.dll" /i:..\ExcelUtils.NET\bin\ExcelUtils.dll /i:..\OfficePIAs\Interop.Excel.dll /i:..\OfficePIAs\Interop.Office.dll /i:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  11.  
  12. \Microsoft.VisualBasic.Compatibility.Data.dll /i:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.VisualBasic.Compatibility.dll /i:..\SageMMS1\Sage.Accounting.Financials.dll /i:..\SageMMS1\Sage.Common.dll /i:..\SageMMS1\Sage.ObjectStore.dll /i:..\SageMMS1\Sage.Utils.dll /i:..\OfficePIAs\SKCLNET.dll /i:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
  13.  
  14. EmailLicence.designer.vb EmailLicence.vb ErrorHandling.vb frmPostingOptionsBrowse.Designer.vb frmPostingOptionsBrowse.vb frmAccountBrowse.designer.vb frmAccountBrowse.vb FrmBrowse.designer.vb FrmBrowse.vb frmBrowseCalendar.designer.vb frmBrowseCalendar.vb frmCompanyList.designer.vb frmCompanyList.vb frmLic.designer.vb frmLic.vb frmLicUnlock.designer.vb frmLicUnlock.vb frmLogon.vb Globals.vb LicenceMethods.designer.vb LicenceMethods.vb LicenseLocation.designer.vb LicenseLocation.vb LoginDetails.vb MMSJournal.vb MMSJournalDetail.vb MMSJrnErrors.vb MMSJrnEx.vb MMSJrnRangeNames.vb MMSJrnRanges.vb "My Project\AssemblyInfo.vb" "My Project\Application.Designer.vb" "My Project\Resources.Designer.vb" "My Project\Settings.Designer.vb" PPPFunc.vb Progress.designer.vb Progress.vb
  15. ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
  16.  
  17.  
Apr 18 '07 #9
asimzia
9 New Member
Hi There,

Any further progress to this problem, please let me know because i have to release my application as soon as possible.

Any help will be really appreciated.

Thanks,
Asim.
Apr 19 '07 #10
Killer42
8,435 Recognized Expert Expert
Hi There,

Any further progress to this problem, please let me know because i have to release my application as soon as possible.

Any help will be really appreciated.
Have you checked MS's VB6 -> VB.Net upgrade info? It does seem to cover a lot of the differences, perhaps this is one of them.
Apr 19 '07 #11
asimzia
9 New Member
Hi There,
Thank you very much for your support and time, i was searching on internet i found this :

System.AppDomain.CurrentDomain.BaseDirectory()

It seems like it is returning the required path on my machine (development), i just have to test this thing on the deployment machine, hopefully it will work.

I will let you know guys, but thanks very much for every single thing you told me to try.

Thanks,
Asim.
Apr 19 '07 #12
asimzia
9 New Member
Hi,

Yes it works.

Thanks again.
Asim.
Apr 19 '07 #13
Killer42
8,435 Recognized Expert Expert
Yes it works.
Thanks again.
Excellent! :)

I'm glad to see you resolved the problem, and hope we were some help.
Apr 19 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

9
647
by: Steve Buster | last post by:
All right, I have read every forum, newsgroup etc about this issue and no one seems to know how to fix it. I am getting a "Server Application Unavailable" exception running my .NET 1.1...
2
1362
by: Martin | last post by:
Hi, I have implemeted a recursive function that basically iterate throught the entire file system and prints out the entire path of each directory that it come across. The only problem is the...
7
6660
by: Ralf Gedrat | last post by:
Hello! I have some Vb.Net applications, which are terminated at indefinite times without message. If I call in the program regulated system.GC.Collect, then the program is terminated here...
7
6112
by: Steven Cliff | last post by:
I have started to use the new Enterprise Library (Jan 06) and have set up a skeleton project using the DAAB. This all seems to work fine apart from when I come to secure the app.config file via...
12
6031
by: Martyn Fewtrell | last post by:
Hi there I'm trying to find the correct way to write exceptions to the Application log using Vb.Net. I've done a fair bit of Googleing and although this gets plenty of mentions and that this...
4
2865
by: =?Utf-8?B?VkIgSm9ubmll?= | last post by:
I am at my witless end here, please help! I have an ASP.Net aspx web page, hosted on Windows Server 2003, that receives a query string with the path to an autocad drawing file selected from a...
2
2419
by: Learning.Net | last post by:
hi , I have a application which reads files, directory,and its version and version information is written to text file.Its working fine if files in directory are less but problem arises when no...
10
3736
by: AG | last post by:
I am trying to use a ReportViewer control in a VS 2005 web application project (not Website project). When I try to create a new report (local), I can't seem to find any method to create a...
5
1420
by: Oriane | last post by:
Hi, I'm developinf an Asp.Net 3.5 site on W2k3, and I use a Web application Visual Studio 2008 project. This Web app is configured on IIS 6 as an "application" under a web site. When I start...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.