Solved

getting the full path of my vb.net app

Posted on 2010-08-24
8
595 Views
Last Modified: 2012-05-10
Hi,

I'm trying to map a path to my file, it is looking for the bin folder of my app which is fine but at the moment I have to put the really long directory structure before the file name.

How can I say some sort of system.app path:
xsltrans.Transform("C:\Documents and Settings\someuser\My Documents\Visual Studio 2008\Projects\DespatchNotePrinting\DespatchNotePrinting\Test.xml", "C:\Documents and Settings\someuser\My Documents\Visual Studio 2008\Projects\DespatchNotePrinting\DespatchNotePrinting\Results.html") ', resolver)
0
Comment
Question by:scm0sml
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 7

Expert Comment

by:Alex_W
ID: 33509488
System.AppDomain.CurrentDomain.BaseDirectory() & "FileName.xxx"
0
 
LVL 7

Expert Comment

by:Alex_W
ID: 33509509
Or
Application.StartupPath + "\File.xxx"
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 33509519
The installation path can be found with My.Application.Info.DirectoryPath

Wayne
0
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

 

Author Comment

by:scm0sml
ID: 33509547
ok i think i have given you the worng info. i dont want to be hitting th bin folder i dont think.

Just the root level.
Basically I have an xslt file at the same level as all my other pages in the app so want to hit this directory...?

Thanks
0
 
LVL 7

Expert Comment

by:Alex_W
ID: 33509610
Oh, Application.StartupPath will pickup the same location as the .exe.  I suppose you could take a substring of the resulting location and remove "\bin\Debug" from the end but this will get confused when running the .exe from another location once deployed.
0
 

Author Comment

by:scm0sml
ID: 33509701
why doesnt a copy of the xslt file get put in the same place then?

I need this to be able to run when deployed.....?
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 33509770
Personally I wouldn't put the XSLT file in the same folder as the EXE. I would put it in the Application Data path.

My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
http://msdn.microsoft.com/en-us/library/2zbz2kdb%28VS.90%29.aspx

Wayne
0
 
LVL 23

Accepted Solution

by:
Snarf0001 earned 500 total points
ID: 33510344
"my other pages in the app ", what kind of app is this?  I think we've all been assuming it's windows not web, please correct if that's not right.

If windows, keep in mind that when its deployed, the ONLY content you'll have available is what's in the bin folder, that will be the root (apart from anything you put into appData as webtubbs has said).

So you just need to get the xslt into the bin folder:
Right click the file, go to properties, and change the "Copy To Output Directory" from "Do not copy" to "Copy if newer".
Then reference it with Application.StartupPath as Alex said.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question