Migrate to .NET Standard

This commit is contained in:
Biarity 2018-04-18 18:50:23 +10:00
parent 47fd6307a0
commit badabfe666
7 changed files with 25 additions and 54 deletions

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
publishing_to_nuget.md
# User-specific files
*.suo
*.user

View File

@ -18,7 +18,7 @@ namespace Sieve.Models
{
get
{
if (_sort.StartsWith('-'))
if (_sort.StartsWith("-"))
{
return _sort.Substring(1);
}
@ -33,7 +33,7 @@ namespace Sieve.Models
{
get
{
if (_sort.StartsWith('-'))
if (_sort.StartsWith("-"))
{
return true;
}

View File

@ -15,7 +15,9 @@ namespace Sieve.Services
public PropertyFluentApi<TEntity> Property<TEntity>(Expression<Func<TEntity, object>> expression)
{
_map.TryAdd(typeof(TEntity), new Dictionary<PropertyInfo, ISievePropertyMetadata>());
if(!_map.ContainsKey(typeof(TEntity)))
_map.Add(typeof(TEntity), new Dictionary<PropertyInfo, ISievePropertyMetadata>());
return new PropertyFluentApi<TEntity>(this, expression);
}

View File

@ -1,11 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.3.94</Version>
<Description>Sieve is a simple, clean, and extensible framework for .NET Core that adds sorting, filtering, and pagination functionality out of the box. Most common use case would be for serving ASP.NET Core GET queries. Documentation available on GitHub: https://github.com/Biarity/Sieve/
</Description>
<Copyright>Copyright 2018</Copyright>
<PackageLicenseUrl>https://github.com/Biarity/Sieve/blob/master/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
<RepositoryUrl></RepositoryUrl>
<PackageReleaseNotes>Migrated from NET Core to .NET Standard</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>Biarity</Authors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.4.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.4.1" />
</ItemGroup>
</Project>

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Sieve</id>
<version>1.3.93</version>
<title>Sieve</title>
<authors>Biarity</authors>
<owners>Biarity</owners>
<licenseUrl>https://github.com/Biarity/Sieve/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Biarity/Sieve</projectUrl>
<iconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>
Sieve is a simple, clean, and extensible framework for .NET Core that adds sorting, filtering, and pagination functionality out of the box. Most common use case would be for serving ASP.NET Core GET queries. Documentation available on GitHub: https://github.com/Biarity/Sieve/
</description>
<releaseNotes>Fix parse order</releaseNotes>
<copyright>Copyright 2018</copyright>
<tags>aspnetcore filter sort page paginate sieve search</tags>
<dependencies>
<group targetFramework=".NETCoreApp2.0">
<dependency id="Microsoft.Extensions.Options" version="2.0.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>

View File

@ -1,12 +0,0 @@
version: 1.0.{build}
image: Visual Studio 2017
build:
verbosity: minimal
before_build:
- cmd: >-
dotnet restore
nuget restore

View File

@ -1,19 +1,9 @@
### 1. Pack:
```
dotnet pack Sieve.csproj -c Release -o . /p:PackageVersion=1.3.93
```
Don't forget to change version since nuget packages are immutable (add one to the nuget current).
### 2. Manually add nuspec:
For some reason `dotnet pack` chooses to ignore my Sieve.nuspec.
So unpack the Sieve.1.2.0.nupkg, and replace the nuspec in there with the local one.
Don't forget that if you add new dependencies, you'll need to declare them in the nuspec.
Also don't forget updating the version number in nuspec.
Also don't forget updaing `releaseNotes` in nuspec.
Just build and it'll be in `.\Sieve\bin\Debug`
Update the version first though (in project properties)
### 3. Publish:
```
nuget push Sieve.1.3.93.nupkg API_KEY -Source https://api.nuget.org/v3/index.json
nuget push .\bin\Debug\Sieve.1.3.94.nupkg API_KEY -Source https://api.nuget.org/v3/index.json
```
Replace API_KEY with one you get from nuget's website.
Also don't forget to replace corresponding version.