简体   繁体   English

无法在project.json中注释dnxcore(非法字符错误)

[英]Cannot comment dnxcore in project.json (Illegal character error)

I have a strange problem when I comment out the dnxcore in the asp.net 5 (or a library) project. 当我注释掉asp.net 5(或库)项目中的dnxcore时,我遇到一个奇怪的问题。 If I want to run only on .net framework (dnx), then I can delete the dnxcore from the project.json which works fine, but when I just comment it out there is an error that it's an illegal symbol: 如果我只想在.net Framework(dnx)上运行,则可以从project.json删除dnxcore,它可以正常工作,但是当我将其注释掉时,出现一个错误,它是一个非法符号:

在此处输入图片说明

Seems like a bug in VS or framework to me, is there any way to fix it? 对我来说,好像是VS或框架中的错误,有什么办法可以解决?

PS I want to turn dnxcore off because the Azure Storage 6.0.0 does not support it, though I guess this is irrelevant to the question PS我想关闭dnxcore,因为Azure Storage 6.0.0不支持它,尽管我想这与问题无关

The DNX json parser doesn't support comments. DNX json解析器不支持注释。 More details here: https://github.com/aspnet/Announcements/issues/24 此处有更多详细信息: https : //github.com/aspnet/Announcements/issues/24

It seems that comments in json are not supported at all, so the bug here is that Visual Studio shows them in green as if it's real comment. 似乎根本不支持json中的注释,因此这里的错误是Visual Studio以绿色将它们显示为真实注释。 More details on json comments in another post . 有关json注释的更多详细信息,请参见另一篇文章

Instead of commenting out the data, can you instead give it a different name? 除了注释掉数据之外,您还可以给它改一个名称吗?

...
"frameworks": {
  "dnx451": {}

  "//dnxcore50": {
    "dependencies": {
...

The idea here being that since JSON doesn't support comments, you can change the name of the property and it will be ignored. 这里的想法是,由于JSON不支持注释,因此您可以更改属性的名称,它将被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM