Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with my configuration: Could not load file or assembly 'System, Version=4.0.0.0 ... #2153

Closed
guardrex opened this issue May 9, 2015 · 8 comments
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@guardrex
Copy link

guardrex commented May 9, 2015

Feels like I haven't configured something correctly. This is a CoreCLR project on Win7 x64 with runtime dnx-coreclr-win-x64.1.0.0-beta5-xxxxx. Latest xxxxx is 11760 (5/14).

project.json dependencies

EntityFramework.SqlServer: 7.0.0-beta5-*
EntityFramework.Commands: 7.0.0-beta5-*

project.json commands

"ef": "EntityFramework.Commands"

Startup.cs ConfigureServices

services.AddEntityFramework()
    .AddSqlServer()
    .AddDbContext<DbDbContext>(options => options.UseSqlServer(config.Get("Database")));

Model

namespace MyApp.Models {
    public class DbDbContext : DbContext {

        public DbSet<Test> Tests { get; set; }

        protected override void OnModelCreating(ModelBuilder builder) {
            builder.Entity<Test>().Property(typeof(int), "id").ForSqlServer().UseIdentity();
            base.OnModelCreating(builder);
        }

    }

    public class Test {
        [Key]
        public int id { get; set; }
        public string field1 { get; set; }
        public int field2 { get; set; }
    }
}

Executing from an elevated command line dnx . ef results in ...

System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
File name: 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System'
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.Data.Entity.Relational.Design.Templating.Compilation.MetadataReferencesProvider.AddDefaultReferences()
   at Microsoft.Data.Entity.Commands.DatabaseTool..ctor(IServiceProvider serviceProvider, ILoggerProvider loggerProvider)
   at Microsoft.Data.Entity.Commands.Program..ctor(IServiceProvider serviceProvider, IApplicationEnvironment appEnv, ILibraryManager libraryManager, IRuntimeEnvironment runtimeEnv)
System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System'
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
@rowanmiller rowanmiller added this to the 7.0.0 milestone May 11, 2015
@bricelam
Copy link
Contributor

@guardrex could you share your full project.json file?

@bricelam bricelam modified the milestones: Investigation, 7.0.0 May 11, 2015
@guardrex
Copy link
Author

Sure ...

{
  "webroot": "wwwroot",
  "version": "1.0.0",
  "authors": [ "XXXXXX" ],
  "description": "XXXXXX",
  "copyright": "XXXXXX",
  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta5-*",
    "Microsoft.AspNet.Hosting": "1.0.0-beta5-*",
    "Microsoft.AspNet.Mvc": "6.0.0-beta5-*",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5-*",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5-*",
    "Microsoft.AspNet.Server.IIS": "1.0.0-beta5-*",
    "Microsoft.AspNet.StaticFiles": "1.0.0-beta5-*",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5-*",
    "Microsoft.Framework.ConfigurationModel": "1.0.0-beta5-*",
    "System.Net.Http": "4.0.0-beta-*",
    "System.Net.Sockets": "4.0.0-beta-*",
    "System.Net.Security": "4.0.0-beta-*",
    "System.ComponentModel.TypeConverter": "4.0.0-beta-*",
    "xunit.runner.aspnet": "2.0.0-aspnet-beta5-*",
    "EntityFramework.SqlServer": "7.0.0-*",
    "EntityFramework.Commands": "7.0.0-*",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4"
  },
  "commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
    "test": "xunit.runner.aspnet",
    "ef": "EntityFramework.Commands"
  },
  "frameworks": {
    "dnxcore50": { }
  },
  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "node_modules",
    "gulpfile.js",
    "notes.txt",
    "NuGet.Config",
    "package.json",
    "stylesheets",
    "scripts",
    "obj",
    ".vs",
    "Views_debug",
    "fonts",
    "Properties",
    "**.user"
  ]
}

@guardrex
Copy link
Author

@bricelam If it doesn't look simple to repro from my description, I can put together a repo project for you.

@bricelam
Copy link
Contributor

Try updating this line to beta5-*:

"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4"

@guardrex
Copy link
Author

I tried both 7.0.0-* and 7.0.0-beta5-*, which gave me the same v.13033 package. Same result ... Could not load file or assembly System, Version 4.0.0.0 ...

@bricelam
Copy link
Contributor

@lajones, This is the issue @davidfowl and I mentioned in your first Templating PR.

@bricelam bricelam removed this from the Investigation milestone May 19, 2015
@bricelam bricelam removed their assignment May 19, 2015
@rowanmiller rowanmiller added this to the 7.0.0 milestone May 20, 2015
@lajones
Copy link
Contributor

lajones commented May 22, 2015

Fixed with #2251. Closing.
@guardrex - should be in tonight's build. Give it a try and please re-open if any problems.

@jpwits
Copy link

jpwits commented Jul 3, 2015

Hi,

the following configuration works for me 👍
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta4",
"Microsoft.AspNet.Authentication": "1.0.0-beta4",
"Microsoft.AspNet.WebUtilities": "1.0.0-beta4",
"Microsoft.AspNet.Http": "1.0.0-beta4",
"EntityFramework.SqlServer": "7.0.0-beta4",
"Microsoft.Framework.ConfigurationModel": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.AspNet.Authorization": "1.0.0-beta4",
"Microsoft.AspNet.Identity": "3.0.0-beta4",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"System.Net.Http": "4.0.0-beta-22816",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta4",
"System.Web.Http.Common": "4.0.20126.16343"

, do anyone have a config for EF latest beta 6...beta 4 gives me a 'Sequence contains more than one element' for any semi-complex query, then I have to break it down or ToList() it to query from there?

@rowanmiller rowanmiller modified the milestones: 7.0.0, 7.0.0-beta6 Jul 15, 2015
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
@ajcvickers ajcvickers modified the milestones: 1.0.0-beta6, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

6 participants