Hide .svn folders in a VS2010 IronPython project - visual-studio-2010

I'm working on an IronPython project on VS2010 and I've notice that for the python project (which is setup as a Console project, but really just contains a number of scripts that are hosted in a C# app), everything that is in the project directory will show up in the VS solution explorer under that project. So, for example, the .svn folder shows up. Which I obviously don't want or need to be there.
Is there any way to tell it to hide specific items? I sure can't find one.

Currently we have a directory based project system - which as you have seen includes all of the files in the project dir. We were planning on having an exclude option but the feedback we've been hearing so far is that we should move to a normal VS project model where you need to explicitly add the files. The next CTP release (which should be out in a week or so) will change to a normal project model.
There does still seem to be some interest in the directory based model so we may bring it back via an option in a future version.

You should be able to just right click the folder, choose "Exclude from Project"
Then, make sure "Show all files" is NOT on at the top, by the solution.

Related

In visual studio 2015, solution folder leads to a unsupported error [duplicate]

I have a Visual Studio Solution. Currently, it is an empty solution (=no projects) and I have added a few solution folders.
Solution Folders only seem to be "virtual folders", because they are not really created in the Filesystem and files inside solution folders are just sitting in the same folder as the .sln file.
Is there a setting that i've overlooked that tells Visual Studio to treat Solution Folders as "real" folders, that is to create them in the file system and move files into it when I move them inside the solution into one of those folders?
Edit: Thanks. Going to make a suggestion for VS2010 then :)
There is a workaround, that actually behaves as expected.
Add a New or Existing Web Site to the Solution. (I usually create a new one.)
Just make sure it's created inside your solution folder. (I sometimes even create a "link" to an external folder, e.g. 'Docs' or 'Marketing' on a network share. In that case it's ignored by Git of course.)
Make sure to go to the "Project" settings or Configuration Manager to exclude this "Web Site" from Build and Deploy!
Done. Now Solution Explorer will reflect any change in the file system and vice versa (including subfolders).
I (miss)use it for specs, docs, PM and some DevOps scripts that are shared within the team. It's easy to choose, what to include in source control or not, and (if set up correctly) it doesn't conflict with build.
I know the feature is not intended for that use case, but except for the maybe misleading "Project" icon I didn't find any shortages to that hack yet. And there still are use cases where the classical (virtual) Solution Folders that VS provides, fit in the picture. What do you think?
No special setting. I don't think it's supported.
You can create real folders in a "project" within the solution, but not in the solution itself.
In Visual Studio 2017, click on the "Solutions and Folders" icon in the Solution Explorer window. This button toggles from the virtual "solution" view into a "source view" that matches the layout of folders and files on the file system. When you add a new folder, the folder is physically created in the expected location.
.
The chosen answer suggests it would be possible to use actual projects instead of solution folders, but does not really explain how. I guess what I'm describing here is possibly the least awkward way of achieving that... :-P
The problem with regular project files is that they eventually will be compiled by MSBUILD. And if you want have a project which only contains non-compilable files, that will be an issue.
But some time ago Visual Studio introduced a new project type: Shared Project (.shproj extension). This project type does not get compiled by default, but only when (and only if) it is referenced by another project.
So one part of the trick here is to use shared projects instead of solution folders. It's obviously possible to add a shared project that is never referenced by any other project, meaning we can avoid the issue presented above.
Then, by using <None Include="**/*" /> clause in the .shproj file, we can make it automatically reflect any new files and/or subfolders.
So basically do this:
Create a new folder in your solution.
Add a new .shproj file at the root of this new folder.
Reference the new .shproj in your solution.
For instance, in my case, I've created a DockerDev.shproj, so I can group some docker-related scripts that we run only in our development machines:
<?xml version="1.0" encoding="utf-8"?>
<!-- DockerDev/DockerDev.shproj -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="**/*" />
</ItemGroup>
</Project>
This .shproj file will keep track of any file, in any subfolder of this new DockerDev folder in my solution.
As far as I could see, this solution works pretty much like what the OP requested: it will work as a non-compilable reference to a folder, and it will automatically reflect any changes made to it.
Sara Ford contributed a Macro to add do this. In Visual Studio 2010, if you open your Macro Explorer, you will see a macro called "GenerateSlnFolderOnDirStructure." This will automate the creation of the Solution Folders and add the files.
Folder To Solution Folder By Cecilia Wirén - CeciliaSHARP
Remove the hassle of adding several files to solution folder. Just use the context menu for the solution and just below the option of creating a new solution folder you now find 'Add Folder as Solution Folder'. This will create a solution folder with the same name as you selected and add the items inside of that folder to the solution folder. This will not move the files on disk.
You can just sync your new solution folder nesting level and also name with the actual filesystem folder and it works like a charm!
Existing project :
Create the actual folder
Create the solution folder with the exact same name
Copy your project folder into the new folder (Actual file system)
(in solution explorer) - Righ-click on same folder
Add => Existing project
Add new project :
Create your solution folders
(Right-click on solution) => Add new project
Change the Location address under the project name you want to add, to the exact same address in your solution folders
No, it's not supported. As you suspected, solution folders are simply virtual subentries in the .sln file, nothing to do with the file system.
For C# in Visual Studio 2019 I used this way (Seems to be similar to this answer, but that didn't work at least in C# solutions)
In solution explorer click on switch views
Choose folder view
You can add individual folders to the solution
To get back to the regular view of solution explorer just click switch views again and choose the solution.
There seems to be a limitation using this way (comment from #montonero):
... just open a solution with multiple projects and try to move the projects to some other real folders through the folder view. The issue is VS doesn't update paths to projects in a solution file
Visual studio has no support for this. I made an extension that does something similar for VS2013 though. It maps solution folders to physical folders on your hard drive, though the mapping is one way (from hard drive to solution). That means a solution folder's contents will reflect the hard drive folder's contents, and not the other way.
With that out of the way, the extension may still be useful.
It has support for mapping solution folders to physical folders, filtering files and directories based on regex, and remembering mappings in your .sln file. Properties are non-intrusive so developers without the extension can still open the sln and not be affected.
Hosted on visual studio gallery:
https://visualstudiogallery.msdn.microsoft.com/69e19ea6-4442-4cb6-b300-044dd21f02bd
Edit: Uploaded to bitbucket. Now open source. MIT license. https://bitbucket.org/LSS_NorthWind/physical-solution-folders
Create "Solution folder". This will create logical folder, but not physical one.
Right click to the solution folder and open a new project dialog. But before you click OK, you have to change a project location to your desired physical folder and VS will create it and place the project inside.
Create an empty solution then
open .sln file in an editor
and put these lines of code after MinimumVisualStudioVersion
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9D8C3BB1-AEDB-4757-8559-995D12A4E6D0}"
open the solution in vs and you should add the same folder to it
now you can see the folder and add a project to it
you have a real folder in windows and a virtual one in vs
be sure that you
created the projects with that path
You can add real folders by choosing "Add new filter" for a Visual Studio project file. You can also do "Add new filter" under an existing folder. Once the folder is created, rename it and add source or header file or whichever suits your project. This is one way I know which lets us create real folders through the Visual Studio IDE.
I've wanted this feature a few times myself, but at the end of the day, you really do NOT want the ability to do this. Think of your Solution (file) as as the root of a web application and think of Solution folders as Virtual Directories (literally and functionally). The contents of a web virtual directory could be physically on a different server altogether. Where Visual Studio muddled up the solution folders concept is by allowing you to create new files inside the folder. You should always "Add Existing" when adding content. When you add existing, it creates a link to the source location of the file.
But as for the reason you do not want solution folders to behave like "physical" folders is because your solution layout may not necessarily use the same convention as your source control layout. Solution folders allow you to customize the hierarchy of your projects so that you can group projects and items together any way you like, and then decide you don't like it and change it again without having to go through the nightmare of moving source control items around and irritating the rest of your team.
Note: Yes this is possible you can create a folder on root but its lil bit tricky....
By giving some extra efforts you can do it How?
Lets follow the step--
1-Create Folder eg: "newfolder" on root (where your .sln file reside).
2.Copy and paste your projects inside the folder.
3.go to your sln file and find moved projects and append newfolder\ in moved project's address.
4.Save sln file.
5.Open your project and Commit the repository in git or so...
6.Take the repository on fresh location.
YOU are done...
if still you are not able to see your folder -----
1.Add a solution folder xyz.
2.Open sln file and change that folder name with your folder name.
Congrats you are done..
If you face any problem just write me for help..
The folder created underneath the solution will be virtual as said. Maybe this might be called a workaround but you can physically create the folder on disk either before or when you add new item/project and Robert should be a sibling of your dad.
ps- on closer look maybe i should explain "bob's your uncle" means your fine/sorted.
I have a bit of a workaround for this (it's not great, but it works).
Create a folder in your solution (i.e. "Contoso")
Right click on the solution and then click "Open Folder in Solution Explorer"
Create the physical folder (i.e. "Contoso") in the solution directory
Copy/Create files in the physical folder.
Drag the files into the virtual folder in the solution explorer.
It's not great because you will need to manually maintain the file references, but it works for me.
Yes, it is possible in Visual Studio 2019 for the project
Though this is an old topic, I will add my answer, because I had the same issue and searched for a solution but it seemed that everyone is 100% sure that there is no way to do it. So I started to experiment with VS 2019, tried a lot of settings, and eventually figured the way out.
1 Button :D
You only need to click 1 button - Show All Files, and you will see the physical structure of your Visual Studio Solution:
Now you can add files and folders to the project and they will be added to the file system (physically)
Right-click on your project → Add → New Folder
Note that the option changed from New Filter to New Folder
My recommendation for C++
Create a root folder inside your project's directory which will contain all the application related stuff (code, headers, data, libs... ). I name it Project
Add subfolders as you'd like to structure your code. I prefer the following layout: include, src, data, libs, etc
Now setup Visual Studio to recognize these folders as headers and sources directories.
Click on your project in the Solution Explorer. Note, in my case, it is CrazyDemo, not the Solution 'CreazyDemo' (1 of 1 project)
Go to the project properties menu: Project→Properties
Open Configuration Properties→VC++ Directories tab
Edit Include Directories and set to $(ProjectDir)/Project/include;$(IncludePath)
Edit Library Directories and set to $(ProjectDir)/Project/libs;$(LibraryPath)
Edit Source Directories and set to $(ProjectDir)/Project/src;$(SourcePath)
You may use the Scope to This option if you want to focus on 1 project. Just right-click on the Project folder and press Scope to This
Note that after this action, in order to open Project Properties you need to click on any of your project files (like main.cpp in the example) and then click on the editable client area (like when you want to change the code) and only after that you'll be able to see the Project→CrazyDemo Properties option. [Visual Studio is Insane 🤦‍♂️]
Finally, you may have a project like this

How do I select the Current Project for Find & Replace

I don't see an option to tell VC++ what the current project is, so that I can search within a specific project within my solution, rather than the whole solution.
Is it something that happens as a side-effect of some other operation or can I somehow explicitly select which project is the current one?
currently opened file on which you opened the Find/Replace dialog belongs to a certain project. So that project is basically the "Current Project"
Right click on a project in the Solution Explorer and select 'Set as Startup Project.' The 'Startup' project is the "current" project.
This question has a longer answer that it would seem. To make the Current Project selection, go to Solution Explorer and click on the desired project so that it is highlighted. It is not necessary to make the project your StartUp Project, but doing so will highlight the project as required to make it the Current Project for the search. You can make the project selection before or after opening the find/replace dialog. If you do not have a project selected (by selecting the solution), there is no current project and nothing gets searched.
However, there is at least one alternative. If the Property Manager is opened, a selection there will also set the current project. If both are opened, it appears that the last selection becomes the current project. This information is for VS2017, but probably it has been that way for many older versions since the Current Project search option has been around for a long time.

Why would the solution and the project be in totally different locations?

I just noticed that my one-project solution is in:
C:\Users\Clay\Documents\Visual Studio 2013\Projects\Platypus\Platypus.sln
...whereas the project itself is in:
C:\Platypus
What is the sense of separating things out that way? I did choose the project's folder, but not the solution's. I can see why the "buried" location would be used if I hadn't chosen a specific separate location for my project, but I would expect that choice to have put the project AND the solution in that folder.
Seems like a weird way to run a ship.
Is this normal? Any "gotchas" as far as backing it up goes? IOW, is backing up the project enough, or do I need to explicitly back up both?
This is the default location at which the solution file is created however if you want to change the location of the solution file then try when you create the project simply uncheck the default box for "create directory for solution". This will create the File (.sln) in the same directory as the web project. Or you may start with a Blank Solution under "Other Project Types-->Visual Studio Solutions" in the New Project dialog after that add your website.

Visual Studio 2012 - Hide folders from solution explorer?

Is it possible to hide folder in Visual Studio 2012 solution explorer window? I have multiple folders/files that I don't plan to use and they are just cluttering the interface and it's harder to find things.
It just seems pretty illogical that you can toggle "Show Hidden Files" but you cannot actually hide any files.
Example
Why
WebApi project includes automated help generation that I want to use, however it includes multiple folders that it needs to function. All I care about is Controllers/Models since I'm building the Api itself. But if I delete/remove from project those files than help generator won't work.
Since you want the files to still be accessible, as opposed to just excluding them, you can modify the csproj file itself. Unload your project from the solution, right-click and select edit. Scroll down to where your folders are displayed (I tested with a folder called "TestFolder" and a file within it called TestClass.cs.
<Compile Include="TestFolder\TestClass.cs">
<SubType>Code</SubType>
</Compile>
Create a new child tag called Visible and set the value to false.
<Compile Include="TestFolder\TestClass.cs">
<Visible>false</Visible>
<SubType>Code</SubType>
</Compile>
Save and reload the project and the files should no longer be visible but accessible. I just did a quick test and it seemed to work fine (but YMMV).
Hiding folders is almost certainly a bad idea. Remember that hiding a folder is not the same as excluding it from the solution - all hidden items can still be used elsewhere in the code, can be referenced by the build, and get updated when you pull the latest version from source control.
That is the reason why it was never available for project folders - so that people cannot easily confuse their workmates.
Having said that, it is possible to hide folders on the solution level - I guess mostly because it's quite common to have documentation, shared libraries etc on that level. To hide a solution folder, you right click on the folder, and select "Hide Folder" (to unhide, you'd right click on the solution itself and select "Unhide folders")
As for your screenshot where you want to hide Area, Scripts etc - I suspect you're working alone and just started learning MVC - otherwise it wouldn't make sense to hide those folders. They contain legitimate code which is used to run the application. Hiding it is the same as hiding Program.cs in a console project for the sole reason that you prefer a smaller tree in the solution.
I do agree that Solution Explorer becomes unmanageable at some point - but instead of messing up with it, I'd recommend to try other tools - Visual Studio "navigate to" options or Resharper (I use the latter).
I don't know if it's the same way in VS 2012, but in VS 2010, I just right click on the folders (and, in some cases, files) that I don't want and exclude them from the solution.
I'm not sure if this is a new feature but you can hide folders from solution explorer without excluding or deleting them.
On VS 2017 (15.5.5)
Just right click on any solution folder and click "Hide Folder"

How do I show the References folder in Solution Explorer without selecting 'Show All Files' in a VB.NET project?

As I compare many C# example projects to my VB.NET projects, I see that the References folder shows in the Solution Explorer without having to select "Show All Files". Is it possible to have this for a VB.NET project as well? I find that it would be very helpful to have this folder displayed without having to see all the other hidden files as well.
I'm using VS2010 Professional.
This adds to my list of reasons why I should have learned C# first...
I guess I will have to definitively crush your dream. Sorry. It has been a decision by Microsoft to remove this from the default view to reduce the 'clutter'. However, your 'Show All Files' setting will persist when you save your project. So if you show all files once and then save, then it will always be on.
You can also see your References in the Project designer, which you can always keep open in a tab.
As of Visual Studio 2015, this behavior has been changed to show the References folder without selecting Show All Files.
From MSDN:
What’s new is the References node. This used to be hidden and you had to click Show All Files to see it—but that also showed lots of irrelevant files.
This previous behavior might have made sense 10 years ago when you’d start with a Windows Forms project and it would generally have the right set of references. But it’s a reality of modern development nowadays that the References node is used frequently—especially to manage NuGet references. It’s a small but handy convenience to be able to find it easily in Solution Explorer.
I add a separate folder called Dependencies, add my dll's to it and check them in as described here. That way my dll's are always visible in the Solution explorer without having to turn on Show All Files.
Select 'Show All Files option' in the solution explorer.

Resources