Add a bunch of non source code files to a vcxproj - visual-studio-2010

I need to add a folder containing lots of Qml files into a visual studio project. (The folder has subfolders and I want to add every thing to the project)
I tried to drag & drop from Explorer (and with the "Show all Files" way) to add the containing folder but this ways work only for source files (.cpp, .h, ...)
Do you know how to add easly lots of non-source-code files into a visual studio project ?

Related

Visual Studio: How to add linked item between folders within the same project?

I'd like to share a common .targets file between different folders within the same project (using Visual Studio 2015):
MyProject
MyNupkgContent1
build
MyNupkgContent1.props
Common.targets
MyNupkgContent2
build
MyNupkgContent2.props
Common.targets <-- should be added as link
When I try to "add as linked" Common.targets to MyNupkgContent2/build, the dialog closes but does not actually add the link. Adding files as links from a different project works fine. Is it possible to link files between folders in the same project?
I'm not certain as to how you should go about linking it but depending on contents and size of application, your best bet may be simply going into your packages and manually copying + pasting them into MyNupkgContent2

How can I use files in one project to create a library in another project in Visual Studio?

I have a standalone project that contains some code I'd like to re-used. I created a library project in order to contain that code. There does not appear to be a way to move files from the one project to the other. (cut/paste in solution explorer did not work)
I then manually copied the files in Windows explorer (outside of VS) into the library's main "folder" but they didn't show up in solution explorer either.
Anyone know of a way to do this without having to manually create each file in the library and then copying/pasting the code into the files?
You need to copy the files and paste them into your solution/project folder(s). Once the files physically exist within your solution/project folder structure (Windows FileSystem / Explorer), then you right-click on your project within Visual Studio, select Add then Existing Item. Browse to the location of that file and open it. It will now exist within your project as a code file.
If you have two projects within the same solution, you can simply drag the file from one project to the other within Visual Studio Solution Explorer. That will create a copy of the class in the new project. You can then remove the old one and clean up any code references in the first project.

Keep source files in an external directory in Visual Studio/C++

Is there any way to instruct Visual Studio 2010 to keep my .h files and .cpp files separate from the project files and databases that VS generates to manage the project? Specifically, I would like to have a set up where the project files are in the VS install folder and the source files are in a completely separate folder in my Dropbox, and monitored by git.
You can put the .cpp and .h files wherever you want. A project file just lists the locations of the source files. Create the .cpp and .h files where you want them, perhaps with Notepad, and then use "Add Existing File" to add them to the project. (Right-click on the project name in Solution Explorer and choose "Add Existing File".)
Source files are represented in the project file using relative paths, so if both the sources and the projects are on the same disk drive, the sources will be represented something like "..\..\..\..\MyFiles\work\SuperCalc\Input\parser.cpp". If they're on a different drive, then they'll use absolute paths like "D:\MyFiles\work\SuperCalc\Input\parser.cpp".
A detailed example of a source file and build file layout which uses this technique is presented in this StackOverflow response about organizing Visual C++ source files. You may find it helpful.
As an aside, if you really want to store your project files in the VS install folder, which is under C:\Program Files\Microsoft Visual Studio 10.0", then you'll need to run VS in Administrator mode, because C:\Program Files is a protected directory.

adding multiple existing folders and multiple existing files to Visual Studio project in single step

Does anyone have a way to add multiple folders and (existing) files within those folders to a Visual Studio project in a single step (or via macro)? Let's assume all of the folders and files were copied/pasted into the project folder where they need to reside relative to the project folder, but are not actually stored in the .csproj or .vbproj file, which I believe is a requirement to compile those files into the solution/project.
This works great if you have a web application project in your solution, but not so well if you have a .csproj or .vbproj. In that case, you must manually add folders (and nested folders), and add existing files and browse to each one individually, which can take a long time.
In the solution explorer, select the project, click the "Show All Files" button - .
This will show all the files, even those not part of the project. You can now select all of these in the solution explorer (using Ctrl + Click) then right click and go to "Include In Project".
In Visual Studio 2013 (and possibly earlier) you drag the folder from windows explorer and drop it on the project in the solution explorer.
Other answer given in this thread wouldn't work for me as the files I want to add (DTSX files) are in a different folder, and copying/moving them causes other problems. Here is what worked for me:
Using Visual Studio 2015, use Windows Explorer to locate the files you want to add to your project. Copy those files to the clipboard. If DTSX files are what you are dealing with, in the Solution Explorer right-click on SSIS Packages, and then click on Paste.

Create visual studio solution template - multiple projects

I'm stuck on this tutorial for creating a multi-project visual studio template. I'm specifically stuck on this line:
Select the files and folders to include in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files and folders are compressed into a .zip file.
I did the following steps:
Create 2 projects. (MyProj.Web and MyProj.Service)
Reference MyProj.Service in MyProj.Web.
Export both. They are now in a .zip file.
What do I do from here?
My intentions are: Make solution folders where some dlls will be (DI, unit testing frameworks, etc). Have these dlls referenced. Reference projects in other projects. Rename part of the projects. For eg. the ability to replace {MyProj}.Service with NewName.Service
The other parts includes making the .vstemplate xml file and placing the zip in the ProjectTemplates.
Per the article:
Put the .zip template file in the Visual Studio project template
directory. By default, this directory is \My Documents\Visual Studio
2010\Templates\ProjectTemplates\
The Visual Studio template will then be available from File > New Project. If making a template for a single item, place it in the \ItemTemplates folder instead to make it available from the Add New Item context menu in Solution Explorer.

Resources