-
Notifications
You must be signed in to change notification settings - Fork 152
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
NUnit Console 3.15.2: Could not load file or assembly "System.Windows.Forms" #1203
Comments
I forgot to mention that I also had problems with loading
This is why I think it is duplicate of #1202 |
The console runner makes no use whatsoever of the runtimeconfig file. Only the runner used by the dotnet command does that. |
If To show my problem in wider scope. I'm struggling with migration of quite big codebase which uses following toolset: Alternative for this is as far as I know is Currently I'm not able to run more than 60% of my tests/dlls with nunit-console due to reported issue. |
No, I'm not saying that you can't run your tests - although obviously there's an issue to solve. I'm just taking note of the side issue, which is that you mentioned using runtimesettings, which has only ever been used by the NUnit3 test adapter, not by nunit3-console.exe. The console has always relied on command-line options, which are of course not available to the adapter. |
Possible temporary workaround: After update of
|
We are having the same issue as @Kuling, although with WPF instead of Windows Forms. We are using:
In our case the exception is: The workaround above by manually editing |
I'm using @Kuling 's workaround as the base of the solution, modifying the project file so that the |
I think that the fix will also resolve #1202, but I have kept that open pending confirmation. |
The fix (in 3.16.0-dev00043) worked for us for WPF. |
@cw397 Thanks for checking! |
This issue has been resolved in version 3.16.0 The release is available on: |
@CharliePoole A slight unintended consequence of this fix... NUnit Console started failing on our test server when we upgraded to 3.16 (previously I'd only tried the fix on a development machine). The reason seems to be that because of the lines that are now present in the nunit-agent.runtimeconfig.json, NUnit Console now always needs the .NET Runtime, .NET Desktop runtime and ASP.NET Runtimes installed. Our test server does not have the ASP.NET runtimes installed so the agent fails to launch. It could be argued this is another bug? For the time being I have elected to manually edit the nunit-agent.runtimeconfig.json file to remove the ASP.NET Runtime lines, rather than install an additional runtime. Obviously people who use ASP.NET and not .NET Desktop will have the opposite issue, and some people might not need either. |
Ouch! I'll take another look at this for 3.16.1. |
@CharliePoole Is this issue fixed in 3.17.0? I know some weird versioning stuff happened, and I'm seeing what appears to be this issue in 3.17.0. |
@andrewimcclement Can you try it in the latest 3.18 dev build? See https://www.myget.org/feed/nunit/package/nuget/NUnit.Console/3.18.0-dev00062 |
Confirmed, System.Windows.Forms.dll issue is resolved on the 3.18 dev build.
However, until that point (which could be caused by my own code) I can see several tests running successfully (with both successes and failures). So I think this specific issue would count as resolved in the 3.18 dev build (I might just need to raise more issues, potentially). |
For now I am just switching over to using dotnet test (losing the speed of nunit3-console.exe is annoying, but correctness has to come first, of course). |
Hi
I'm in the process of migrating projects to .NET Core 6 from .NET Framework 4.7.2.
I've encountered problem that
System.Windows.Forms
could not be loaded when tests referencing such library are executed via nunut-console.However they can be executed without issues via
dotnet test
or directly from Visual Studio 2022 17.3 Preview 6.I believe this may be duplicate of #1202
My setup:
Repository with small project https://github.com/Kuling/nunit-console-test
You can find 2 bat files in root directory which allow to reproduce problem.
After execution of
run_via_nunitconsole.bat
you shall seeI suspect that this is related to runtimeconfig (Test1.runtimeconfig.json). https://docs.microsoft.com/en-us/dotnet/core/runtime-config/
I think nunit-console ignores it somehow.
When I manually remove Microsoft.WindowsDesktop.App from above file then
dotnet test
(executed viarun_via_dotnet_test.bat
) fails with the same error.The text was updated successfully, but these errors were encountered: