Environment.CurrentDirectory giving program files path - vb.net

I would like to get path of my current running project and then go one folder up then being there go to MyFile.cfg. I tried to get that path using:
Dim currentprojectPath= System.IO.Path.GetDirectoryName(Application.ExecutablePath)
unfortunetly i get strange path:
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW
Solution tree:
Configs (folder)
ConfigX (folder)
MyFile.cfg --> file i want to read path of
UnitTestProject (folder) --> running project folder

Related

Change output of Visual Studio Application (app.config not in root directory)

I have developed an application, which has an assembly ( .dll ) which I would like to locate under a /bin directory, and not in the root directory itself. So I changed the app.config, that it also looks into sub folders, this works fine.
But with this change I have a .exe.config file in the root directory, is it possible to move this file also, or is this impossible?
I would like to have only the .exe in the root folder, and some directories, but no other files.
Thank you
Regards

Visual studio C++ relative path

In Visual studio C++/Cli, relative pathes are relative to what? Which directory is equivalent to "." ? For example, if the solution file is at "C:\dir1\project.sln" the where is "."?
At runtime, relative paths are relative to the working directory that the application was started with.
When you run from Visual Studio, the working directory is where the project file is located.
When you double-click an exe in Windows Explorer, the working directory is generally the same as where the exe is located.
From the command line, you can have the working directory be anything: navigate to the directory you want to use as the working directory, and run your exe by typing the full path.

Getting the relative directory of a folder in bin/debug in VB

I am currently working on a windows Application project. I have a folder named "documents" in bin/debug that contains subfolders while the subfolders contains word document files.
When I click and drag the "documents" folder, i got a complete C:\Users\Satellite\Documents\Visual Studio 2010\Projects\WindowsExplorer_VB\WindowsExplorer_VB\bin\Debug\documents. What I want is to get the location of the folder in bin/debug so that the application can read from the directory when installed on a different machine..
Any help...
Try this:
Dim docPath As String = Path.Combine(My.Application.Info.DirectoryPath, "documents")

Set root directory for project in Visual Studio 2012 Solution Explorer

Visual Studio 2012's Solution Explorer can be configured to display the actual files on disk (rather than just project files) simply by toggling the Show All Files button. Each project will display the files and folders located in the same folder as the project file itself.
Is there any way to change the root directory of what is displayed?
My cross-platform project is organized like this:
project/ide/vs2012/project.sln
project/ide/vs2012/project.vcxproj
project/src/*
I want Solution Explorer to show the files in my src directory, not my vs2012 directory.
I created a symbolic link under the vs2012 directory to point at my source code:
MKLINK /D src ..\src
Now Visual Studio sees the src folder underneath the project.
I think, if I understand correctly, you should open up the .sln file at the project's root in a notepad application and you'll find what you're looking for in there.

How can I filter which files are included in a workspace using MSBuild?

It seems that MsBuild creates a folder called, "BuildType" on the build server and this folder is where the .proj file is copied. In source control I have several files that are in the same folder as the build project file. I have a workspace mapped to this location.
I would like to be able to specify explicitly which files from this workspace location should be copied to the build machine. Is this possible?
Thanks!
You cannot do this on file level but if you organize your build type folder with subfolders you can cloak the folders that you want to exclude.