471,071 Members | 969 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

How do I get project folder in .NET?

How do I get project folder in .NET?
Nov 20 '05 #1
5 7341
* "astroboy" <da****@ddadde.com> scripsit:
How do I get project folder in .NET?


Are you referring to the application path?

\\\
Imports System.IO
Imports System.Reflection
..
..
..
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
No not that I meant, I want to retrieve Project Folder or application path
location at compile time. If you go to Project-> xxx Properties->Common
Properties ->General
You would see Project folder, project file and output name in there, I would
like to get those infomation

Thx
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "astroboy" <da****@ddadde.com> scripsit:
How do I get project folder in .NET?


Are you referring to the application path?

\\\
Imports System.IO
Imports System.Reflection
.
.
.
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location)
End Function
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
hum strange
what do you want to do with that info?
but here some code you can use
you have to dig in it, won't do exactly what you need, but it's already a
part of it
Imports EnvDTE 'add reference:
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\envd te.dll"

Public Class Class1

Public Shared Sub main()

Dim DTE As EnvDTE.DTE =
System.Runtime.InteropServices.Marshal.GetActiveOb ject("VisualStudio.DTE")
Dim vbProjects As Projects = DirectCast(DTE.GetObject("VBProjects"),
Projects)
Dim aProject As Project
For Each aProject In vbProjects
MsgBox(aProject.FullName)
Dim x As System.Collections.IEnumerator =
aProject.Properties.GetEnumerator()
Dim pr As [Property]
Dim msg As String = ""

While (x.MoveNext)
pr = DirectCast(x.Current, [Property])
msg &= pr.Name & vbCrLf

End While
MsgBox(msg)
Next
End Sub
End Class


"astroboy" <da****@ddadde.com> wrote in message
news:OC**************@TK2MSFTNGP10.phx.gbl...
No not that I meant, I want to retrieve Project Folder or application path
location at compile time. If you go to Project-> xxx Properties->Common
Properties ->General
You would see Project folder, project file and output name in there, I would like to get those infomation

Thx
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "astroboy" <da****@ddadde.com> scripsit:
How do I get project folder in .NET?


Are you referring to the application path?

\\\
Imports System.IO
Imports System.Reflection
.
.
.
Private Function ApplicationPath() As String
Return _
Path.GetDirectoryName([Assembly].GetExecutingAssembly().Location) End Function
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #4
Cor
Hi Dominique,

Change the tittlebar of his project I think

:-)))

I really do not know otherwise I had answered you of course, but could not
resist this one.

Cor
Nov 20 '05 #5
well he was lucky, found that stuff while searching info to make my
windowtitle change
somewhere there is a MainWindow.Caption property which is the windowtitle of
visual studio

reading goes well but setting the property throws an exception
found some info where i read between the lines you can only read the caption
property for mainwindow
(for other windows it should work)

so i'm doomed i think

"Cor" <no*@non.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi Dominique,

Change the tittlebar of his project I think

:-)))

I really do not know otherwise I had answered you of course, but could not
resist this one.

Cor

Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Vagif Abilov | last post: by
1 post views Thread by Frank Rizzo | last post: by
4 posts views Thread by g4356 | last post: by
reply views Thread by leo001 | last post: by

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.