-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
FileNotFoundException: Microsoft.AspNetCore.Razor.Runtime #710
Comments
This will likely be due to an assembly version conflict, or an invalid assembly binding redirect, and nothing directly related to Moq. Check if there are any warnings during the build or in the build log.Check for NuGet version conflicts & update packages where necessary. Check whether your assembly binding redirects are up-to-date & correct (if you have any at all). Possibly delete them all and configure your project to generate them automatically during build. Make sure you're using up-to-date tool versions. That's the usual suggestions I'd hand out to anyone having this kind of problem. Closing this issue, since it is very likely unrelated to Moq. If you think this is in error, and there's something that needs to be done at Moq's end, please let us know. |
I don't have that assembly installed on my test project. Could that be it? But why would that assembly be needed for such a simple class with 5 properties? It's probably an error on my side, because it doesn't make sense that it has anything to do with Moq. Was just wondering if anyone had already experienced a similar issue. |
Perhaps try publishing your application and see what dependencies get copied to the Sometimes the "Consolidate NuGet packages" dialog in VS (accessible via the context menu on the solution node in Solution Explorer) gives hints about possible NuGet version conflicts. Perhaps also increase the build verbosity level to see if you have missed any messages.
I cannot tell, to be honest. The problem doesn't seem to lie with (That being said, If this turns out to be a problem with Moq after all, I am more than happy to reopen this issue. |
Even with the publish the dll doesn't appear in the folder, which makes it even stranger... |
@tiagodenoronha - I cloned your repository and ran the unit tests. They all pass. So yes, I'd say this is a problem with your setup or tooling. |
Well I installed Microsoft.AspNetCore.Razor.Runtime and aparently it now works... Weird.. |
I am still getting an error message "System.TypeLoadException: 'Could not load type 'Microsoft.AspNetCore.Razor.Parser.ParserBase' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.'" I included all of the following packages: Microsoft.AspNetCore.Razor |
I had a controller that was returning an anonymous class and in a xunit test I wanted to check its value. Following this answer, I set the return value to dynamic (wrapped in an OkObjectResult in an IActionResult) and encountered the above error in my unit test project:
Manually installing Microsoft.AspNetCore.Razor.Runtime v. 2.2.0 fixed the problem. But dotnet should have informed me about a missing package at compile time and not at runtime, right? |
Good afternoon,
I'm having some trouble figuring out why i'm getting this specified error when mocking an aparently normal object.
The exception is
Message: System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
I can provide a concrete test case where this happens.
https://github.com/tiagodenoronha/PlantsIdentifier/blob/feature/authentication/tests/PlantsIdentifierAPI.UnitTests/Controllers/LoginControllerTests.cs#L27
Running this test with the commented line fails.
Is it something i'm doing wrongly on my side?
Thanks!
The text was updated successfully, but these errors were encountered: