Auto-generated Program.cs does not have a namespace
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
I upgraded to .NET 10, and read that the Program.cs can get auto-generated for WebApplicationFactory tests, so no need for the `public partial class Program { }` declaration anymore.
But I have an API and a Console App in my solution that both are referenced by my test project.
So when I try to use the auto-generated Program.cs, I get the
`error CS0433: The type 'Program' exists in both 'MyAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'MyConsoleApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'`
Previously I did wrap my API Program.cs in the project's namespace like this:
```
namespace MyAPI
{
public partial class Program { }
}
```
I suggest that the new auto-generated version gets the projects base namespace appended at the top so that this can be used by solutions with more than 1 project.
Contributor guide
Assessment
This issue has not been assessed yet.