I am trying to use VS 2010 for writing C. Frequently, I try to use a hotkey combination, and I get an error message of the form:
The key combination (key, key) is bound to com开发者_StackOverflow社区mand (Command) which is not currently available.
Why is this? Examples include CTRL + R
, R
for Rename and CTRL + K
, CTRL + D
for Format Document.
I am trying these commands with my cursor in the code editing window.
I find that this works in 2008 C# but not 2010 C/C++.
As 020Z28 says, the commands aren't supported in the C++ text editor. The workaround for Format Document is to Select All then Format Selection: Ctrl A
, Ctrl K
, Ctrl F
.
The C++ text editor does not implement those two commands. If they work in 2008, it's only because you have an extension installed that adds support for those features.
Edit: The OP currently says "for writing C", just in case the question later changes to "for writing C#."
If the OP actually means C#, then the error is occurring because you are editing a document that is not part of a project/solution you currently have open, or the file has the Build Action set to None.
I have at random found the format document command to be "not currently available". I have found that saving the file and switching to another tab and back, will renable the command.
It may depend on the file extension of the file you are trying to format.
For example, I was testing a BizTalk map (XSLT) which outputs XML. The output file had a .txt extension, and it repeatedly threw the Ctrl+K, Ctrl+D error. When I changed the file extension to .xml, Ctrl+K,Ctrl+D worked every time.
I don't know if VS uses the content or the extension to determine how to format the file, but my thinking is that VS has no idea how to format a .txt file, but it does know how to format a .xml file.
Remove 'tagprefix="asp"'
property from register tag.
精彩评论