Microsoft.AspNetCore.Mvc, Version=2.2.0.0 is giving an error "System.IO.FileNotFoundException"
See original GitHub issueI have started using .Net Core 2.2 recently and I got one WebApp related test cases there, where I am using
TestServer
from
Microsoft.AspNetCore.TestHost
. While executing the test cases I am seeing below error:
System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.AspNetCore.Mvc, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at <my code related to Startup.ConfigureServices>
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder, IFeatureCollection featureCollection)
at <my test>
My Visual studio version is: Professional 2017 15.9.3. The same piece of code used to work with .Net Core 2.0. Is it kind of regression?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Could not load file or assembly 'Microsoft.AspNetCore. ...
Appreciate any help. The error is. System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Connections.Abstractions, ...
Read more >ASP.NET Core 3.1.0 site won't run - Could not load ...
I'm building an ASP.NET Core app, and it's stored on an Azure web ... System.IO.FileNotFoundException: Could not load file or assembly ...
Read more >.NET Framework app fails with "Could not load file or ...
Executing a .NET Framework 4.6.1 console app that references a .NET Standard 2.0 assembly fails with Unhandled Exception: System.IO.
Read more >VS2019 16.3 Azure Functions Tools fails build due to ...
AspNetCore.Mvc.Abstractions V2.2.0.0Closed - Fixed ... System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.
Read more >Active questions tagged nuget-package - Stack Overflow ...
I am using ASP.NET Core framework to build an API with Azure Key Vault. I tried to follow this tutorial but I am...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I fixed this by following this guide and adding a missing package reference to my integration test project.
I had to do a clean and restart of VS 2017 before the change allowed my tests to pass once more.
I have found the workaround, You need to install the package “
Microsoft.AspNetCore.Mvc
”, the latest version though it’s not required by your project. I thinkTesHost
package is referring to old version and that’s why this issue occurred.