Skip to content

Could not load file or assembly "System.Interactive.Async" #1818

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

Closed
subprime opened this issue Nov 15, 2016 · 6 comments
Closed

Could not load file or assembly "System.Interactive.Async" #1818

subprime opened this issue Nov 15, 2016 · 6 comments

Comments

@subprime
Copy link

I'm trying to use scaffolding with aspnet-codegenerator but it fails with the following error message: Could not load file or assembly "System.Interactive.Async"

In my console window i write this command:

D:\855 ASP.NET\CMC\src\CMC>dotnet aspnet-codegenerator -p "D:\855 ASP.NET\CMC\src\CMC" controller -name ProjectController -m Project -dc CMC.Models.CMCContext
Building project ...
Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to compile the application in memory
Attempting to figure out the EntityFramework metadata for the model and DbContext: Project
Could not load file or assembly 'System.Interactive.Async, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. Das System kann die angegebene Datei nicht finden. StackTrace:
   at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddQuery(IServiceCollection serviceCollection)
   at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServiceCollectionExtensions.AddEntityFramework(IServiceCollection serviceCollection)
   at Microsoft.EntityFrameworkCore.Infrastructure.RelationalServiceCollectionExtensions.AddRelational(IServiceCollection services)
   at Microsoft.Extensions.DependencyInjection.SqlServerServiceCollectionExtensions.AddEntityFrameworkSqlServer(IServiceCollection services)
   at CMC.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.EntityFrameworkServices.TryCreateContextUsingAppCode(Type dbContextType, ModelType startupType)
Could not load file or assembly 'System.Interactive.Async, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. Das System kann die angegebene Datei nicht finden.
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:38.43

If the assembly added with nuget then i also get this error.

My project.json looks like this:

{
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.1.0-*"
    },
    "Microsoft.AspNetCore.Authentication": "1.0.0",
    "Microsoft.AspNetCore.Authorization": "1.1.0-*",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0-*",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0-*",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-preview1-final",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.EntityFrameworkCore": "1.1.0-preview1-final",
    "Microsoft.EntityFrameworkCore.Design": "1.0.1",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0-preview1-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-*",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.0.0-*",
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.0.0-preview3-final",
    "System.Interactive.Async": "3.0.0"
  },
  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8",
        "portable-net45+win8+wp8+wpa81"
      ]
    }
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "web.config"
    ]
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview3-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview3-final",
      "imports": [ "portable-net45+win8+wp8+wpa81" ]
    }
  }
}
@Shavakan
Copy link

Shavakan commented Jan 6, 2017

I'm experiencing the same issue on a slightly different environment, couldn't figure out a working solution yet.

In my case I'm trying to use EF Core 1.0 on a project targeting .NET Framework 4.6.1.

It looks to me that Microsoft.EntityFrameworkCore dll fails to access System.Interactive.Async dll and raises a FileNotFoundException.

Weird part is that System.Interactive.Async dll is fully specified in .csproj file (although hinting to a different version) and present in packages folder just underneath the solution folder.

@RobertTaylor0806
Copy link

Has anyone figured this issue out yet? I think Shavakan is on the right track and I'm seeing the same issue but just can't figure out why it's happening.

I'm using Visual Studio Community 2015 and was unable to run the Update 3 before installing ASP.NET Core and had to do a lot of manual patching to get everything working so in my case I'm wondering if that has something to do with my issue?

@KhalilMohammad
Copy link

In the project.json remove enityFramecore rc 7.0

@sfmskywalker
Copy link
Contributor

I'm having this same issue:

image

It makes sense in my case, since something caused the System.Interactive.Async package to be bumped up to v3.1.1.0, while EF Core clearly is looking for 3.0.0.0.

So for me, this fix is to add an assembly binding in app.config like so:

<dependentAssembly>
    <assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.0.0" />
</dependentAssembly>

@sundeepyama
Copy link

I had the same issue and @sfmskywalker solution worked for me. Thanks!!!

<dependentAssembly>
    <assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.1.0" />
</dependentAssembly>

@Eilon
Copy link
Contributor

Eilon commented Jan 11, 2018

Closing because there doesn't seem to be any further action required on this issue.

@Eilon Eilon closed this as completed Jan 11, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants