Visual studio C++ relative path - c++-cli

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.

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

Adding a folder with files to application - Visual Basic 2010

In my current project I have a folder with several files that the application needs to function properly. The folder is in the bin/debug folder and with the line Application.StartupPath I can easily access the files. It couldn't be easier.
However, when I publish the application the files don't seem to be included in the project, at least not at the StartupPath.
So my question is: how am I supposed to add this folder to my published application?
First, you'll need to include those files in your project. Then click each file in the Solution Explorer and in the Properties Windows change the value for "Copy to Output Directory" to "Copy Always".

How to copy dll config files into bin folder while publish in Visual Studio 2013?

I am working on a web application that use some external dll with config files, such as Lib1.dll, Lib1.dll.config, etc. Basically these files are manually copied into bin folder and only got loaded at run-time.
I tried to add those dll as reference and am able to copy these dll files into bin folder, but how can I deal with those config files? Is there a way I can include these config files in solution and force them copy to bin folder when using Visual Studio publish?
Please help, Thank you.
You can include the files into the project in Visual Studio, and change the file property "copy to output directory" (in "Properties Window") to "always" or "copy if new".

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.

MSBuild - Nest an external file (file outside of the project folder) into a file in the project folder

I have the following scenario:
I have 2 projects:
Proj1
Proj2
Each of these projects needs access to a similar service (FooService) so I wrote up the Foo.svc and Foo.svc.cs files and put them in a directory that was outside of both of the project directories.
I then edited my Proj1.csproj file to do the following:
Foo.svc
This works fine in terms of editing and compiling the code, however I can't access the service: http://localhost/Proj1/Foo.svc << This does not exist (because the actual Foo.svc file is not in the Project directory).
So instead I copied the Foo.svc file inside each of the Projects and just left the code-behind file (Foo.svc.cs) in the common directory. However, now Visual Studio complains that "The parent file, 'Foo.svc', for file '..\Common\Foo.svc.cs' cannot be found in the project file. Probably because it is looking for the 'Foo.svc' file relative to the code-behind file?
Foo.svc
Is there any way to do what I'm looking for... keeping the code-behind outside of both project directories (so they can both link to it) and somehow have svc files that are accessible in my IIS on localhost and have it so that the code-behind file folds into the svc file in Visual Studio?
What you're talking about is altering your MSBuild file (also known as a csproj file - http://msdn.microsoft.com/en-us/library/bb629388.aspx)
I tried to simulate what you're doing and I don't think there is a solution that would fit what you want. You're right, your project will work just fine, but aesthetically you can't have a file external to the project directory nested to a file inside of the project directory.