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

Error CS1704 in aspnet mvc razor and dnx 1.0.0-rc1-update1 clr x86

我正在进入 Visual Studio 2015 更新 1 错误:

error CS1704: An assembly with the same simple name 'Kendo.Mvc' has already been imported. Try removing one of the references (e.g. 'Kendo.Mvc.dll') or sign them to enable side-by-side.

我清理了缓存、临时文件 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();
    }

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

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

在 Visual Studio 2015 > 工具 > 选项 > 调试 > 常规中我们标记了选项:

-使用托管兼容模式

-使用旧版 C# 和 VB 表达式计算器