Skip to content

Build failure on Linux via dotnet build #553

@roji

Description

@roji

When trying to do a simple dotnet build in src/Microsoft.Data.SqlClient/netcore/src, I get the error messages below (this also happens when doing dotnet msbuild at the root). This seems to be because TargetsUnix gets set to true in Directory.Build.props (since I'm running on Linux), but in Microsoft.Data.SqlClient.csproj OSGroup defaults to Windows_NT, which leads to setting TargetsWindows to true as well. This leads to both Windows and Unix file versions getting compiled.

As an aside, I'm wondering about the need to build a Unix vs. Windows version of the project - at the end of the day only one of them goes into the nupkg (presumably the Windows one). Is there some reason not to just compile with the Windows support, and have it throw at runtime on Unix (as it already does)? In other words, removing the conditional compilation based on platform would likely simplify various things here.

CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.FileTypes.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.SetThreadErrorMode.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SQLTypes/SqlFileStream.Windows.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Unix.cs(10,18): error CS0101: The namespace 'Microsoft.Data.SqlClient' already contains a definition for 'SqlColumnEncryptionCertificateStoreProvider' [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCngProvider.Unix.cs(22,18): error CS0101: The namespace 'Microsoft.Data.SqlClient' already contains a definition for 'SqlColumnEncryptionCngProvider' [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCspProvider.Unix.cs(22,18): error CS0101: The namespace 'Microsoft.Data.SqlClient' already contains a definition for 'SqlColumnEncryptionCspProvider' [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Unix.cs(25,32): error CS0111: Type 'SqlColumnEncryptionCertificateStoreProvider' already defines a member called 'DecryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Unix.cs(38,32): error CS0111: Type 'SqlColumnEncryptionCertificateStoreProvider' already defines a member called 'EncryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Unix.cs(50,32): error CS0111: Type 'SqlColumnEncryptionCertificateStoreProvider' already defines a member called 'SignColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCertificateStoreProvider.Unix.cs(63,30): error CS0111: Type 'SqlColumnEncryptionCertificateStoreProvider' already defines a member called 'VerifyColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCngProvider.Unix.cs(37,32): error CS0111: Type 'SqlColumnEncryptionCngProvider' already defines a member called 'DecryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCngProvider.Unix.cs(50,32): error CS0111: Type 'SqlColumnEncryptionCngProvider' already defines a member called 'EncryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCngProvider.Unix.cs(61,32): error CS0111: Type 'SqlColumnEncryptionCngProvider' already defines a member called 'SignColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCngProvider.Unix.cs(73,30): error CS0111: Type 'SqlColumnEncryptionCngProvider' already defines a member called 'VerifyColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCspProvider.Unix.cs(37,32): error CS0111: Type 'SqlColumnEncryptionCspProvider' already defines a member called 'DecryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCspProvider.Unix.cs(51,32): error CS0111: Type 'SqlColumnEncryptionCspProvider' already defines a member called 'EncryptColumnEncryptionKey' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCspProvider.Unix.cs(63,32): error CS0111: Type 'SqlColumnEncryptionCspProvider' already defines a member called 'SignColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
Microsoft/Data/SqlClient/SqlColumnEncryptionCspProvider.Unix.cs(75,30): error CS0111: Type 'SqlColumnEncryptionCspProvider' already defines a member called 'VerifyColumnMasterKeyMetadata' with the same parameter types [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.FileTypes.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.GetFileType_SafeHandle.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Common/src/CoreLib/Interop/Windows/kernel32/Interop.SetThreadErrorMode.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]
CSC : error CS2001: Source file '/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SQLTypes/SqlFileStream.Windows.cs' could not be found. [/home/roji/projects/sqlclient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions