C# 安装ASP.NET 5.0版本的System.ServiceModel.Syndication

C# 安装ASP.NET 5.0版本的System.ServiceModel.Syndication,c#,.net,asp.net-mvc,visual-studio,rss,C#,.net,Asp.net Mvc,Visual Studio,Rss,我正在一个ASP.NET Web应用程序项目(它是MVC)中,在Visual Studio 2015 CTP 6中构建一个C#类。该类需要读取RSS提要,根据这一点,最好的方法是通过System.ServiceModel.Syndication名称空间 我尝试通过右键单击Visual Studio的解决方案资源管理器中web.app文件夹下的References来添加此操作所需的DLL。然后我选择了添加引用。。。在对话框中,没有列出任何ASP.NET 5.0库;它只列出了各种库的4.0版本。所以

我正在一个ASP.NET Web应用程序项目(它是MVC)中,在Visual Studio 2015 CTP 6中构建一个C#类。该类需要读取RSS提要,根据这一点,最好的方法是通过
System.ServiceModel.Syndication
名称空间

我尝试通过右键单击Visual Studio的解决方案资源管理器中
web.app
文件夹下的
References
来添加此操作所需的DLL。然后我选择了添加引用。。。在对话框中,没有列出任何ASP.NET 5.0库;它只列出了各种库的4.0版本。所以我添加了
System.ServiceModel
(4.0.0.0)

现在Visual Studio将抛出以下错误:

...\src\web.app\Models\RssFeedModels.cs(4,14): ASP.NET Core 5.0 error CS0234: The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?)
...\src\web.app\Models\RssFeedModels.cs(21,17): ASP.NET Core 5.0 error CS0246: The type or namespace name 'SyndicationFeed' could not be found (are you missing a using directive or an assembly reference?)
...\src\web.app\Models\RssFeedModels.cs(25,20): ASP.NET Core 5.0 error CS0103: The name 'SyndicationFeed' does not exist in the current context
这是我的
RssFeedModels.cs
课程:

using System;
using System.Collections.Generic;
using System.Xml;
using System.ServiceModel.Syndication;

namespace web.app.Models
{
    public class Rss
    {
        public string Title { get; set; }
        public string ContentSnippet { get; set; }
        public string Content { get; set; }
        public string PubDate { get; set; }
    }

    public class RssFeedModels
    {
        private XmlReader reader;
        private SyndicationFeed feed;

        public RssFeedModels(string url) {
            reader = XmlReader.Create(url);
            feed = SyndicationFeed.Load(reader);
        }
    }
}
我如何解决这个问题?多谢各位

更新:按照
heymega
的建议修改了
project.json
文件。以下是
project.json
文件相关部分的内容:

"commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
    "gen": "Microsoft.Framework.CodeGeneration",
    "ef": "EntityFramework.Commands",
    "run": "run"
},

"frameworks": {
    "dnx451": { },
    "dnxcore50": { },
    "aspnet50": {
        "dependencies": {
            "Microsoft.AspNet.Mvc": "6.0.0-beta2"
        },
        "frameworkAssemblies": {
            "System.ServiceModel": "4.0.0.0"
        }
    }
},
这会引发许多错误,首先是:

The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?) web.app.DNX 4.5.1

System.ServiceModel
尚未移植到
ASP.NET 5
,因此不能将其用作核心库的一部分

您应该能够包括标准
aspnet50
项目(非核心)的参考


在尝试添加WCF服务引用时,我问了一个类似的问题。

任何想知道的人,这都会进入
project.json
文件。如何修改project.json文件?它已经有项目了。我们要把这个加进去吗?Thanksys-您可以手动添加或删除project.json中的依赖项。VisualStudio监视该文件中的更改,并将在幕后添加和删除实际引用。试一试:)当我将上述代码添加到
project.json
文件时,它会抛出1167个错误。请参阅我对上述问题的更新。我在DNX Core WCF GitHub页面上创建了一个问题。请添加您的支持。完成。谢谢,@rehanseed.您解决了这个“服务模型”问题了吗?我想使用“ServiceModel”从vnext web app与windows服务通信,但有类似的错误。。。
{
    "commands": {
        "run": "run"
    },
    "frameworks": {
        "aspnet50": {
            "dependencies": {
                "Microsoft.AspNet.Mvc": "6.0.0-beta2"
            },
            "frameworkAssemblies": {
                "System.ServiceModel": "4.0.0.0"
            }
        }
    }
}