Skip to content
This repository has been archived by the owner on Nov 1, 2018. It is now read-only.

Target .NET Standard 1.4 & 2.0 #370

Merged
merged 2 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
<PackageReference Include="Internal.AspNetCore.Sdk" Version="$(InternalAspNetCoreSdkVersion)" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(OutputType)' == 'library' And '$(DisableImplicitFrameworkReferences)' != 'true'">
<PackageReference Include="NETStandard.Library" Version="$(NETStandardImplicitPackageVersion)" />
<!-- TODO: Remove when dotnet/sdk#1220 is fixed -->
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
<PackageReference Include="NETStandard.Library.NETFramework" Version="$(NETFrameworkPackageVersion)" PrivateAssets="All" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion build/dependencies.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project>
<PropertyGroup>
<CoreFxVersion>4.3.0</CoreFxVersion>
<CoreFxVersion>4.4.0-*</CoreFxVersion>
<InternalAspNetCoreSdkVersion>2.1.0-*</InternalAspNetCoreSdkVersion>
<NETFrameworkPackageVersion>2.0.0-*</NETFrameworkPackageVersion>
<NETStandardImplicitPackageVersion>$(BundledNETStandardPackageVersion)</NETStandardImplicitPackageVersion>
<SQLitePCLRawVersion>1.1.5</SQLitePCLRawVersion>
<StyleCopAnalyzersVersion>1.0.0</StyleCopAnalyzersVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Microsoft.Data.Sqlite.SqliteException
Microsoft.Data.Sqlite.SqliteFactory
Microsoft.Data.Sqlite.SqliteParameter
Microsoft.Data.Sqlite.SqliteTransaction</Description>
<TargetFrameworks>net451;netstandard1.2</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.4</TargetFrameworks>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you removed net451?

Copy link

@willdean willdean May 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because netstandard2.0 implies it. (Roughly)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's being replaced with .NET Standard 2.0, which is supported by .NET 4.6.1.

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>Microsoft.Data.Sqlite.Core.ruleset</CodeAnalysisRuleSet>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -32,9 +32,10 @@ Microsoft.Data.Sqlite.SqliteTransaction</Description>

<ItemGroup>
<PackageReference Include="SQLitePCLRaw.core" Version="$(SQLitePCLRawVersion)" />
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersVersion)">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersVersion)" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">
<PackageReference Include="System.Data.Common" Version="$(CoreFxVersion)" />
<PackageReference Include="System.ValueTuple" Version="$(CoreFxVersion)" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Data.Sqlite.Core/SqliteCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -278,7 +278,7 @@ public new virtual SqliteDataReader ExecuteReader(CommandBehavior behavior)

raw.sqlite3_reset(stmt);

#if NET451
#if NETSTANDARD2_0
// TODO: Consider having an async path that uses Task.Delay()
Thread.Sleep(150);
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/Microsoft.Data.Sqlite.Core/SqliteConnection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand All @@ -9,7 +9,7 @@
using Microsoft.Data.Sqlite.Utilities;
using SQLitePCL;

#if NET451
#if NETSTANDARD2_0
using System.IO;
#endif

Expand Down Expand Up @@ -196,7 +196,7 @@ public override void Open()
break;
}

#if NET451
#if NETSTANDARD2_0
var dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
if (!string.IsNullOrEmpty(dataDirectory)
&& (flags & raw.SQLITE_OPEN_URI) == 0
Expand Down Expand Up @@ -277,7 +277,7 @@ public virtual void CreateCollation(string name, Comparison<string> comparison)
/// </summary>
/// <typeparam name="T">The type of the state object.</typeparam>
/// <param name="name">Name of the collation.</param>
/// <param name="state">State object passed to each invokation of the collation.</param>
/// <param name="state">State object passed to each invocation of the collation.</param>
/// <param name="comparison">Method that compares two strings, using additional state.</param>
public virtual void CreateCollation<T>(string name, T state, Func<T, string, string, int> comparison)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Data.Sqlite.Core/SqliteDataReader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -159,7 +159,7 @@ public override bool NextResult()
return true;
}

#if NET451 // NB: This works around dotnet/corefx#2249
#if NETSTANDARD2_0
/// <summary>
/// Closes the data reader.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Data.Sqlite.Core/SqliteException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
Expand Down Expand Up @@ -35,7 +35,7 @@ public SqliteException(string message, int errorCode)
/// <param name="rc">The SQLite error code corresponding to the desired exception.</param>
/// <param name="db">A handle to database connection.</param>
/// <remarks>
/// No exception is thrown forn non-error result codes.
/// No exception is thrown for non-error result codes.
/// </remarks>
public static void ThrowExceptionForRC(int rc, sqlite3 db)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.Data.Sqlite/Microsoft.Data.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Microsoft.Data.Sqlite.SqliteParameter
Microsoft.Data.Sqlite.SqliteTransaction</Description>
<IncludeBuildOutput>false</IncludeBuildOutput>
<EnableApiCheck>false</EnableApiCheck>
<TargetFrameworks>net451;netstandard1.2</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.4</TargetFrameworks>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="..\..\build\common.props" />

<PropertyGroup>
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp2.0</TargetFrameworks>
</PropertyGroup>

Expand Down
6 changes: 0 additions & 6 deletions test/Microsoft.Data.Sqlite.Tests/SqliteDataReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,7 @@ public void IsClosed_returns_true_when_closed()
connection.Open();

var reader = connection.ExecuteReader("SELECT 1;");
#if NET46
reader.Close();
#elif NETCOREAPP2_0
((IDisposable)reader).Dispose();
#else
#error Target framework needs to be updated
#endif

Assert.True(reader.IsClosed);
}
Expand Down