WebApplicationFactory - DirectoryNotFoundException when using AssemblyName
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Describe the bug
In integration test when project we are testing has AssemblyName attribute we have DirectoryNotFoundException. After investigation it looks like this code https://github.com/dotnet/aspnetcore/blob/c272436a9e5dd42662d5f7eb5451c0eb0fc805c9/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs#L290-L292
is searching for dependecies by project default names - not respecting that it could be changed by AssemblyName.
### To Reproduce
1. Create sample ASP.NET Core project
2. Add AssemblyName with some custom name
3. Add integrastion test project (WebApplicationFactory) and try to execute sample controller
### Exceptions (if any)
DirectoryNotFoundException is raised
### Further technical details
- ASP.NET Core version - 3.1, Microsoft.AspNetCore.Mvc.Testing - Version=3.1.8
- Include the output of `dotnet --info`
.NET SDK (reflecting any global.json):
Version: 5.0.102
Commit: 71365b4d42
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.102\
Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96
.NET SDKs installed:
5.0.101 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
VS 16.8.4
Contributor guide
Assessment
This issue has not been assessed yet.