Why is the "add reference" list in my C++-Project in VS2017 empty? - visual-studio

When trying to add a reference to my Visual C++ project in VS 2017 (I chose "empty project" when creating) the list of references to select from is empty, as shown in the following picture (it's in german but I hope it nevertheless gets the point across):
Although I haven't used VS or coded in Visual C++ in the past, I'm fairly certain that the reference list should not be empty and should instead show a list of possible references to choose from.
I have created the project from scratch, just added some existing .cpp, .hpp and .h files. Even when creating a new "windows desktop application" or a "windows console application" the reference list is empty.
I want to work with a MS Access Database (.mdb) via DAO and therefore need to add a reference to the COM Microsoft DAO Object Library as explained here (correct me if I'm wrong).
My problem is nowhere to be found when doing a google search (the only solution provided here doesn't work for me), therefore I created this post and hope someone here can tell me how to fix this issue.

It's empty because you are in the wrong subdirectory. You are under "Solution", and in your solution, there is only one project, AM. If you add another project to the same solution, you'll see it appearing in the list.
You can try to go under the other subdirectory, but I doubt you'll find anything, because you have a non-CLI C++ application, and those applications don't support "references" (it's just not a thing).

Related

After getting asp.net project from VS team server: references don't work?

I just downloaded an asp.net project from my work's team server and it seems like a bunch of references aren't working. If I go to the references folder in the solution explorer many of them have a little yellow caution sign next to them and if I click on one them it says something like "this project cannot be viewed in the object browser ". I can't find them in the add references library either. How can I correct this?
most of them are asp.net, doNoNotOpenAuth or similar web refs
thanks
It sounds like someone added a reference to a path which doesn't exist on your system.If you right-click one of the missing references and choose Properties from the popup menu you will be able to see the path that has been set for the reference and verify if that is the case.
If your team is not already doing it, I would recommend copying third-party DLLs to a central folder under source control e.g. /lib and add all references from there to ensure that there are no path discrepancies in future.

VisualStudio InheritancePicker with Solution Folders

Has anyone of you ever had the problem that when you try to create a new "User Control" with Visual Studio, that the grid with the possible classes to choose from is just empty?
I'm having this problem now. Everything worked just fine until i created some "Solution Folder" in my VS-Solution. I made this folders to structure my solution, because it has grown big over the time. I can still compile the solution, everything works just fine. The only problem I'm facing is that I can't create any "User Control" anymore. The "Inheritance Picker Window" is just empty... I could choose the assembly that contains the needed UserControls manually via "Browse..." but that is not a good solution, because it will have to statically reference the dll. I could also make the inheritance myself, without the "wizard" but then I'd have to edit the designer file to match the parent class...and that is nothing I want to do...
This problem only occurs when I have these "Solution Folder" in my solution. When I have all the projects on the same level without folders, then the "Inheritance Picker" works fine...
Is this a bug in VS (happens in 10 and 12), or am I doing something wrong?

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.

Problem with file name folding in Visual Studio Solution Explorer ("File Nesting")

(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
Folding:
No folding:
My questions are:
What is the correct name of this feature?
How do I set it?
Why does my Solution Explorer not have this feature enabled when I try to convert my Web Site Project to a Web Application Project?
References:
Upgrading VS 2005 Web Site Projects to be VS 2005 Web Application
Edit
Thanks Sean, but as you can see below, my Nest Related Files button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
It's called File Nesting.
When a website project is selected in Solution Explorer, the third button in the Solution Explorer toolbar is for "Nest Related Files".
A website project or project file must be selected in Solution Explorer (rather than the root Solution), for the button to appear in the toolbar. The command/tool button is not available when C++/C# projects are selected in Solution Explorer. I don't have a web app project to test but can only conclude that the command is not applicable to web app projects either.
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script):
Visual Studio 2010 related file nesting
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
Open the project's .csproj file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.
Locate or create an appropriate Item Group element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.
Create a new Content element for the file you wish to nest. This element's Include attribute should be the name of your desired file.
Add a new DependentUpon child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.
Save the project file and Visual Studio will likely prompt you to reload the project. If you did it correctly, your target file should now be nested under your desired file.
There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.

generation of designer file failed

Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario:
The aspx page has a reference to a custom user control (inheriting UserControl) which references another assembly in the backend. There are many other references to this "missing" assembly in other places in code which don't throw errors. rebuilding, updating the source to the clean copy, shouting at the computer, punching the screen, etc all fail to work.
Any suggestions? This is quite annoying.
We've had similar problems before, unfortunately I don't remember the exact solution.
If your using a "Web Site" project (no project file) then start by checking that both your page and your control both set the ClassName property in the first line of your aspx/ascx file and that you specify the full name of the class including the namespace.
Example:
<#Control Language="VB" AutoEventWireup="false"
ClassName="YourProjectName.YourUserControl"
Inherits="YourProjectName.YourUserControl"
CodeFile="YourUserControl.ascx.vb"
%>
Many times not setting all of these will still work but you will get odd compiler errors and behavior in VS.
If you using a Web Site Application project try deleting the designer file manually and then right click on your project and choose "Convert from Web Application." This will should recreate the designer file for you.
My only other suggestion would be to recreate the page and/or the user control from scratch.
Jared, you've hit it. Using "Convert to Web Application" to manually generate the designer file solves my problem. I'm glad you posted this before i started reinstalling. Thanks.
You might try archiving a template of a new file with its designer equivalent. If VS coughs then you can do an "Add Existing" option with the file you already have.
It seems, however, to be an issue with your installation of VS2008 so you might try reinstalling it.
I found that using a custom control, you would need to add a reference to the .dll. This fixed it for me after migrating from a web site to web app.

Resources