Skip to content

Commit 2cd5ed5

Browse files
Support .NET Framework 4.5 and .NET Standard 2.0
2 parents 0fb315c + ac7388f commit 2cd5ed5

File tree

13 files changed

+109
-394
lines changed

13 files changed

+109
-394
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,7 @@ FakesAssemblies/
194194

195195
# Visual Studio 6 workspace options file
196196
*.opt
197+
198+
# VS 2017 creates this
199+
src/Ipfs.Api.xml
200+

.nuget/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="coveralls.net" version="0.6.0" />
4-
<package id="OpenCover" version="4.6.210-rc" />
4+
<package id="OpenCover" version="4.6.519" />
55
<package id="msdn.4.5.2" version="0.1.0-alpha-1611021200" />
66
</packages>

IpfsApi.sln

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26730.16
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IpfsApi", "src\IpfsApi.csproj", "{429C5EB5-63BF-4421-AD9B-300F3361BDB4}"
7-
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IpfsApiTests", "test\IpfsApiTests.csproj", "{42449EFD-F537-4425-820A-C2FBF36A683A}"
9-
EndProject
106
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6B9AA9C7-5E90-4D10-9DDE-A2AA5FE3ECA6}"
117
ProjectSection(SolutionItems) = preProject
128
.gitignore = .gitignore
@@ -17,24 +13,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1713
EndProject
1814
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Documentation", "doc\Documentation.csproj", "{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}"
1915
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpfsApi", "src\IpfsApi.csproj", "{F3C81C57-C283-4E07-B765-DEABCFB22136}"
17+
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IpfsApiTests", "test\IpfsApiTests.csproj", "{B459FBC7-4A28-4170-AD83-7348A403407F}"
19+
EndProject
2020
Global
2121
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2222
Debug|Any CPU = Debug|Any CPU
2323
Release|Any CPU = Release|Any CPU
2424
EndGlobalSection
2525
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26-
{429C5EB5-63BF-4421-AD9B-300F3361BDB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27-
{429C5EB5-63BF-4421-AD9B-300F3361BDB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
28-
{429C5EB5-63BF-4421-AD9B-300F3361BDB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
29-
{429C5EB5-63BF-4421-AD9B-300F3361BDB4}.Release|Any CPU.Build.0 = Release|Any CPU
30-
{42449EFD-F537-4425-820A-C2FBF36A683A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31-
{42449EFD-F537-4425-820A-C2FBF36A683A}.Debug|Any CPU.Build.0 = Debug|Any CPU
32-
{42449EFD-F537-4425-820A-C2FBF36A683A}.Release|Any CPU.ActiveCfg = Release|Any CPU
33-
{42449EFD-F537-4425-820A-C2FBF36A683A}.Release|Any CPU.Build.0 = Release|Any CPU
3426
{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3527
{F3A32EA9-0B2F-46A3-B47A-33B4C04BD423}.Release|Any CPU.ActiveCfg = Release|Any CPU
28+
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{F3C81C57-C283-4E07-B765-DEABCFB22136}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{B459FBC7-4A28-4170-AD83-7348A403407F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{B459FBC7-4A28-4170-AD83-7348A403407F}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{B459FBC7-4A28-4170-AD83-7348A403407F}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{B459FBC7-4A28-4170-AD83-7348A403407F}.Release|Any CPU.Build.0 = Release|Any CPU
3636
EndGlobalSection
3737
GlobalSection(SolutionProperties) = preSolution
3838
HideSolutionNode = FALSE
3939
EndGlobalSection
40+
GlobalSection(ExtensibilityGlobals) = postSolution
41+
SolutionGuid = {36ED5AA7-8F41-4F7D-A665-230635EF64A1}
42+
EndGlobalSection
4043
EndGlobal

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
[![Version](https://img.shields.io/nuget/v/Ipfs.Api.svg)](https://www.nuget.org/packages/Ipfs.Api)
66
[![docs](https://cdn.rawgit.com/richardschneider/net-ipfs-core/master/doc/images/docs-latest-green.svg)](https://richardschneider.github.io/net-ipfs-api)
77

8-
Provides access to the [Inter Planetary File System API](https://ipfs.io/docs/api/) for .Net (C#, VB, F# ...)
8+
Provides access to the [Inter Planetary File System API](https://ipfs.io/docs/api/) for .Net (C#, VB, F# ...). It supports the following runtimes
9+
10+
- .NET Framework 4.5
11+
- .NET Standard 2.0
12+
913

1014
A .Net client library for the IPFS HTTP API, implemented in C#. This client library implements the [interface-ipfs-core](https://github.com/ipfs/interface-ipfs-core).
1115
More information, including the Class Reference, is on the [Project](https://richardschneider.github.io/net-ipfs-api/) web site.
@@ -22,6 +26,6 @@ Published releases of IPFS API are available on [NuGet](https://www.nuget.org/pa
2226
For the latest build or older non-released builds see [Continuous Integration](https://github.com/richardschneider/net-ipfs-core/wiki/Continuous-Integration).
2327

2428
# License
25-
Copyright © 2015-2016 Richard Schneider ([email protected])
29+
Copyright © 2015-2017 Richard Schneider ([email protected])
2630

2731
The IPFS API library is licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form") license. Refere to the [LICENSE](https://github.com/richardschneider/net-ipfs-api/blob/master/LICENSE) file for more information.

appveyor.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# gitversion will change the version number
22
version: x-{build}
33

4+
# branches to build
5+
branches:
6+
# blacklist
7+
except:
8+
- gh-pages
9+
410
configuration: Release
5-
os: Visual Studio 2015
11+
os: Visual Studio 2017
612

713
init:
814
- git config --global core.autocrlf input
@@ -25,7 +31,8 @@ environment:
2531
# tools we need for bulding/testing/deploying
2632
install:
2733
- choco install gitversion.portable -pre -y
28-
- npm install gh-pages -g
34+
- nuget update -self
35+
#- npm install gh-pages -g
2936

3037
# - nuget install secure-file -ExcludeVersion
3138
# - if defined snk_secret secure-file\tools\secure-file -decrypt src\ipfs.ci.snk.enc -secret %snk_secret% -out src\ipfs.dev.snk
@@ -36,30 +43,37 @@ install:
3643
# gitversion will change the assembly info
3744
pull_requests:
3845
do_not_increment_build_number: true
39-
assembly_info:
40-
patch: false
4146

4247
before_build:
4348
- nuget restore
4449
- ps: gitversion /output buildserver /updateAssemblyInfo >gitversion.log
4550

46-
build:
47-
project: IpfsApi.sln
48-
publish_nuget: false
49-
verbosity: minimal
51+
build_script:
52+
- dotnet build -c %CONFIGURATION% -p:Version=%GitVersion_MajorMinorPatch% -p:AssemblyVersion=%GitVersion_MajorMinorPatch%
53+
- dotnet pack -c %CONFIGURATION% --no-build --no-restore -p:Version=%GitVersion_MajorMinorPatch% -p:AssemblyVersion=%GitVersion_MajorMinorPatch%
5054

5155
after_build:
56+
- cmd: appveyor PushArtifact "src\bin\%CONFIGURATION%\Ipfs.Api.%GitVersion_MajorMinorPatch%.nupkg"
5257
# Build documentation in doc\_site
53-
- tools\docfx\docfx doc\docfx.json
54-
- if defined git_token gh-pages -d doc\_site -m "new docs %GitVersion_FullSemVer%"
55-
# Build the nuget package
56-
- nuget pack src\IpfsApi.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
57-
- appveyor PushArtifact "Ipfs.Api.%GitVersion_NuGetVersion%.nupkg"
58+
# - tools\docfx\docfx doc\docfx.json
59+
# - if defined git_token gh-pages -d doc\_site -m "new docs %GitVersion_FullSemVer%"
60+
61+
test_script:
62+
- dotnet test -c %CONFIGURATION% --no-build --no-restore test
5863

5964
after_test:
6065
# Generate coverage report
61-
- packages\OpenCover.4.6.210-rc\tools\OpenCover.Console.exe -register:user -filter:"+[Ipfs.Api*]* -[*Tests]*" -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/testcontainer:test//bin/Release/Ipfs.Api.Tests.dll" -output:coverage.xml
62-
- if defined COVERALLS_REPO_TOKEN packages\coveralls.net.0.6.0\tools\csmacnz.coveralls.exe --opencover -i ./coverage.xml --serviceName appveyor --jobId %APPVEYOR_BUILD_NUMBER%
66+
- packages\OpenCover.4.6.519\tools\OpenCover.Console.exe
67+
-register:user -filter:"+[Ipfs.Api*]* -[*Tests]*"
68+
-target:"c:\Program Files\dotnet\dotnet.exe"
69+
-targetargs:"test -c Release --no-build --no-restore test"
70+
-output:coverage.xml
71+
-mergeoutput
72+
-hideskipped:File
73+
-oldStyle
74+
- if defined COVERALLS_REPO_TOKEN
75+
packages\coveralls.net.0.6.0\tools\csmacnz.coveralls.exe
76+
--opencover -i ./coverage.xml --useRelativePaths --serviceName appveyor --jobId %APPVEYOR_BUILD_NUMBER%
6377

6478
# publish NuGet package on tag build
6579
nuget:

src/CoreApi/FileSystemApi.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ internal FileSystemApi(IpfsClient ipfs)
3434
/// Add a file to the interplanetary file system.
3535
/// </summary>
3636
/// <param name="path"></param>
37-
public Task<FileSystemNode> AddFileAsync(string path)
37+
public async Task<FileSystemNode> AddFileAsync(string path)
3838
{
39-
return AddAsync(
40-
new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read),
41-
Path.GetFileName(path));
39+
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
40+
{
41+
var node = await AddAsync(stream, Path.GetFileName(path));
42+
return node;
43+
}
4244
}
4345

4446
/// <summary>

src/IpfsApi.csproj

Lines changed: 31 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,37 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
33
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>8.0.30703</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{429C5EB5-63BF-4421-AD9B-300F3361BDB4}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>Ipfs.Api</RootNamespace>
4+
<TargetFrameworks>netstandard2;net45</TargetFrameworks>
125
<AssemblyName>Ipfs.Api</AssemblyName>
13-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
14-
<FileAlignment>512</FileAlignment>
15-
<TargetFrameworkProfile />
16-
</PropertyGroup>
17-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18-
<DebugSymbols>true</DebugSymbols>
6+
<RootNamespace>Ipfs.Api</RootNamespace>
7+
<DocumentationFile>Ipfs.Api.xml</DocumentationFile>
198
<DebugType>full</DebugType>
20-
<Optimize>false</Optimize>
21-
<OutputPath>bin\Debug\</OutputPath>
22-
<DefineConstants>DEBUG;TRACE</DefineConstants>
23-
<ErrorReport>prompt</ErrorReport>
24-
<WarningLevel>4</WarningLevel>
25-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
26-
<Prefer32Bit>false</Prefer32Bit>
27-
<DocumentationFile>bin\Debug\Ipfs.Api.xml</DocumentationFile>
28-
</PropertyGroup>
29-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30-
<DebugType>pdbonly</DebugType>
31-
<Optimize>true</Optimize>
32-
<OutputPath>bin\Release\</OutputPath>
33-
<DefineConstants>TRACE</DefineConstants>
34-
<ErrorReport>prompt</ErrorReport>
35-
<WarningLevel>4</WarningLevel>
36-
<Prefer32Bit>false</Prefer32Bit>
37-
<DocumentationFile>bin\Release\Ipfs.Api.xml</DocumentationFile>
38-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9+
10+
<!-- developer build is always 0.42 -->
11+
<AssemblyVersion>0.42</AssemblyVersion>
12+
<Version>0.42</Version>
13+
14+
<!-- Nuget specs -->
15+
<PackageId>Ipfs.Api</PackageId>
16+
<Authors>Richard Schneider</Authors>
17+
<Title>IPFS API</Title>
18+
<Description> Provides .Net client access to the InterPlanetary File System.</Description>
19+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
20+
<PackageReleaseNotes></PackageReleaseNotes>
21+
<Copyright>© 2015-2017 Richard Schneider</Copyright>
22+
<PackageTags>ipfs peer-to-peer distributed file-system</PackageTags>
23+
<IncludeSymbols>True</IncludeSymbols>
24+
<PackageLicenseUrl>https://github.com/richardschneider/net-ipfs-api/blob/master/LICENSE</PackageLicenseUrl>
25+
<PackageProjectUrl>https://github.com/richardschneider/net-ipfs-api</PackageProjectUrl>
26+
<PackageIconUrl>https://github.com/ipfs/logo/blob/master/platform-icons/osx-menu-bar.png</PackageIconUrl>
27+
3928
</PropertyGroup>
29+
4030
<ItemGroup>
41-
<Reference Include="Albireo.Base32, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
42-
<HintPath>..\packages\Albireo.Base32.1.0.1.0\lib\portable-net40+sl50+wp80+win\Albireo.Base32.dll</HintPath>
43-
<Private>True</Private>
44-
</Reference>
45-
<Reference Include="Base58Check, Version=0.2.0.0, Culture=neutral, processorArchitecture=MSIL">
46-
<HintPath>..\packages\Base58Check.0.2.0\lib\Net40\Base58Check.dll</HintPath>
47-
<Private>True</Private>
48-
</Reference>
49-
<Reference Include="Common.Logging, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
50-
<HintPath>..\packages\Common.Logging.3.3.1\lib\net40\Common.Logging.dll</HintPath>
51-
<Private>True</Private>
52-
</Reference>
53-
<Reference Include="Common.Logging.Core, Version=3.3.1.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
54-
<HintPath>..\packages\Common.Logging.Core.3.3.1\lib\net40\Common.Logging.Core.dll</HintPath>
55-
<Private>True</Private>
56-
</Reference>
57-
<Reference Include="Google.Protobuf, Version=3.1.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
58-
<HintPath>..\packages\Google.Protobuf.3.1.0\lib\net45\Google.Protobuf.dll</HintPath>
59-
<Private>True</Private>
60-
</Reference>
61-
<Reference Include="Ipfs.Core, Version=0.6.3.0, Culture=neutral, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Ipfs.Core.0.6.3\lib\net45\Ipfs.Core.dll</HintPath>
63-
<Private>True</Private>
64-
</Reference>
65-
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
66-
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
67-
<Private>True</Private>
68-
</Reference>
69-
<Reference Include="SHA3, Version=0.9.2.0, Culture=neutral, processorArchitecture=MSIL">
70-
<HintPath>..\packages\SHA3.0.9.2\lib\net40\SHA3.dll</HintPath>
71-
<Private>True</Private>
72-
</Reference>
73-
<Reference Include="SHA3Managed, Version=0.9.2.0, Culture=neutral, processorArchitecture=MSIL">
74-
<HintPath>..\packages\SHA3.0.9.2\lib\net40\SHA3Managed.dll</HintPath>
75-
<Private>True</Private>
76-
</Reference>
77-
<Reference Include="System" />
78-
<Reference Include="System.Core" />
79-
<Reference Include="Microsoft.CSharp" />
80-
<Reference Include="System.Net.Http" />
81-
</ItemGroup>
82-
<ItemGroup>
83-
<Compile Include="Block.cs" />
84-
<Compile Include="CoreApi\FileSystemApi.cs" />
85-
<Compile Include="FileSystemLink.cs" />
86-
<Compile Include="FileSystemNode.cs" />
87-
<Compile Include="CoreApi\ObjectApi.cs" />
88-
<Compile Include="CoreApi\DagApi.cs" />
89-
<Compile Include="CoreApi\SwarmApi.cs" />
90-
<Compile Include="CoreApi\DhtApi.cs" />
91-
<Compile Include="CoreApi\PinApi.cs" />
92-
<Compile Include="CoreApi\ConfigApi.cs" />
93-
<Compile Include="CoreApi\BlockApi.cs" />
94-
<Compile Include="ConnectedPeer.cs" />
95-
<Compile Include="MerkleNode.cs" />
96-
<Compile Include="PinMode.cs" />
97-
<Compile Include="PinnedObject.cs" />
98-
<Compile Include="PinnedCollection .cs" />
99-
<Compile Include="TrustedPeerCollection.cs" />
100-
<Compile Include="CoreApi\GenericApi.cs" />
101-
<Compile Include="PeerNode.cs" />
102-
<Compile Include="IpfsClient.cs" />
103-
<Compile Include="Properties\AssemblyInfo.cs" />
104-
</ItemGroup>
105-
<ItemGroup>
106-
<None Include="IpfsApi.nuspec">
107-
<SubType>Designer</SubType>
108-
</None>
109-
<None Include="packages.config">
110-
<SubType>Designer</SubType>
111-
</None>
31+
<PackageReference Include="Ipfs.Core" Version="0.7.1" />
32+
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
33+
<PackageReference Include="System.Net.Http" Version="4.3.3" />
11234
</ItemGroup>
113-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
114-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
115-
Other similar extension points exist, see Microsoft.Common.targets.
116-
<Target Name="BeforeBuild">
117-
</Target>
118-
<Target Name="AfterBuild">
119-
</Target>
120-
-->
121-
</Project>
35+
36+
37+
</Project>

src/IpfsApi.nuspec

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)