sdk: dotnet sln add returns 'Project 'foo.csproj' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.'
Steps to reproduce
- Create a new SDK project (
dotnet new consoleis fine) - Change the csproj so that it targets more than one framework (
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>, for example) - Create a new solution using the CLI (
dotnet new sln) - Try to add the project from step 1 to the solution created in step 3 (
dotnew sln <sln> add <csproj>)
Expected behavior
Project 'foo.csproj' added to the solution.- Project is added to the solution
Actual behavior
Project 'foo.csproj' has an unknown project type and cannot be added to the solution file. Please contact your SDK provider for support.- Project is not added to the solution
More details
dotnet build on the project just works, so it doesn’t look like an issue with targeting packs.
Environment data
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.300
Commit: adab45bf0c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.300\
Host (useful for support):
Version: 2.1.0
Commit: caa7b7e2ba
.NET Core SDKs installed:
1.1.9 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 25 (15 by maintainers)
Commits related to this issue
- adding projects to sln. note: https://github.com/dotnet/cli/issues/9477 — committed to confluentinc/confluent-kafka-dotnet by deleted user 6 years ago
- adding projects to sln. note: https://github.com/dotnet/cli/issues/9477 — committed to confluentinc/confluent-kafka-dotnet by deleted user 6 years ago
- Ensure DefaultProjectTypeGuid is set when cross-targeting. For C# and VB projects that are cross-targeted, the cross-targeting targets are evaluated from the root project and not the "current version... — committed to peterhuene/msbuild by deleted user 6 years ago
- Implement a workaround for DefaultProjectTypeGuid and cross-targeting. Currently MSBuild only sets the `DefaultProjectTypeGuid` property from the language properties for a project that is not cross-t... — committed to peterhuene/sdk by deleted user 6 years ago
I can reproduce. Apparently the default MSBuild props isn’t defaulting the project type guids for a multi-targeted project. We may need a fix on their side, as the command is now relying on MSBuild to default the type so that we don’t blindly assign everything to be a C# project that’s missing one like we were doing previously.
Thanks @heemskerkerik for first reporting this issue. A fix has been made to the 2.1.4xx branch and should ship in the upcoming 2.1.400 version of the .NET Core SDK. As such, I’m closing this issue as fixed. Please re-open if you have any questions or concerns. Thanks!
@peterhuene Can confirm that adding
<DefaultProjectTypeGuid>FAE04EC0-301F-11D3-BF4B-00C04F79EFBC</DefaultProjectTypeGuid>works in 2.1.300.