Hi,
I use a component (System.ComponentModel.Component) and I want to get the application path of my project in order to create a file within it.
Thx
Florian
Hi,
I use a component (System.ComponentModel.Component) and I want to get the application path of my project in order to create a file within it.
Thx
Florian
Does this work?
New Uri(Assembly.GetCallingAssembly().CodeBase).AbsolutePath
("CallingAssembly" because you can put the method to retrieve the execution path into the service layer (assembly))
Take a look at: http://stackoverflow.com/questions/723172/project-bin-folder-path-at-compile-time
With this technique you could "Build" (once) and after that use the generated file to get the project location at DesignTime. This would work workspace independent.
I think Robert is almost right.
This seems to work:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)