Exclude CPP files from build, but preserve in project - VS2015 C++ [duplicate] - c++

I'm in the process of refactoring a project. I've got an entire subfolder which is known to be broken. Is there any declarative way to exclude that folder from the compile temporarily while I test the refactoring thus far?
I realize I could delete the folder, but I'd like to do this through configuration if possible.

You could set the Build Action (in the Properties Window) to None for the files you want excluded. You could also right-click on the folder and choose Exclude from Project.

In VS 2010, right-click on the CPP module, choose Properties.
Then click on Configuration Properties -> General, Exclude from Build = Yes.
"Exclude from Project" is no good, it disappears from the other Configurations as well.

Right click all the files, and select Properties. Now set Action to None. Revert to Compile when you fixed the code :)

Use ExcludeFoldersFromDeployment inside <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> tag, example:
<ExcludeFoldersFromDeployment>FolderToExclude</ExcludeFoldersFromDeployment>
For files, use:
<ExcludeFilesFromDeployment>File1.aspx;File2.aspx</ExcludeFilesFromDeployment>

Select the files that you don't want to have compiled on the Solution Explorer.
Right click and choose Options...
Set the "Build Action" on the files to "None".
That should do the trick for you!

On Visual studio 2010 or later, you can achieve the functionality in two ways.
Right click the file, select 'Exclude From Project'
Right click the file, select 'Properties' --> select 'Configuration Properties' --> select 'General' --> choose 'Yes' from drop down menu for option 'Excluded From Build'

You should just be able to right click on the folder name in your solution explorer, and click "exclude from project".

In a website project type, you can set the files/folders attributes to "hidden" in Explorer to achieve the same effect.

If you have a lot of image files in a folder, so many that compilation is a painfully long task; you can rename the folder in IIS, giving the folder a .exclude extension.
e.g. C:\intetpub\wwwroot\yoursite\images change to C:\intetpub\wwwroot\yoursite\images.exclude
Then when you compile your app, the .exclude folder is excluded from compilation.

This is a method I have found for IIS Website Projects.
Set the "Hidden" attribute for the file/folder which you want to exclude from project, and then refresh the project in Solution Explorer. For example:
1. Open Windows Explorer.
2. Go to the physical folder of your website.
3. Right click the file/folder which you want to exclude, and then select "Properties".
4. Check the "Hidden" attribute.
5. Click the "Refresh" button in the Visual Studio Solution Explorer
Benson Yu
Microsoft Online Community Support
Quoted from: https://forums.asp.net/post/1997766.aspx

I'm quite sure that there should be a "Exclude from build" property on the folder, but I don't have my Visual Studio with me at the moment. At the very least there is such a property on files.

In Rider, right click file in Navigation Bar, click Properties, change Build action to None.

In Visual Studio 2010 you need to right click the project in the Solution Explorer and choose Unload Project

Related

Microsoft Visual Studio Professional 2013, Where are variables defined and edited?

I'm working on an existing project, the solution contains quite a lot of projects with a lot of dependencies and variables.
I'm struggling to locate any of the variables using the IDE, where will I find these in the IDE?
For example in one of the .vcxproj files there are variables such as:
$(FraenkelPlatformName)
Where would I find this in the IDE ?
Edit:
Edit 2:
Ok, based on the great comments on my post, but no answer posted this is what I need to do:
From the VIEW top line menu, select Property Manager
Select a project from the left "Property Manager" panel and expand the node.
Open a build folder, Debug or Release and double click on buildvars
From Common Properties select User Macros
All the variables are listed here and can be Added or Removed.

VS2015: How to hide the 'References' folder in solution explorer?

I have visual studio 2015, and from past experiences there are a few folders that some people generally don't want, excitedly, these (red):
But, I managed to get it down by selecting 'Disable External Dependencies folder' folder option to true, and got this:
But I cannot find any option to disable the leftover virtual folder, how can I disable the 'References' folder?
I don't think disabling the references folder is possible yet. This uservoice suggestion is called "Add option to disable References folder in Solution Explorer tab" and is still open.
this is a default option in visual studio and you can't hide it.
you can set scope to special folder or make a new view of your solution explorer instead of remove or hide a part of solution explorer
I feel yor pain, HATE that view.
You can disable it in the Options dialog (from the Tools menu).
On the right side panel expand the Text Editor section, then expand C/C++ and then click on Advanced. Set the Disable External Dependencies Folder to True and restart Visual Studio.

How to get back a file that was excluded from a build configuration in Eclipse CDT?

Using Indigo and a managed build C++ project, I right-clicked on a source file and selected Resource Configurations->Exclude From Build..., and the file promptly disappears. Scrolling down shows it at the bottom of the list of source files with a new dimmed icon. Now how do I get it back? The Reset to Default... option is always dimmed out. Right-clicking on the excluded file still only shows the Exclude From Build... option. Is there an Include in Build option somewhere? I realize I can go to .cproject file and manually edit it back in but I figure there must be a way to do it from the IDE.
Yes this is an old question. But people do go looking for answers years later..
There's an easy way, but it's counter intuitive. Right click the excluded item, select "exclude from build", and on the dialog that appears, uncheck the builds for which you'd like the item back. Note the convenient 'Deselect All' button.
In eclipse there's not a similar way to reinclude resource, like:
Resource Configuration -> Reinclude from build
You need to go in Project Proprerties (Alt+Enter) and go:
C/C++ General -> Paths and Symbols
Select tab
Source Location
and expand your project's folder: here you can select filter that you want to remove and click on "Edit Filter" and then "Remove".
While I still don't know how get back a file that's been excluded. I have discovered that it's much better to just add a new folder, and then mark the folder as excluded. Then files can be excluded by dragging them into this folder and included back by dragging them back to the original folder.

How to build the project which contains the active file in visual studio?

I am using visual studio 2010. My code is in C++ and my solution contains many projects and each project again contains multiple folders under it. Whenever I change a file it gets automatically selected in solution explorer as I have enabled the option "Track Active Item in Solution Explorer" in Tools->Options->Projects and Solutions->General. But after changing the file I have to manually select the project (this could be cumbersome as I have to scroll up and down due to many files present) and then right click on it and select "build". Is there any other simple way to do this?
You could assign a shortcut to Build.BuildSelection or Build.BuildOnlyProject
Go to Tools menu, then Options=>Environment=>Keyboard and enter Build.BuildSelection or Build.BuildOnlyProject in the Show commands containing search text area. Then assign two free shortcuts. Build.BuildSelection is for building the current file; Build.BuildOnlyProject will build its project.
I use ctrl-shift+b to build all the solution. I hate to use the mouse for those repetitive tasks.

Visual Studio 2010: C/C++ global include and lib folder

How to make user include and lib folders globally and permanently available to all projects? In Visual Studio 2008 it is Tools -> Options -> Projects and Solutions -> VC++ Directories. In 2010 it says deprecated... blah blah... instead use property sheets... click '?' for help.... Click and it takes you to a web page about property sheets. Doesn't answer the basis question. How to set user library folders globally, once and for all?
Thank you.
Try this:
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.
Note: If you would like to only change the settings for one project, you can right click on the project and bring up the property page. Change the settings for “VC++ Directories”, these settings will be persisted to the project file.
I found this article helpful.
You can select all the project and edit them all at once.
Open the class view and select all projects.
select configuration properties node and then VC++ directories.
select Included Directories, Libraries Directories and click the
button next to it. Select edit and enter the additional paths you
need, this will be add to all the selected projects.
You can delete any common directories among the selected projects.