How to change working directory in Visual Studio - visual-studio-2012

How can I change the working director of Visual Studio C++ 2012. The default working directory is $(ProjectDir), every file I create in my codes are created in the project directory. What I want is that every file is created in the source code's directory, is that possible?

There is no convenient way to do it, but there are some workarounds.
One solution is to move project file to source directory.
Another solution is to add whole source directory to project (just drag'n'drop directory from windows explorer to project in solution explorer). Now, you can add items by right-clicking at source directory in solution explorer. They'll go to physical source folder. This surely works on Visual Studio 2013 RC, but I'm not quite sure about Visual Studio 2012.
One more solution, is to create Project Wizard or even Plugin. It's along story. Maybe, someone already done this, but I was unable to find.

Related

Project Solution(.sln) is creating in C:/ drive but project created in another drive, how to change the default .sln file saving drive?

My OS is Windows 7. In my Visual Studio 2012 when I'm creating any project or website the solution file(.sln) is creating over default VS folder in C: drive. So when I'm trying to create a project in another drive folder, the solution is not in same folder with the project. How can I change it so that solution file will be in the same folder?
There is a check box 'Create a directory for solution' when you create new project, uncheck it.
To fix existing solution remove project from solution place all file in solution directory re-add project to solution.
To fix existing solution, just close it, move all project folder contents into solution folder, open sln file with text editor and fix project path.
right click on .sln file.
go to properties then click on change, then select visual studio icon.
sln file icon would be same as VS icon, hence problem get solved.

What is the extension of a Android Studio project file?

What is the Android Studio equivalent of Solution file in (.sln) file in Visual Studio ? I created a project in Android studio and closed it. Now I am not sure which file should I open to reload it into Android studio.
Use the import project function on the build.gradle file in your project root (not the folder itself!) to open the project again in Android Studio.
I think ".iml" is the extension for Android studio projects.
".project" is for Eclipse projects
Opening a saved project on another drive
There is no such single project file that needs to be opened but rather the directory where the whole project is stored.
Find the directory where you have saved your project
In Android Studio -> Files -> Open->(click on the directory name where your files/project is stored)
Except using android studio unique method(import), you can also double click .iml file to open corresponding project.
If you using Windows operating system, you could right click .iml file in file explorer, and select studio64.exe to open it, then android studio start the project!
At least in the version I have, like intellij the "android studio project files" are stored in a folder called '.idea' in the root of your workspace (though you can explicitly create one that looks up the tree and have it not be in the root).
If you add this folder to source control, do not add the file "workspace.xml" as that is the state of the window positions on your machine and should remain local, checking it in will cause lots of confusion.
If this directory is present, android studio will give the containing folder an android studio icon in it's open file browser window in the windows version. You can click on the directory with this icon in intellij (android studio) and open the project.
In Windows, Click at projectname.iml under project directory root. If window is not does not have the .iml file association with Android Studio, you need to add it.
When you select File->Open in Android Studio and navigate through folders, you will notice that folders which consist valid Android projects would have the Android Studio icon, clearly indicating that this is all you have to select.
It is unusual approach in terms of normal behavior of programs under Windows, because since very first versions of Windows it's become accustom to be able to open a program by double-clicking on the file associated with such program, but I guess developers of Android Studio decided not to do that.
It is possible that ".iml" file could be associated with Android Studio but it doesn't happen by default and it's not associated on my computer neither.
I ran into this problem, after upgrading Android Studio to 3.0 on Mac. The previous projects I had created were not displayed, in the splash screen, during startup of 3.0, so what I did was:
1. Pick the option to Open a project
2. Navigate to the location where the project was previously saved (~/AndroidStudioProjects/projectFolder)
3. Select the folder (don't double-click it)
4. Click button: Open
5. Result: this opened the project.
So there is no need to select any particular file. I suspect the filer of this problem was double-clicking the project folder and then wondering what to select next, which is what I did, initially. But it turns out that the Open button is required, in order to open the project. Otherwise, Android Studio anticipates that your intention is to open the folder.
.iml file can be used to open the project directly into Android Studio (I am referring to Android Studio 3). Just goto your project folder and then double click on yourProject.iml file.
I know its late but better late then never :-)
Visual Studio uses one solution file. Android Studio does this different. It uses a directory for this purpose, namely the directory .idea in your project. In this directory several files make up how your IDE is configured for that project. The same as in Visual Studio. Those files can be edited and changed, but you will have to know what is what in those files.
I think the answer is .duh
Please see screenshot:

Importing an existing source file in Visual Studio 2012

I want to add the source-code of a tutorial into an existing project, and I want the file to be copied to the project folder from the temporary file on the desktop I downloaded it to. Context clicking on the "Source Files" Folder in the Solution Explorer leads me the Add->Existing Item... menu, and I can then add the source file. However, it is NOT copied into the project folder, but stays in its original location. The project just knows about it, displays it in the Solution Explorer, and considers it part of the project.
This help page on MSDN tells me that in Visual Studio 2010, default behaviour used to consist in copying the file into the project folder, and that one could choose to Add a link instead of physically importing the file into the project directory by choosing "Add Link". However, now I always only get a link, and real physical import into the project folder seems impossible.
I could go through the File Explorer to physically import, but the Solution Explorer doesn't update the new files on the fly, and I would like to do this from within VS.
Is there a way? Is this a bug in VS 2012?
Copy in the files using Explorer, then in the solution explorer tick the Show All files option in the button bar of the solution explorer (you might need to select a Project first).
You can now right-click any files not part of the projects and choose Include in Project.
Or use the Add Existing File option.
The reason files are not added automatically to your solution when pasted into the folder using Explorer is because you might not want to have them added.
A neat little trick is to use the "Open In explorer" option:
(though it might be added by the Productivity Power Tools).
Plus, you can Drag&Drop files directly from explorer to the Visual Studio (when they're both running in the same elevation level if you have User Account Control enabled). To fix the UAC issues, you can either run Explorer as administrator too or install the VSCommands extension.
And you can Copy&Paste a file or set of files into the solution explorer by right-clicking a project or project folder and picking Paste on the context menu.

What's this file in Visual Studio 2012?

It is not really existing in the folder of the project but somewhere else, is it a refrence file?
That icon displayed means its a file referenced from a folder outside the Solution. Visual Studio C# Solutions generally show the file system directory that project file is in. Files outside of that are shown as being linked in, or referenced, by that icon you see there. See Adding as a Link.

How do I add folders into the Solution Explorer for Visual Studio Express 2012 for Web?

I am very new to Visual studio, so I am trying to learn the basics.
I have read so many articles but some are for 2012, some are for the non-web version, etc, but I seriously can't find a solution to such a simple task as this.
I am using Visual Studio Express 2012 for Web, and have created a "Blank Solution".
I end up with this view:
Now my goal is to add all my existing files and folders and have it shown in Visual Studio.
So, I have located my solution file on disk and copied all my files into the same folder:
Now, I know its possible to add single items into the view by right clicking and picking add item:
But I cant include folders here. I have tried to drag and drop, I have read guides about using the "Show all files" button, but apparently that does not exist for the Web version of Visual Studio 2012.
Could anyone please tell me what the proper way is to include all my files into the solution explorer?
I just had this same problem in Visual Studio 2012 Ultimate. I know your question is about Web but maybe this will work for you too.
Assuming the files/folders you want to include are in your solution folder, from the Project menu toggle on "Show All Files", then you should see the files/folders in Solution Explorer. Select those you want to include, right click and choose "Include in Project".
A solution contains one or several projects and no solution-wide files (normally). Create a project, and then follow How do I add an existing directory tree to a project in Visual Studio? to add the files.
(It was a long time ago I did it this way, and with an earlier version of Visual Studio, so YMMV.)
I think that the best way to do it is to simply drag&drop desired folders with files between file explorer and solution explorer in VS. I've just tested it and that works the best for me.
You can place your files in the Solution folder and refresh the solution explorer :) It'll automatically add your files, I do it for 2010 and think it'll work for 2012 as well
In solution Explorer top toggle,You can find few icons, Find Show all files and click on it.Navigate to the folder exactly matching the same address in your visual studio and you can see a folder which is newly added into your project,Which is displayed as a dotted folder and right click on it and include it into project.
Don't forget to convert the project into Web-Application.
Thanks.
I actually found the solution.
So in solution explorer there is a button "Solutions and Folders" screenshot
When you pressed it your project folder would be opened. You find the folder that you need to add, copy it (screenshot), return to project solution and past it

Resources