How do you exclude a folder from build in Visual Studio 2015? - visual-studio

I have an example project from a vendor, and in the instructions, I'm told to right-click a folder in the Solution and select "exclude from build." But there's no such feature in VS 2015, and I can't find an equivalent online.
I've tried to just remove the folders from the project, and I expected that to work, but then I get compilation errors, so I suspect there are some dependencies that don't allow that solution to work.

You should see an option for Exclude from Project, when you right click a folder in solution explorer. Following screenshot displays this.

Related

Visual Studio Show All Files not working - not showing some folders and files

I've started a new project and I've copied and pasted in some test files from another project. Normally to include them in the project I'd toggle on the "Show all files" option in the solution explorer. However that isn't working and I can't work out why!
I've updated to the latest version of VS Professional 2019. I've restarted the application and my machine. I've deleted the sln file and rebuilt. I can exclude files - I just can't get them all to show! Below I've attached a screenshot of an empty project with two test files that should be showing but aren't.
Anyone know what I'm doing wrong? :(
"Show All Files" is a project level option. In a multi-project solution you would need to turn it on for each project in turn.
This was reported on the VS Developer Community here, with the suggestion that it be extended to work at the solution level as well. Microsoft's answer suggests that that's not expected to happen anytime soon: "although this is a very valid suggestion, at this time we are closing it as is not among the features we are able to fit into the near future roadmap".
Another way to show all files under the entire solution directory is to Switch View to Folder View using the dropdown next to Home, though this loses the project structure.

Visual Studio 2015 Excluded from Build

When I'm working with a VS project, when I want to build some files but not the others, I would go to Solution Explorer, right click on the files I don't want to build, Properties, and set Excluded from Build to "Yes". I find it cumbersome to do this for a dozen files. Is there a shortcut or a better way to do this? Thanks.

Visual Studio 2012 Business Intelligence SSIS packages missing

I have Visual Studio 2012 solution with multiple BI projects. One of the SSIS projects do not show all the ssis packages in the Solution Explorer (checked in by another teammember). But the missing files are in the TFS (Source Control Explorer) and are visible in the physical folder.
I tried "Show all files" did not work.
I tried adding the file again but the project does not allow that saying "file with same name exists".
Any idea what is going on here
The authoritative source of what's in a project is going to be the ProjectName.dtproj file.
Inside of that will be entries for the packages that comprise the project. For a non-package deployment model, it's trivial to edit the file by hand and make your stuff show up.
It's way too much effort to do that by hand for a 2012+ project deployment model. Open the Project in Visual Studio (ssdt/bids) and right click on the project. Click Add Existing Item (not add package) and then click the "missing" package. Check your .dtproj file in and all is right with the world.
I had the same issue in 2020, I managed to solve it by building the solution.
On the menu select Build-> Build Solution OR Ctrl+Shift+B

Dll dependencies on a Visual Studio 2010 solution and TFS

How can I make a solution in visual studio so that the .dll dependencies that reside in some other directory totally different from where the solution itself is affected by "get latest".
What I've tried is creating a Dependencies solution folder within the solution itself and added the dlls to it, that way they belong to the solution even though they don't belong to the directory structure of the solution.
So for example the .sln file is in:
D:\tfs\repository\main\SolutionA\solution.sln
and the dlls are in:
d:\tfs\repository\main\SolutionX\Dependencies\Binaries
What I really want to achieve is to have a foolproof way to build the solution, including the following scenario:
1- Have a brand new installation of windows, visual studio, etc.
2- open visual studio
3- find solution.sln on TFS, double click on it so that visual studio gets every project and files in the solution, and opens the solution
4- successfully build
What happens when I try the Dependencies solution folder approach and repeat the scenario above, it will get all the projects within the solution, opens it, but the dependencies solution contents won't be pulled from TFS (although Visual Studio shows them on Solution explorer), which I think is flawed.
Some suggestions that don't involve creating pre/post build scripts are appreciated.
When you attempt to open a solution for the first time using the TFS Source Control Explorer, you may find that not all of your dependencies will be retrieved - the squiggly line may be highlighting some of your missing References.
One work around is to...
SOLUTION SETUP
Checkout all of your source code from TFS (i.e. Main and all of the sub-directories)
Open your solution in Visual Studio (i.e. MyApplication.sln)
In the solution explorer, create a New Solution Folder called ThirdPartyDll, and then add the appropriate assembly references (i.e. Assembly1.dll, Assembly2.dll,...)
Check-in your solution to TFS
SAMPLE FILE STRUCTURE
Main
MyApplication.sln
Source
MyProjectA
MyProjectA.csproj
MyProjectB
MyProjectB.csproj
Dependencies
Assembly1.dll
Assembly2.dll
You've run into a limitation of the "Open from Source Control" functionality. If you added the solution to source control from Visual Studio you should have seen the following message:
"The project that you are attempting to add to source control may cause other source control users to have difficulty opening this solution or getting newer versions of it. To avoid this problem, add the project from a location below the binding root of the other source controlled projects in the solution."
Open from Source Control will create a workspace mapping for the solutions root directory (D:\tfs\repository\main\SolutionA) but not a separate one for the SolutionX folder which is a peer to SolutionA. On the "new" machine you will need to manually create a workspace mapping to d:\tfs\repository\main in order to get both the SolutionA and SolutionX folder.
Create a solution folder and add the dependencies to it, that way when VS gets latest for the solution it will download these files. A bit brittle as people will need to maintain that folder but it works.
Alternatively create a nuget package and use restore packages on build. It will require a couple of extra steps when you create a new developer box (your nuget package repo will need to be added) but it will work for all projects going forward and is less brittle than the solution folder method.

Copying from existing project

I have some problem in visual studio.Ok here is the scenario
first i add an existing project to my project in visual studio,and after that i tried to compile and run and it works properly...and then i exit the visual studio. and copy the folder or the visual studio solutions into my laptop.after that i open the visual solutions in my laptop after the visual studio loads,the project that i add before is greyed out and empty...can you help me on this please how can i see back my project that i add before.
When you add an existing project to a solution, you're adding a link. You didn't copy the actual project, you just copied the link, which shows as empty on your laptop.
Right-click on the project and look at the properties, you should see the location. This should show you the problem.
You won't be able to recover that project without going back to the source, you don't have the code on your laptop.
-t.
Do you copy the project off your portable drive to your hardrive? Sometimes copying it off external drives has solved that issue for me.

Resources