Visual Studio 2010 ("Project Properties" dialog)
I've installed Visual Studio 2010 Ultimate and it has apparently imported the default directories for my Win32 C++ includes and libraries. Every new Win32 C++ project I create automatically adds my old include/library directories which screws up my build.
So my question is this: How can I edit $(IncludePath) in Visual Studio 2010?
or is $(IncludePath) specific to this project and only the result of the "Inherit from parent or project defaults" checkbox? (in which case the question turns into: How do I edit project defaults for that since it appears to be depreciated in Visual Studio options)
Thanks!
NOTE: The %include% environment variable is not defined in Windows. It does show up if you enter "echo %include%" in the VS2010 command prompt (not the Windows command prompt), but it's not the same values as what I'm trying to get rid of in the screenshots)
In VS2010, these paths are specified in one or more property sheets (the respective changes are discussed in an instructive article on the VS Project Team Blog).
You can add those yourself per-project, but the project also includes one specifying all the default values.
On my system it is located in C:\Users\<user>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props.
You can access it from Visual Studio by opening the Property Manager window (View->Other Windows->Property Manager), and then doubleclick the property sheet. You can also add property sheets yourself from this window (which will take precedence over the default one).
It is also perfectly legal to remove the reference to Microsoft.Cpp.Win32.user.props. That is useful if you need to ensure the project is entirely self-contained: that it doesn't get include paths from the environment, for example. Then you just have to specify the paths in the project itself, or in a custom property sheet that is part of the project (recommended for ease of reuse)
VC++ Directories in VS2010 are project-specific. There are no global settings like in VS2008.
There is INCLUDE environment variable which corresponds to $(IncludePath), so check it first.
Formerly VS saved all global settings in Documents and Settings\\Local Settings\Application Data\Microsoft\VisualStudio\\VCComponents.dat so try to delete such file if it is present for all VS versions. I don't have such file for VS2010, but it's worth checking in your case.
Hope this helps.
Related
I know the question may seem really noobish, but actually i have pretty huge coding experience, and it's just that i'm pretty new to Visual Studio (installed VS_2017 just few hours ago) and i'm rly struggling with global options now: i can't find a way to specify location of a library(-ies) for different projects.
I know there r 2 options for every project: "C/C++ » General » Additional Include Directories" & "Linker » General » Additional Library Directories", but the thing is that i have 3 libraries (atm) and they used in a bunch of different projects (there will be even more projects loaded via git and they all will be using same 2-3 libs)...
So specifying the same directories for every project manually seems very inefficient to me, but i rly can't find any global option for include/lib paths... I googled 'bout "Tools » Options » Projects and Solutions » VC++ Directories » Include files" but such feature is deprecated in VS 2017.
SO:
i wonder if such feature actually exists in Visual Studio 2017 (or some replacement)
i wonder if there is some sideway like some macro maybe which can add library (previously configured paths) to a project via couple clicks (preferably with RegExp syntax for replacement if there is some path specified for one of libs already)
P.S. i know about Environmental variables in Win OS's, but it's not acceptable for me 'cuz it looks unreasonable to trash it with directories which will be used ONLY by VS IDE!
Consider referring the below MSDN article
https://social.msdn.microsoft.com/Forums/vstudio/en-US/a494abb8-3561-4ebe-9eb0-6f644a679862/visual-studio-2010-professional-how-to-add-include-directory-for-all-projects?forum=vcgeneral
Prior to VS2010, VC++ Directories could have been used, but as you
mentioned that setting is deprecated now.
VC++ Directories are no longer supported in VS2010 through
Tools->Options page. Instead, VS2010 introduces the user settings file
(Microsoft.cpp..users.props) to control global settings
including Global search path. These files are located at
$(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0 directory. Upon
migration to VS2010, the custom settings of VC++ Directories from
VS2005 or VS2008 are migrated to these user files. These global
settings files are imported into all the converted and newly created
projects.
Here are the steps to change the settings file through UI:
· Open up property manager by clicking on View.Property
Manager.
· Expand the project node and then the Configuration|Platform
nodes, you will see "Microsoft.cpp..users" file for each
Configuration|Platform. These are the files for the global settings,
similar to the old tools/Options/VC++ Directories.
· Multi-Select "Microsoft.cpp..users", right click
and bring up the property page window
· In the property page window, click on "VC++ Directories"
(for example) in the left pane, add new paths for the directories such
as "Include Directories". separated by semicolons
· Make sure to save the settings before shutting down Visual
Studio.
· Re-launch Visual Studio and the new settings will be in
effect.
In addition to Sumeet's post, in the Windows Explorer the location of the file could easily be found as
%localappdata%\Microsoft\MSBuild\v4.0
.
I create a new custom project type using a VSPackage project inheriting of MPF library (http://mpfproj11.codeplex.com/). As a result I obtain a .vsix but I need add this project type using a .msi. I'm using the Visual Studio 2010 Setup projet for it. In my setup project I add the content of the VS Package in the same directory where the .vsix put then, but I think Ineed to put in the registre the new type of project because when I use the setup , the project template does not come out in Visual Studio and when I give double click the file with extension of the type of new project and does not recognize it. When I look the registry after install the vsix, this was one of the things that I found diferent. I add this entries in my setup project but It's not working yet.I'm missing something else?
In the projecttemplatedir is the directory where I put the .dll of the project type, the vsixmifest and pkgdef. The project template is in [User]\Documents\Visual Studio 2013\Templates\ProjectTemplates\[Name of new Project Type]\[projecttemplate.zip]
Best Regards
PS: The project type is for VS 2013 but I'm using the VS 2010 Setup project ;)
OK, so first the "don't"s of doing this:
In general, if you are installing via MSI you shouldn't be doing anything user-specific -- no writing in HKEY_CURRENT_USER, nor writing within their Documents folder, LocalAppData, or Visual Studio folders, etc. If you see yourself writing files or registry keys in either of those places, that should be your hint that there's a better way to do what you're trying to do. For what you've shown so far, this raises more than a few red flags for me.
Second, don't ever go writing keys into 12.0_Config. That part of the hive is nothing more than a cache that's built up from other parts of the registry and on-disk .pkgdef files from extensions. It's rebuilt in any number of senarios, including installing new extensions. Any writes there you should presume will get blown away at any time. If you need to write things there you should either (a) write in HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\[version] and run devenv /setup or (2) [preferred] put your keys in a .pkgdef inside your extension which gets merged into 12.0_Config for you automatically.
Now the dos:
You said you already had a .vsix produced by the SDK: you can put project templates in there. You can then register those templates in the .vsixmanifest and those will pull in. That's far easier than mucking around with files in Documents -- that's the user's directory...don't go playing with that.
Once you have a .vsix that does most of what you need, you should simply take the files within that and install the files in a folder within C:\Program Files [(x86)]\Microsoft Visual Studio 12.0\Common7\IDE\Extensions. Even better, you might just want to WiX toolset to build your installer, since it has built-in support for installing extensions. It also has built-in support for invoking the "/setup" process if that's what you need to do as well. Visual Studio Setup projects are no longer supported in newer versions of Visual Studio, so you're better off starting with a technology that isn't already obsolete. WiX is even what we use at Microsoft to do the setup work for Visual Studio itself, so it's definitely up to the task.
Last point: almost everything when it comes to Visual Studio extensibility can be done with a VSIX directly, so presume there's a good way to do something that way before falling back to an MSI. Internally, we can register the entire C# and VB language services with just a VSIX -- they're quite powerful.
I found the answer in this link Registering Project and Item Templates. I set projecttemplatedir entry with
[User]\Documents\Visual Studio 2013\Templates\ProjectTemplates[Name of new Project Type][projecttemplate.zip] that is where i put the project template.
For example: I want to have all newly-created C++ projects (libraries, dlls, apps) to treat warnings as errors.
Copied from a different Stack Overflow question (regarding the default setting for Character Set):
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/ceef57ef-788e-4666-aea7-cc19c44c1330
It's a bit dated (VS2005) but it might still apply.
Basically, it says to edit the Javascript (JS) scripts that create a new C++ project.
This has to be done on each installation of Visual Studio, because you're editing the locally installed files.
Another option (which I will be looking into) is to create a VS plugin with a "New Project" event handler that alters the project default settings after it is created.
I have a directory /media/fonts in my asp.net mvc project which contains fonts for my website. When I use the "Publish" tool in Visual Studio this folder is ignored even though it is included in my project. Other folders /media/images and /media/css are included just fine.
Is there any way to tell Visual Studio to not ignore this folder on publish?
Select your font files and Change Build action as Content from Properties Window.
You can fix this permanently by modifying the default Build Action for font file extensions (.eot, .ttf, etc)
http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
The link has been assassinated by the cruel march of time, so here's a copy/paste of its contents:
The default build action of a file type can be configured in the registry. However, instead of hacking the registry manually, we use a much better approach: pkgdef files (a good article about pkgdef files). In essence, pkdef are configuration files similar to .reg files that define registry keys and values that are automatically merged into the correct location in the real registry. If the pkgfile is removed, the changes are automatically undone. Thus, you can safely modify the registry without the danger of breaking anything – or at least, it’s easy to undo the damage.
Finally, here’s an example of how to change the default build action of a file type:
[$RootKey$\Projects{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\FileExtensions.spark]
"DefaultBuildAction"="Content"
The Guid in the key refers to project type. In this case, {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} means “C# projects”. A rather comprehensive list of project type guids can be found here. Although it does not cover Visual Studio 2010 explicitly, the Guids apply to the current version as well. By the way, we can use C# as the project type here, because C# based MVC projects are in fact C# projects (and web application projects). For Visual Basic, you’d use {F184B08F-C81C-45F6-A57F-5ABD9991F28F} instead.
$RootKey$ is an abstraction of the real registry key that Visual Studio stores the configuration under:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0_Config
(Note: Do not try to manually edit anything under this key as it can be overwritten at any time by Visual Studio).
The rest should be self explanatory: this option sets the default build action of .spark files to “Content”, so those files are included in the publishing process.
All you need to do now is to put this piece of text into a file with the extension pkgdef, put it somewhere under
%PROGRAMFILES(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions
(on 64-bit systems) or
%PROGRAMFILES(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions
(on 32-bit systems) and Visual Studio will load and apply the settings automatically the next time it starts. To undo the changes, simply remove the files.
Visual Studio does publish font files. In a special case we renamed extensions from .ttf to .jpg and they got published.
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.