I am building a "Solution" consisting of many small "Projects" within VS-2015.
To ensure consistency, I would like to set Project preferences such as additional include directories, additional libraries and platforms from one location or copy from one project to the next.
Could you please point me to a document that describes this?
Thanks in advance.
Since all projects are based on MsBuild, you can create a single targets file which sets the properties you want to sync across your projects. You can then import this targets file in every one of your project files.
To add a targets file you'll need to edit the csproj file directly (Unload project, edit project file in VS or through a 3rd party editor).
There are also some options like Directory.build.props and Directory.build.targets files, in Visual Studio 2017 these are automatically imported during your build and that gives you the advantage of not having to edit the project files. This may require MsBuild 15, which ships with Visual Studio 2017.
Some Visual Studio UI will be able to show the current value of certain properties, but editing them in the UI will pull these values back into to project files. This is an unfortunate behaviour of Visual Studio.
For all options to import targets files see:
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2017
Related
I'm building a project that includes my own source code, but also includes a number of thirdparties e.g googletest. I'm including third parties as source and adding them to my own CMakeLists.txt (via add_subdirectory) file so they get built alongside my libraries.
Is it possible to exclude the thirdparty projects from the generated Visual Studio solution? I don't want developers of my own code to see the thirdparty projects/source when they open the solution, I just want it there at build time.
I'm aware I can move them so a separate folder in Visual Studio using the FOLDER property, but ideally don't want them showing at all.
I needed to build my software for several different platforms using Microsoft Visual C++ 2010 and MSBuild. I added the platforms to the $(VCTargetsPath) directory and created the .props and .targets files. I then copied the files to my configuration management repository, defined a path to the parent directory for the copied files: $(CM_REPO_PATH), and wanted to redirect visual studio to use the files in the repository.
I am able to get the project to work when I create an environment variable on my machine called %MSBuildExtensionsPath% and point it to $(CM_REPO_PATH)\MSBuild. What I want, though, is to set the $(VCTargetsPath) and/or $(MSBuildExtensionsPath) within the visual studio project, not in an environment variable on every developer's machine.
When I add the property group to do this...
<PropertyGroup>
<VCTargetsPath>$(CM_REPO_PATH)\MSBuild\Microsoft.Cpp\v4.0</VCTargetsPath>
<MSBuildExtensionsPath>$(CM_REPO_PATH)\MSBuild</MSBuildExtensionsPath>
<MSBuildExtensionsPath32>$(CM_REPO_PATH)\MSBuild</MSBuildExtensionsPath32>
</PropertyGroup>
...the new platforms are not available (as if the project is still using the default $(VCTargetsPath), rather than the one specified). Is there a way to override the $(VCTargetsPath) from the project file?
Your initial statement is, that you want to build your project for a number of different platforms.
https://learn.microsoft.com/en-us/visualstudio/extensibility/visual-cpp-project-extensibility?view=vs-2017 describes in very much detail, how to achieve this in Visual Studio 2017. Hopefully the same is true for the version you are using.
The good thing about this is, you don't need to alter $(VCTargetsPath) at all.
My IDE is Visual Studio 2010. I have a solution (.sln) containing more than 100 Projects (.vcproj). The language is C++. The solution has two configurations: "Release" and "Debug". The solution has two Platforms "Win32" and "x64". I need to create a third configuration, let's call it "Release_and_PDB". "Release_and_PDB" should be equal to "Release" except in that it should generate the PDB files. In the future "Release_and_PDB" should be always equal to "Release" except in that it should generate the PDB files. I think I can do it in three steps:
Create a new Configuration.
Manually change every project property adding the path and name for the PDB (in Linker, Debugging, Generate Program Database file).
Ensure that a property change in the Release will also reflect the same change to the Release_and_PDB configuration
My questions:
a. Does Visual Studio have any facilities to get the step 2 done without the need of manually changing the properties of any (and every) project?
b. Does Visual Studio have any facilities for the inheritance of project properties to get step 3 done without the need to also manually change the property in Release_and_PDB?
You go to configurations manager in the toolbar -> new -> copy settings from.
I think that's what you're looking for.
Is it possible to add visual studio macros to a solution, so they would be checked in by svn ?
If not, how do you deploy your utilities/scripts with your developer team ?
Unless I'm mistaken, VS Macros are stored in a .vsmacros file as selected when you created the Macro project (I think the default location is C:\Users\yourname\Documents\Visual Studio 2010\Projects\VSMacros80), so just copy that file to your project's directory and add it to the project with no build action and you should be all set.
But that's just if you want to use those macros only with that project, most macros are useful in many projects and if so I'd recommend keeping them where they are rather than in the folder of just one project, and then just add the .vsmacros file manually to subversion to some suitable location (suggestion would be a Tools folder) and check in and out manually when needed.
Can someone briefly explain to me the difference between Visual Studio's solution file (.sln) and project file (.vcproj).
It seems to me opening either one open the correct solution/project in Visual Studio. Is one the super-set of the other?
Note: I am currently using Visual Studio 2008 working on a project that was brought forward from Visual Studio 2005 (I believe).
A solution is a set of projects. If you need more than one project in your software, then go with solutions. I.E.: A Class Library Project + A Web Application Project.
A project file typically corresponds to a single module: EXE or DLL or LIB. A solution manages a collection of project files.
A solution is a collection of projects. Visual Studio is made so that it cannot function without a solution, so if you open a bare project, it will generate the solution automatically (or try to find one).
One solution can contain zero or more projects. Everything is in projects, so a solution with zero projects doesn't contain anything at all besides the solution properties.
Visual studio keeps track of where the projects are used, so if you open a project file, it will open (IIRC) the last solution where it was used.
When you create a project from scratch, a solution is also created, but it's not shown until you add another project to it. It looks like you have only the project open, but it's actually a solution containing the project that is open.
Specifically project files are intended to contain the data required to build the files in the project into an exe or dll. This file is utilized by the local compilers or with systems such as Team Foundation system and server side build agents.
Solutions are a client (IDE) construct designed to manage collections of projects, which in effect is a collection of different build definitions and associated files.
Solution files are typically made up of multiple project files.