I have a small software utility that I inherited maintenance on, though I'm a firmware engineer. I need to make a small modification to the UI. However, I don't see a .cs file anywhere in the project tree in VS17. In one of the C++ source files I see references to the combo boxes, textboxes, etc. But I can't figure out how to edit the actual form layout to add new items. I don't see anything obvious if I right-click the file that has the references to the combo boxes. I've tried switching between folder view and solution view, no sign of a .cs file. Nothing shows up under the "Toolbox" either; a search for "combo" returns nothing. Am I missing a component of the VS17 installation? Or what else am I doing wrong?
Related
As per the tags, I'm using VS2013 and TFS2013.
There are multiple projects in the solution: Model, Presenter, View, etc. All other projects are working as expected in terms of source control operations.
Problems with the Model project:
Adding a new file via Solution Explorer isn't automatically detected as a pending change
Deleting a file isn't detected either
Other source control operations work fine for the Model project, such as:
Get latest version
Edit detection for existing files (including changes to the csproj
file when a new file is added)
Checking in pending changes
The csproj file would show up in pending changes with the newly added file listed in it, but the new file itself isn't showing up, therefore causing build errors on other developers' machines if only the csproj changes are checked in.
The workaround is to find the added file in solution explorer and Add via context menu, this will make it appear as a pending change. But this process should be automatic as per the other projects.
Noticed that there is no .vspscc file for the Model project while other projects have one each.
Any help appreciated. Thanks.
I would unbind and rebind the problem project and try again:
To unbind a solution or project from source control
In Visual Studio, open Solution Explorer and select a solution or
project to unbind.
On the File menu, click Source Control, then Change Source Control.
In the Change Source Control dialog box, click Unbind.
To bind a solution or project to source control
In Visual Studio, open Solution Explorer and select a solution or project to bind.
On the File menu, click Source Control, then Change Source Control.
In the Change Source Control dialog box, click Bind.
Select the database and location to which to bind, and click OK.
Click OK.
You might need to go to Advanced to find the Change Source Control option
https://msdn.microsoft.com/en-us/library/0eh3790h%28v=vs.90%29.aspx
Before unbinding and binding your solution try his:
Go to Source Control Explorer
Click the "Add Items to Folder" (the
one on the left of the red cross)
Select the items you want to Add and follow the instructions on screen
That's all
Click <Detected: x add(s), x delete(s)> : in the source control explorer then select the file to add
For years I've been relying on 'Detected Adds' to add missing files - which was never a sustainable solution but I've just about managed with it.
But now if broke.
I'm actually about to reinstall Windows but in the meantime one of the best ways I've found to get a sense on what's missing (and it's still working even though the detected adds isn't) is the recursive 'Compare' window.
You can add files from here too.
It's a little klunky but it gives me a good sense of security and shows file diffs if you want to see what may have changes.
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"
I am manually reconstructing a WCF service from pieces. I add a MyService.svc file MyService.svc.cs file.
How the heck do I now make the latter the code-behind of the former? It's not just a matter of editing the project file to add the dependency and editing the svc file to point to the code behind file. Neither of those, nor the combination, works for me.
I also tried right click remove from project then include, which I seem to recall used to work for asp.net pages in one or another version of Visual Studio.
I just got it to work. Remove from project and then include in project actually does work. The trick is to make sure the files have the same names, except for the extensions. Although I called them both MyService in the question, in fact they had different names which was why it wasn't working.
So:
Make sure the roots are the same name.
You don't need to edit the project file or the markup file to point to the code behind.
Right click and exclude from the project.
Ensure Show All Files is active (top of solution explorer)
Ctrl-click to select both files.
Right click and select include in project.
They will be associated as markup and code behind.
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.
I've got two branches of code. 1 has a dialog box that the other doesn't, but because of politics the dialog box wasn't moved into the newest branch. Now they want it in...
So is it possible to copy a dialog box from one project to another.
There apears to be an export and import feature however it's greyed out.
.RC files are simple text files. You can simply copy/paste the DIALOG text from one .RC file to the other. Make sure that you copy the corresponding RESOURCE.H entries as well.
Alternatively, you might be able to open both .RC files and then simply drag-and-drop the dialog from one to the other.
Update for Visual Studio 2010 - 2013:
You can still drag-drop and copy-paste, but only outside of your project / solution.
Close solution, open both RC as files without any open solution, and go. For drag, "Hold down the CTRL key and drag the resource to the second .rc file. For example, drag IDD_DIALOG1 from Source1.rc to Source2.rc."
Microsoft - How to Copy Resources
Drag and drop doesn't work in Visual Studio 2010. Editing the .RC file does work but be careful. For me the ID for the dialog showed up with *ID_etc*. I copied it and removed the *'s and it seemed to fix the problem.
I finally figure it out how to copy a Dialog from one solution to another.
Steps:
Open both solutions in separte windows.
Add a new Blank Dialog -Add Resources-> add->newDialog
Open Both Dialogs Open Binary data.
Copy the Binary data from source solution dialog to Destination Dialog
This is just to add some visual detail to the accepted answer (by Roger Lipscombe) along with its steps.
In order to copy a resource such as a Dialog from one project another project, below steps can be followed.
Start a new instance of Visual Studio.
Open both source and destination .RC file as files, as shown in the picture.
From the source RC file, copy required dialog.
Switch to the destination RC file tab and simply paste it.
Please note that this operation would have updated the resource.h file. That is an excellent help by Visual Studio.
One will have to make sure that no duplicate resource IDs are present in the resource.h file. When working with some legacy projects, it is found that there came some duplicate resource Ids that had to be manually corrected. It looks like such an effort is worth considering the mammoth task required otherwise.