Using WireMock in the IDE works fine, but when tests are ran outside of IDE failures occur due to AnyOf package not found #507

Closed
opened 2025-12-29 15:25:34 +01:00 by adam · 2 comments
Owner

Originally created by @bhehe on GitHub (Apr 7, 2023).

Describe the bug

After adding references to WireMock to my solution, when my Nuke build runs it executes all of the test projects via the command line 'dotnet test' passing in the arguments you'd expect; Nothing special or radical going on there.

As for the build itself, that too is pretty trivial and the only thing I can think of note is that we do an initial "Restore" step pointed to the Solution and then we do the build with the --no-restore switch since we explicitly did that already. The tests too are then flagged to not require a build since we did that explicitly in prior step.

In the IDE, everything compiles and all tests can be ran just fine - but the tests ran by the build via the cli fail with this message:

[ERR] Test: Testhost process for source(s) 'C:\Git\MyWorkStuff.dll' exited with error: Error:
[ERR] Test:   An assembly specified in the application dependencies manifest (MyWorkStuff.deps.json) was not found:
[ERR] Test:     package: 'AnyOf', version: '0.3.0'
[ERR] Test:     path: 'lib/netstandard2.1/AnyOf.dll'
[ERR] Test: . Please check the diagnostic logs for more information.
[ERR] Test: Test Run Aborted.
[ERR] Test: Target Test has thrown an exception

Expected behavior:

Running tests from the cli or the IDE should work. Any dependencies should be getting resolved by the build.

Test to reproduce

-- do not have a simple reproduction handy; I would have to create something specifically for that.

1 - Added refs to WireMock.NET and the associated xUnit package for it.
2 - Worked with WireMock in a 'test rig' and all was well.
3 - Ran all tests in the IDE and all was well.
4 - Ran our Nuke Build which uses 'dotnet' to restore => compile => run tests
5 - Failure occurs, from the 'test runner' so we know the restore/compile steps completed successfully.

n/a

Originally created by @bhehe on GitHub (Apr 7, 2023). ### Describe the bug After adding references to WireMock to my solution, when my Nuke build runs it executes all of the test projects via the command line '_dotnet test_' passing in the arguments you'd expect; Nothing special or radical going on there. As for the build itself, that too is pretty trivial and the only thing I can think of note is that we do an initial "Restore" step pointed to the Solution and then we do the build with the --no-restore switch since we explicitly did that already. The tests too are then flagged to not require a build since we did that explicitly in prior step. In the IDE, everything compiles and all tests can be ran just fine - but the tests ran by the build via the cli fail with this message: ``` [ERR] Test: Testhost process for source(s) 'C:\Git\MyWorkStuff.dll' exited with error: Error: [ERR] Test: An assembly specified in the application dependencies manifest (MyWorkStuff.deps.json) was not found: [ERR] Test: package: 'AnyOf', version: '0.3.0' [ERR] Test: path: 'lib/netstandard2.1/AnyOf.dll' [ERR] Test: . Please check the diagnostic logs for more information. [ERR] Test: Test Run Aborted. [ERR] Test: Target Test has thrown an exception ``` ### Expected behavior: Running tests from the cli or the IDE should work. Any dependencies should be getting resolved by the build. ### Test to reproduce -- do not have a simple reproduction handy; I would have to create something specifically for that. 1 - Added refs to WireMock.NET and the associated xUnit package for it. 2 - Worked with WireMock in a 'test rig' and all was well. 3 - Ran all tests in the IDE and all was well. 4 - Ran our Nuke Build which uses 'dotnet' to restore => compile => run tests 5 - Failure occurs, from the 'test runner' so we know the restore/compile steps completed successfully. ### Other related info n/a
adam added the invalid label 2025-12-29 15:25:34 +01:00
adam closed this issue 2025-12-29 15:25:35 +01:00
Author
Owner

@StefH commented on GitHub (Apr 7, 2023):

What framework is your main application and your test project?

@StefH commented on GitHub (Apr 7, 2023): What framework is your main application and your test project?
Author
Owner

@bhehe commented on GitHub (Apr 7, 2023):

It's all .NET 6.0 but I just returned to say disregard; It appears to have been a coincidence of timing with other package updates as it seems like my real root-cause is coming from taking an update on the Serilog.Sinks.xUnit package and remedying some versioning woes there.

I went back to a good baseline and added WireMock alone in isolation - no updates/no code changes and rules out its role in things. Sorry for the false alarm.

fwiw Sending kudos as well! This appears to be a great package and I'm just getting acquainted with it. I see lots of potential for using it beyond just integration testing.

@bhehe commented on GitHub (Apr 7, 2023): It's all .NET 6.0 but I just returned to say disregard; It appears to have been a coincidence of timing with other package updates as it seems like my real root-cause is coming from taking an update on the Serilog.Sinks.xUnit package and remedying some versioning woes there. I went back to a good baseline and added WireMock alone in isolation - no updates/no code changes and rules out its role in things. Sorry for the false alarm. fwiw Sending kudos as well! This appears to be a great package and I'm just getting acquainted with it. I see lots of potential for using it beyond just integration testing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#507