为什么“将JSON作为类粘贴"?和“将XML粘贴为类";在Visual Studio中禁用(显示为灰色)命令? [英] Why are the "Paste JSON As Classes" and "Paste XML As Classes" commands disabled (grayed out) in Visual Studio?

查看:223
本文介绍了为什么“将JSON作为类粘贴"?和“将XML粘贴为类";在Visual Studio中禁用(显示为灰色)命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Visual Studio 2017 15.9.0预览版4.0 .我正在尝试使用编辑>选择性粘贴"下的"将XML粘贴为类"命令,但该命令显示为灰色:

I'm using Visual Studio 2017 15.9.0 Preview 4.0. I'm trying to use the "Paste XML As Classes" command available under "Edit > Paste Special" but it's grayed out:

我有(不正确的)感觉,该命令将允许我选择一个包含XML或其他某种UI的文件.我的文章我找不到的文章都没有提到禁用这些命令的情况,所有迹象都使我相信它在此版本的VS中应该可用:

I got the (incorrect) feeling that this command would allow me to pick a file that contained XML, or have some other sort of UI. The articles I None of the articles I found talk about cases where these commands are disabled, and all indications lead me to believe it should be available in this version of VS:

https://improveandrepeat. com/2017/08/paste-xml-as-class-in-visual-studio-2017/

https://www.c-sharpcorner.com/article/how-to-paste-json-as-classes-or-xml-as-classes-in-visual-stu/

我确实找到了一篇文章(下文),讨论了什么时候 missing (显然这里不是这种情况),因为该项目必须针对Framework 4.5或更高版本,但这正是我所使用的.NET版本. 'm定位.

I did find one article (below) that discusses when it's missing (which is obviously not the case here) because the project must target Framework 4.5 or above, but that's the exact .NET version I'm targeting.

https://blog.codecalculated.com/2015/01/02/paste-xml-as-classes-missing-in-visual-studio/

推荐答案

我终于遇到了这篇孤独的文章,为我提供了解决方案:

I finally came across this lone article that gave me the solution:

http://www.selcuksasoglu.com/2014/06/18/creating-classes-with-xml-files-using-net-4-5/

其中显示

如果无法将xml文件复制到剪贴板,则可能会注意到将XML粘贴为类"已禁用.

If you fail to copy the xml file to your clipboard, you may notice that "Paste XML as Classes" is disabled.

哇,那很容易.如果Microsoft考虑在灰色命令中加入一些工具提示,那会不会很棒?

Wow, that was easy. Wouldn't it have been great if Microsoft thought to include a little tool tip with those grayed out commands?

这篇关于为什么“将JSON作为类粘贴"?和“将XML粘贴为类";在Visual Studio中禁用(显示为灰色)命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆