MSBuild.Sdk.SqlProj: Unknown target framework moniker

https://github.com/rr-wfm/MSBuild.Sdk.SqlProj/blob/e57fc2470b80ac277d2ccaf6b1336580ec3c88c9/src/DacpacTool/DacpacTool.csproj#L5

netcoreapp5.0 should be net5.0 The test project targets net5.0. In Visual Studio that leads to the error message:

Project ‘…..\src\DacpacTool\DacpacTool.csproj’ targets ‘netcoreapp2.1;netcoreapp3.1;netcoreapp5.0’. It cannot be referenced by a project that targets ‘.NETFramework,Version=v5.0’.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21 (18 by maintainers)

Most upvoted comments

I can get the MSBuild.Sdk.SqlProj itself to build nicely for target framework net6.0. However, building one of the test projects while using the net6.0 SDK fails with the following message:

  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  Using target framework net6.0 to run DacpacTool
  Using package name TestProject and version 1.0.0
  Setting property ServiceBrokerOption to value EnableBroker
  Setting property RecoveryMode to value Simple
  Setting property AllowSnapshotIsolation to value True
  Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   ---> System.PlatformNotSupportedException: Strong-name signing is not supported on this platform.
     at System.Reflection.AssemblyName.get_KeyPair()
     at Microsoft.Data.Tools.Schema.Extensibility.ExtensionTypeLoader.ExtensionAssemblies.CreateAssemblyName(String partialName, AssemblyName templateName)

The command leading to this exception:

/Sdk.targets(228,5): error MSB3073: The command "dotnet “/Sdk/…/tools/net6.0/DacpacTool.dll” build -o “obj/Debug/netstandard2.0/TestProject.dacpac” -n “TestProject” -v “1.0.0” -sv Sql150 -i “obj/Debug/netstandard2.0/TestProject.InputFiles.txt” -p ServiceBrokerOption=EnableBroker -p RecoveryMode=Simple -p AllowSnapshotIsolation=True " exited with code 1.

Adding a global.json to force SDK 5.0.401 resolves the issue, so I find it reasonable to assume that the problem is related to using the current net6.0 SDK.

Any ideas on how to solve this?

I’m thinking that maybe we should do a 2.0 release in which we drop support for .NET Core 2.1 (since it is out of support) and add support for .NET 6 (since that is now Go Live) and include all of the other changes and include this change as well. For people that are still on .NET Core 2.1 they can stick with version 1.16 for now, but my guess is that most people use at least 3.1 so they can easily upgrade to 2.0.

@jeffrosenberg @ErikEJ What do you think?