dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

StartupObject in csproj ignored when running alternate projects in same dir #23658

Open NickLydon opened 2 years ago

NickLydon commented 2 years ago

Describe the bug

StartupObject in csproj is ignored when alternating between different projects in same directory.

To Reproduce

https://github.com/NickLydon/StartupObjectIssue

Exceptions (if any)

Further technical details

.NET SDK (reflecting any global.json): Version: 6.0.100 Commit: 9e8b04bbff

Runtime Environment: OS Name: Mac OS X OS Version: 11.0 OS Platform: Darwin RID: osx-x64 Base Path: /usr/local/share/dotnet/sdk/6.0.100/

Host (useful for support): Version: 6.0.0 Commit: 4822e3c3aa

.NET SDKs installed: 1.1.14 [/usr/local/share/dotnet/sdk] 2.1.812 [/usr/local/share/dotnet/sdk] 3.1.401 [/usr/local/share/dotnet/sdk] 3.1.404 [/usr/local/share/dotnet/sdk] 3.1.415 [/usr/local/share/dotnet/sdk] 5.0.100 [/usr/local/share/dotnet/sdk] 5.0.101 [/usr/local/share/dotnet/sdk] 5.0.201 [/usr/local/share/dotnet/sdk] 5.0.300 [/usr/local/share/dotnet/sdk] 5.0.403 [/usr/local/share/dotnet/sdk] 6.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

KalleOlaviNiemitalo commented 2 years ago

IIRC, with multiple projects targeting .NET Framework in the same directory, one had to set the BaseIntermediateOutputPath property to give each project a separate obj directory and prevent their NuGet-generated files from overwriting each other. With .NET 6, there might be more conflicts like that, perhaps in the bin directory as well. I am surprised it even works with the -p:StartupObject=Consumer option. Confluent should really change the tutorial not to recommend placing the projects in the same directory.

adityamandaleeka commented 2 years ago

Triage: this seems like an SDK issue. Transferring to dotnet/sdk.