aspnet mvc razor和dnx 1.0.0-rc1-update1 clr x86中的错误CS1704

时间:2016-02-21 13:28:20

标签: c# asp.net-mvc razor kendo-asp.net-mvc dnx

我在Visual Studio 2015 Update 1中遇到错误:

  

错误CS1704:具有相同简单名称的程序集' Kendo.Mvc'已经进口了。尝试删除其中一个引用(例如   ' Kendo.Mvc.dll')或签名并排启用。

我清理了缓存,临时文件asp net,我尝试了另一个版本的Kendo,我更新并重新安装了dnx并使用x86和x64进行了测试。我不知道还能做什么。

我的project.json是:

{
  "webroot": "wwwroot",
  "version": "1.0.0-*",

  "dependencies": {
    "EPPlus": "4.0.5",
    "eVC": "1.0.0-*",
    "eVDTO": "1.0.0-*",
    "eVR": "1.0.0-*",
    "Kendo.Mvc": "2016.1.112",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1-*",
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-*",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-*",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta7-*",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-*",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-*",
    "Microsoft.AspNet.Session": "1.0.0-rc1-*",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-*",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-*",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-*",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-*",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-*",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-*",
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-*",
    "NPOI": "2.1.3.1"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "deployment": "Microsoft.AspNet.Hosting --ASPNET_ENV production --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost/eV",
    "web2": "Microsoft.AspNet.Server.Kestrel --server.urls=http://localhost:5000",
    "gen": "Microsoft.Framework.CodeGeneration"
  },

  "frameworks": {
    "dnx451": {
    }
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],

  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],

  "scripts": {
    "postrestore": [ "npm install", "bower install" ],
    "prepare": [ "gulp copy" ]
  }
}

在Startup.cs中:

    public void ConfigureServices(IServiceCollection services)
    {
        // Add framework services.
        //services.AddApplicationInsightsTelemetry(Configuration);

        services.AddMvc();
        services.AddCaching(); // Adds a default in-memory implementation of IDistributedCache
        services.AddSession();
        services.AddKendo();
    }

2 个答案:

答案 0 :(得分:1)

一位同事找到了答案。这是一个临时解决方案(解决方法),但有效。

在Visual Studio 2015中>工具>选项>调试>一般我们有标记选项:

- 使用托管兼容模式

- 使用旧版C#和VB表达式评估程序

Visual Studio 2015 > Tools > Options > Debugging > General

答案 1 :(得分:0)

我认为如果你删除所有相关的引用(来自nuget或不是),清理你的项目,然后通过nuget再次添加引用,它将解决你的问题。