-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0 #2585
Comments
I got the same problem also running on a .NET 6 project, but only when running using .NET 7 SDK. My project is a .NET 6 project that I'm looking forward to upgrading to .NET 7 later. I have .NET 6 and 7 installed on the machines. And I have a When the When I set the version to only allow .NET 6 in So, the failing scenario is building .NET 7 SDK while targeting .NET 6 runtime. |
To help testing, make sure that you run |
@Meligy May I ask you where to put this global.json file you referred to ? Should it be the root project or solution directory ? For me it didn't help (placed in solution directory) but let me double check it. |
@Meligy I can confirm that your approach helped. I did sth like this and it started build without any problems.
Maybe I had wrong file name and this is why it was not working for me initially, but now after using this command I made sure that this file was created properly and my project is building without any issues. Thanks for the hint.. |
I'm currently facing the same issue - my problem is, that I have to have the .Net 7 SDK in my |
@TobiasBreuer I would advise to try out to put global.json file in the project itself which requires "downgrade" As I found somewhere dotnet is traversing filesystem to look for that file so I assume global.json file on the level of solution will be overwritten by the file in the project itself but this is only my assumption.. The global. json file in the root of your project (or even in the root of your file system as the SDK will traverse the file system until it finds one) allows defining which version of the SDK to use. So the question is whether dotnet looks for first global.json and then it will stop searching further or it could be overwritten by the next one found 1+ level deeper in the filesystem But I think as you said the easiest way (if that will not work) is to split projects then.. |
Im getting the same error with a .net core API project using 6.0 SDK. I'm getting this error while publishing the project to azure which was working perfectly fine before updating VS to the latest version. |
We are also facing same issue. We had projects targeting 5.0 but build with 7.0. Build runs fine when in release mode but in debug mode I get the same error because of post build script that tries to generate swagger json. I updated to 6.0 and still faced the problem. It only worked after adding global json as mentioned above. |
I too am encountering this error. I updated to the latest version of .NET 7 SDK such that i get > dotnet --version
7.0.201 and while I have some old SDK versions hanging around according to |
> dotnet --version
7.0.203 is also affected and downgrading to 53 days later since @danielloganking question. Any news on 6.5.0? |
We have a scenario in Visual Studio Web Tools - configuring Power Platform on .NET Web API projects - where we install the Swashbuckle CLI as a local tool. This is a blocking issue for .NET 6 Web API projects, any word on whether this will be fixed in the next update? |
I have checked, and the issue is due to the use of different versions of .NET at runtime. |
Does this mean that even if I have only the .NET 7 SDK installed and use it to run an app or project which targets |
This fails too, I dont have .NET 7 separately installed, but it comes from the Visual Studio 2022 installation. dotnet --info Runtime Environment: Host: .NET SDKs installed: .NET runtimes installed: Other architectures found: Environment variables: global.json file is set at the repository root Learn more: Download .NET: Downgrading to 6.4.0 does fix the issue |
+1 |
@eslamisepehr Is there a workaround besides downgrading to Swashbuckle 6.4.0? |
I created a fork of this repository, because I couldn't wait for the maintainer. Change the csproj nuget reference -<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
+<PackageReference Include="DotSwashbuckle.AspNetCore" Version="1.0.2" /> Install the dotnet tool
1.0.2 is the first working version. I am planning to maintain that repository at least until this repository picks up with the development, so if you are interested using it you can post issues or open PRs there. |
I'm going to close this in favour of #2792, as going through triaging the open issues I'm spotting a common theme and it's easier to manage one issue. Please track that issue for further updates. If this issue isn't resolved once we have added support for |
I ran into an issue when I was trying to generate swagger.json file using swashbuckle.aspnetcore.cli in version 6.5.0 on machine with .net sdk installed in both versions (6 and 7)
dotnet --info:
.csproj:
After uninstalling .net 7 sdk it started working properly. Compilation succeeded. swagger.json file were properly re-built.
Putting global.json file didnt help much
The text was updated successfully, but these errors were encountered: