As in subject I can't find "resolve" in context menu of Visual Studio 2010 Ultimate. I have seen it in my teacher computer in the internet but I can't find it in the context menu, look at screen. How to get it?
In order for the Resolve menu to show up, you must be positioned over a keyword that VS believes it's able to resolve. If you've mistyped a keyword or don't have an assembly referenced, VS won't be able to resolve anything.
If you think about this a bit, you could type any legal keyword into your code, and there could be an assembly somewhere that might contain that class, and your keyword would then be resolve-able provided you referenced that assembly. Since this is not only impossible for VS to know and would also require project changes in order to reference that assembly, it makes some sense for this to be out of scope with respect to the "Resolve" dialog.
If you'd like to see this in action, just create a line of code with a missing class in it:
namespace ResolveTest
{
class Program
{
static void Main(string[] args)
{
OtherClass.OtherMethod();
}
}
}
Notice that OtherClass is flagged because it cannot be found. If you right-click on it, there's no Resolve.
Now, add in a class definition (in another namespace):
namespace NotInTheSameSpace
{
public class OtherClass
{
public static void OtherMethod()
{
}
}
}
Typically, this will be in another file or another assembly altogether, but for demo purposes, you can drop this right below your existing code. You should now see the "Resolve" menu show up in Main().
The other thing you're seeing here, I believe, is that when the "Resolve" dialog doesn't have anything to resolve, it's missing from that context menu, rather than being disabled but visible. This might seem a bit confusing, but it's really an effort to keep the context menu relevant to your current context.
Type in File.Open("Test.txt");
Then click on File
en see if you can find resolve then. Should be able to resolve it to System.IO.File
.
And for the record, you opened the context menu on a function. A function can't be resolved only types. So you could instead just type: Debug
then open the context menu and resolve it to System.Diagnostics
. Then you could call the WriteLine
function.
So besides your question, you need System.Diagnostics.Debug.WriteLine(object)
instead of System.Diagnostics.Debugger.WriteLine
which doesn't exist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With