Improve exception message if deps.json not found when using WebApplicationFactory<T> #29892
Comments
|
@martincostello thanks for contacting us. We don't expect people to reference this package transitively, but I would be ok if we update it for the targets to be loaded when referenced transitively. The change here would be to add a \buildTransitive folder to the package with props/targets that import the ones within the \build directory. |
|
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
|
Cool thanks @javiercn - I'd be happy to pick that up a do a PR to make the change. |
|
@martincostello we would be happy to accept a PR for it. |
|
Thanks! |
Add a buildTransitive targets file to load the main MSBuild targets so that transitive references to the package will also run the target to copy the deps.json files. Resolves dotnet#29892.
Is your feature request related to a problem? Please describe.
When using the
WebApplicationFactory<T>class in tests, if theMicrosoft.AspNetCore.Mvc.TestingNuGet package is referenced transitively, rather than directly in the test project, then an exception may be thrown with this message if thedeps.jsonfile of the assembly containing the startup classTisn't otherwise somehow copied to the test output folder:aspnetcore/src/Mvc/Mvc.Testing/src/Resources.resx
Lines 126 to 128 in c925f99
The resolution is to add a direct reference to
Microsoft.AspNetCore.Mvc.Testingin the project file so that the target to copy the.deps.jsonfiles during the build are run:aspnetcore/src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.targets
Lines 61 to 69 in ee14861
Describe the solution you'd like
Preferred solution: if possible, the target runs even when the NuGet package is included as a transient dependency.
Alternative solution: Update the error message to include checking that
Microsoft.AspNetCore.Mvc.Testingis explicitly referenced in the tests' project file.The text was updated successfully, but these errors were encountered: