3

Currently trying to upgrade from beta 6 to beta 7 of ASP .NET 5 MVC 6. I followed the steps detailed here : How to upgrade ASP.NET 5 from Beta6 to Beta7 but I still have the assemblies issue :

Multiple assemblies with equivalent identity have been imported: '<in-memory-assembly>' and '<in-memory-assembly>'. Remove one of the duplicate references.

This blog gives some clue to solve it but unfortunately doesn't correspond to the case of my project.

I know that it is linked to the list of packages in project.json. Some solutions suggested Microsoft.Framework.Runtime.Abstractions but once again I don't have it in my list.

My project has several parts that sometimes refer to each other. The assembly issue occurs in two of them and I think it is linked since the error appears 8 times for each.

Here are the project.json for both :

{
    "webroot": "wwwroot",
    "version": "1.0.0-*",
    "dependencies": {
        "EntityFramework.SqlServer": "7.0.0-beta7",
        "EntityFramework.Commands": "7.0.0-beta7",
        "EntityFramework.Core": "7.0.0-beta7",
        "Microsoft.AspNet.Mvc": "6.0.0-beta7",
        "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta7",
        "Microsoft.AspNet.Diagnostics": "1.0.0-beta7",
        "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta7",
        "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta7",
        "Microsoft.AspNet.Server.IIS": "1.0.0-beta7",
        "Microsoft.AspNet.Loader.IIS": "1.0.0-beta7",
        "Microsoft.AspNet.Server.WebListener": "1.0.0-beta7",
        "Microsoft.AspNet.StaticFiles": "1.0.0-beta7",
        "Microsoft.Framework.Configuration": "1.0.0-beta7",
        "Microsoft.Framework.Configuration.Json": "1.0.0-beta7",
        "Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta5",
        "Microsoft.Framework.Logging": "1.0.0-beta7",
        "Microsoft.Framework.Logging.Console": "1.0.0-beta7",
        "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta7",
        "SSI.Domain": "",
        "SSI.Service": "",
        "log4net": "2.0.3",
        "jQuery.UI.Themes.smoothness": "1.8.9",
        "SSI.WordDocumentGenerator.Client": "1.0.0-*"
    },
    "commands": {
        "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
        "gen": "Microsoft.Framework.CodeGeneration",
        "ef": "EntityFramework.Commands"
    },
    "frameworks": {
        "dnx451": {
            "frameworkAssemblies": {
                "System.DirectoryServices": {
                    "version": "",
                    "type": "build"
                },
                "System.DirectoryServices.AccountManagement": {
                    "version": "4.0.0.0",
                    "type": "build"
                }
            }
        }
    },
    "exclude": [
        "wwwroot",
        "node_modules",
        "bower_components"
    ],
    "publishExclude": [
        "node_modules",
        "bower_components",
        "**.xproj",
        "**.user",
        "**.vspscc"
    ],
    "compilationOptions": {
        "warningsAsErrors": true
    }
}

-

{
    "version": "1.0.0-*",
    "description": "",
    "authors": [ "author" ],
    "tags": [ "" ],
    "projectUrl": "",
    "licenseUrl": "",

    "dependencies": {
        "SSI.Domain": "",
        "SSI.Service": "",
        "DocumentFormat.OpenXml": "2.5.0"
    },

    "frameworks": {
        "dnx451": {
            "dependencies": {
                "System.Collections": { "version": "4.0.0.0", "type": "build" },
                "System.Linq": { "version": "4.0.0-beta-23109", "type": "build" },
                "System.Threading": { "version": "4.0.10-beta-23109", "type": "build" },
                "Microsoft.CSharp": { "version": "4.0.0-beta-22816", "type": "build" }
            },
            "frameworkAssemblies": {
                "WindowsBase": { "version": "4.0.0.0", "type": "build" }
            }

        }
    }
}

I've tried to remove some packages, run a dnu restore to see if the error is still there and it always is, so I begin to run out of ideas...

Community
  • 1
  • 1
J. Schroeder
  • 43
  • 1
  • 7
  • try deleting the `system.*` references and deleting the `project.json.lock` files too? Deleting the lock files has solved mysterious problems for me in the past – fiat Sep 15 '15 at 02:06
  • Thanks, removing the System.* referencies in the second project.json helped me removing one assembly error out of the 8 :) – J. Schroeder Sep 15 '15 at 09:14

2 Answers2

2

It's hard to tell without seeing the whole project, but I'm guessing that the second JSON snippet is from your library. My guess is that it's your library that's causing the errors, and that just gets reported up into your web application.

Here are a few ideas:

  • Move your frameworks:dnx451:dependencies into frameworks:dnx451:frameworkAssemblies.
  • Remove the -beta identities in those System.* packages (odds are it's trying to grab Nuget packages instead of using your local system libraries)
  • Change the System.* version number to "4.0.0.0"
  • Switch to the less verbose reference syntax (i.e. remove "version" and "type", and just specify the version in quotes like "System.Linq": "4.0.0.0")
  • Remove Microsoft.CSharp
Brandon Martinez
  • 1,330
  • 1
  • 9
  • 13
  • 1
    Fixed it, thanks a lot ! The problem was in fact caused by Microsoft.CSharp. Moving it to dnx451:frameworkAssemblies caused a warning because of the 4.0.0-beta-22816 version but removed the assembly issues ! – J. Schroeder Sep 15 '15 at 09:15
0

I ran into this issue when I had added a class library to a web project. When I added the class library the project.json file frameworks looked like this ...

  "frameworks": {
    "dotnet": { }
  }

When I matched the frameworks of my web application the error was resolved.

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }
  }
JabberwockyDecompiler
  • 3,318
  • 2
  • 42
  • 54