Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLProj Targets Wrong Framework Despite Explicit net6.0 Specification #330

Closed
walidmabdelal opened this issue Aug 29, 2023 · 2 comments · Fixed by #391
Closed

SQLProj Targets Wrong Framework Despite Explicit net6.0 Specification #330

walidmabdelal opened this issue Aug 29, 2023 · 2 comments · Fixed by #391
Assignees
Labels
area: build sdk Related to Microsoft.Build.Sql SDK bug Something isn't working

Comments

@walidmabdelal
Copy link

  • SqlPackage or DacFx Version: microsoft.build.sql/0.1.10-preview
  • .NET Framework (Windows-only) or .NET Core: N/A
  • Environment (local platform and source/target platforms): Kali rolling 2023.3- 6.3.0-kali1-amd64

Steps to Reproduce:

  1. Create a new SQLproj in VS Code using SQL Sever 2022
  2. (Optiona) set the framework to net6.0 in the .sqlproj
  3. dotnet build or dotnet restore with detailed verbosity
  4. Check the generated log or the projects.assets.json
    restore.log

Below is the projects.assets.json showing the net46 as the referenced assembly
{ "version": 3, "targets": { ".NETFramework,Version=v4.6": { // ... // (other settings) // ... } }, "projectFileDependencyGroups": { ".NETFramework,Version=v4.6": [ "Microsoft.NETFramework.ReferenceAssemblies >= 1.0.0" ] }, "project": { "restore": { "originalTargetFrameworks": [ "net6.0" ], "frameworks": { "net46": { "targetAlias": "net6.0", // ... } } }, "frameworks": { "net46": { "targetAlias": "net6.0", // ... } } } }

Below is the output of dotnet info:

`┌──(astraeus㉿localhost)-[~/neuroX/ICE/ICE/ICE.Services/DocumentManager-MS/ICE.Services.DocumentManager.DB.SQL]
└─$ dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.413
Commit: 10710f7d8e

Runtime Environment:
OS Name: kali
OS Version: 2023.3
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/6.0.413/

Host:
Version: 7.0.10
Architecture: x64
Commit: a6dbb800a4

.NET SDKs installed:
6.0.413 [/usr/share/dotnet/sdk]
7.0.400 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.21
Microsoft.AspNetCore.App 7.0.10
Microsoft.NETCore.App 6.0.21
Microsoft.NETCore.App 7.0.10
Other architectures found:
None

Environment variables:
Not set

global.json file:
/home/astraeus/neuroX/ICE/ICE/global.json`

and here's the global.json for the project:

{ "sdk": { "version": "6.0.413" } }

Did this occur in prior versions? If not - which version(s) did it work in?

microsoft.build.sql/0.1.10-preview

@walidmabdelal walidmabdelal added the bug Something isn't working label Aug 29, 2023
@dzsquared dzsquared added the area: build sdk Related to Microsoft.Build.Sql SDK label Sep 13, 2023
@keithnicholson
Copy link

I am seeing a similar issue, yet I set my version to 6.0.414.

My .proj file

database-project {1DF1814C-4D86-4B32-AC14-9DDFD3D868AD} Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider 1033, CI True 7 True ---------------------------------------------------

My global.json file:


{
"sdk": {
"version": "6.0.414"
}
}

Here is the results of my dotnet --Info command


.NET SDK (reflecting any global.json):
Version: 6.0.414
Commit: dc3b5c4341

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.414\

Host:
Version: 7.0.10
Architecture: x64
Commit: a6dbb800a4

.NET SDKs installed:
6.0.414 [C:\Program Files\dotnet\sdk]
7.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
C:\Repos\azure-functions-sql-extension\samples\database-project\global.json

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download


and the results of dotnet build command:

MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
The project C:\Repos\azure-functions-sql-extension\samples\database-project\database-project.sqlproj is using CentralPackageVersionManagement, a NuGet preview feature.
C:\Repos\azure-functions-sql-extension\samples\database-project\database-project.sqlproj : error NU1008: Projects that use central package version management should not define the version on the PackageR
eference items but on the PackageVersion items: Microsoft.NETFramework.ReferenceAssemblies.
Failed to restore C:\Repos\azure-functions-sql-extension\samples\database-project\database-project.sqlproj (in 446 ms).

Build FAILED.

C:\Repos\azure-functions-sql-extension\samples\database-project\database-project.sqlproj : error NU1008: Projects that use central package version management should not define the version on the PackageR
eference items but on the PackageVersion items: Microsoft.NETFramework.ReferenceAssemblies.
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:03.37

The generated packages.lock.json file:


{
"version": 2,
"dependencies": {
".NETFramework,Version=v4.6": {}
}
}

@SchabaJo
Copy link

Hi! What's the status on this? All our projects use net6.0, except the database projects.

zijchen added a commit that referenced this issue Feb 9, 2024
zijchen added a commit that referenced this issue Feb 16, 2024
* Add pr-validation

* Add DacFx.sln to tests

* Add dotnet pack command

* Change default target to netstandard2.1

* Add NetcoreBuild property

* Add a test for #330

* Check for dotnet in DOTNET_INSTALL_DIR

* Use /usr/share/dotnet

* Change dotnet variable and fail fast

* Fix matrix

* Add dotnet restore

* Add target framework to dotnet restore

* Revert yml changes

* Try matrix again

* Change fail fast to false

* Add target framework

* Add test for #278

* Move target framework to sdk.props
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build sdk Related to Microsoft.Build.Sql SDK bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants