Cannot find "solution" in Visual Studio 2010 Ultimate context menu

Like the subject, I cannot find the “solution” in the context menu of Visual Studio 2010 Ultimate. I saw this on my teacher’s computer on the Internet, but I can’t find it in the context menu, look at the screen. How to get it?

enter image description here

+6
source share
3 answers

In order for the Resolve menu to appear, you must be placed above the keyword that VS considers possible. If you entered the keyword incorrectly or do not have a link to the assembly, VS will not be able to resolve anything.

If you think about this a bit, you can enter any legal keyword into your code, and there may be some assembly that may contain this class, and then your keyword will be resolvable if you refer to this assembly. Since it is not only impossible for VS to know, but will also require changes to the project to reference this assembly, it makes sense to get out of scope with respect to the "Resolve" dialog.

If you want to see this in action, just create a line of code in it with the missing class:

namespace ResolveTest { class Program { static void Main(string[] args) { OtherClass.OtherMethod(); } } } 

Please note that the OtherClass flag is checked because it cannot be found. If you right-click on it, there is no permission.

Now add the class definition (to another namespace):

 namespace NotInTheSameSpace { public class OtherClass { public static void OtherMethod() { } } } 

Typically, it will be in another file or another assembly in general, but for demo purposes, you can delete it directly under your existing code. You should now see the Allow menu in Main ().

The other thing that you see here, I believe, is that when there is nothing that could be resolved in the "Resolve" dialog box, it is not in this context menu, and not disabled, but visible. This may seem a bit confusing, but it really is an attempt to keep the context menu in line with your current context.

+5
source

Enter File.Open("Test.txt"); Then click File ru if you can find a solution. Must resolve it to System.IO.File .

And for the record, you opened the context menu for the function. Function cannot be allowed only for types. So instead, you can simply type: Debug , then open the context menu and enable its System.Diagnostics . Then you can call the WriteLine function.

So, besides your question, you need a System.Diagnostics.Debug.WriteLine(object) instead of a System.Diagnostics.Debugger.WriteLine that does not exist.

+2
source

Long shooter. You may be writing the wrong function name. So VS just can't solve it for you?

If not, the solution only adds a Using statement to the top of the file to solve the problem. To do this, the project must have the correct link to the library in which there is a function. you can use the “Solution Explorer” (the right menu in the attached image), and within the project you have the “Links” tab, make sure that it is there, and if you don’t right-click and “Add Link ..."

0
source

All Articles