Skip to content

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

@guardrex

Description

@guardrex

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions