Skip to content

Commit 4f509cd

Browse files
committed
Introduced new csproj for VS2017 (with netcore support)
Updated code to fix compilation issues for .NetCore Introduced cake.build file to handle compilation/tests/packaging Updated appveyor.yml to use cake script and to push artifact on myGet
1 parent 4ab98f7 commit 4f509cd

22 files changed

+612
-123
lines changed

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -220,3 +220,9 @@ pip-log.txt
220220
packages
221221
*.private
222222
.vs/config/applicationhost.config
223+
224+
#.Net core
225+
*.lock.json
226+
227+
# Cake
228+
tools/

GlobalAssemblyVersion.cs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by Cake.
4+
// </auto-generated>
5+
//------------------------------------------------------------------------------
6+
using System.Reflection;
7+
8+
[assembly: AssemblyVersion("1.0.0.0")]
9+
[assembly: AssemblyFileVersion("1.0.0.0")]
10+
[assembly: AssemblyInformationalVersion("1.0.0.0")]
11+

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[![Build status](https://ci.appveyor.com/api/projects/status/5n9e7sruxpo0mw79/branch/master?svg=true)](https://ci.appveyor.com/project/Inumedia/slackapi/branch/master)
2+
[![NuGet](https://img.shields.io/nuget/v/SlackAPI.svg)](https://www.nuget.org/packages/SlackAPI/)
3+
[![MyGet Pre Release](https://img.shields.io/myget/slackapi/vpre/SlackAPI.svg)](https://www.myget.org/feed/slackapi/package/nuget/SlackAPI)
24

35
# SlackAPI
46

@@ -35,8 +37,9 @@ The project **SlackAPI.Tests** requires a valid `config.json` file for tests. Yo
3537
- *directMessageUser* : A Slack member username
3638
- *clientId*/*clientSecret*/*authCode* : Not used
3739

38-
# Creating NuGet package
39-
40-
Example:
41-
42-
```nuget pack SlackAPI.nuspec -version 1.2.3```
40+
# NuGet package
41+
SlackAPI NuGet package is build with following platforms support:
42+
- .NET Framework 4.5 (support .NET Framework 4.5 and 4.5.1)
43+
- .NET Standard 1.6 (support .NET Framework 4.6 and later)
44+
- .NET Standard 1.3 (support UWP).
45+
- The version cannot detect SlackSocketRouting attributes in loaded assemblies (used to extend SlackAPI to handle custom messages).

SlackAPI.Console/Properties/AssemblyInfo.cs

-13
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,3 @@
2121

2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
2323
[assembly: Guid("523b8aa3-1079-44e3-9dd3-70066a09684b")]
24-
25-
// Version information for an assembly consists of the following four values:
26-
//
27-
// Major Version
28-
// Minor Version
29-
// Build Number
30-
// Revision
31-
//
32-
// You can specify all the values or you can default the Build and Revision Numbers
33-
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]

SlackAPI.Console/SlackAPI.Console.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
<Reference Include="System.Xml" />
4343
</ItemGroup>
4444
<ItemGroup>
45+
<Compile Include="..\GlobalAssemblyVersion.cs">
46+
<Link>Properties\GlobalAssemblyVersion.cs</Link>
47+
</Compile>
4548
<Compile Include="Program.cs" />
4649
<Compile Include="Properties\AssemblyInfo.cs" />
4750
</ItemGroup>

SlackAPI.NetCore.sln

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26014.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI.NetCore", "\\vmware-host\Shared Folders\Documents\Git\GitHub\SlackAPI\SlackAPI\SlackAPI.NetCore.csproj", "{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlackAPI.Tests.NetCore", "\\vmware-host\Shared Folders\Documents\Git\GitHub\SlackAPI\SlackAPI.Tests\SlackAPI.Tests.NetCore.csproj", "{DEFA9559-0F8F-4C38-9644-67A080EDC46D}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|x64 = Debug|x64
14+
Debug|x86 = Debug|x86
15+
Release|Any CPU = Release|Any CPU
16+
Release|x64 = Release|x64
17+
Release|x86 = Release|x86
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x64.ActiveCfg = Debug|x64
23+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x64.Build.0 = Debug|x64
24+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x86.ActiveCfg = Debug|x86
25+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x86.Build.0 = Debug|x86
26+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x64.ActiveCfg = Release|x64
29+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x64.Build.0 = Release|x64
30+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x86.ActiveCfg = Release|x86
31+
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x86.Build.0 = Release|x86
32+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x64.ActiveCfg = Debug|x64
35+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x64.Build.0 = Debug|x64
36+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x86.ActiveCfg = Debug|x86
37+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x86.Build.0 = Debug|x86
38+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x64.ActiveCfg = Release|x64
41+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x64.Build.0 = Release|x64
42+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x86.ActiveCfg = Release|x86
43+
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x86.Build.0 = Release|x86
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
EndGlobal

SlackAPI.Tests/Configuration/IntegrationFixture.cs

100644100755
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.IO;
3+
using System.Reflection;
34
using Newtonsoft.Json;
45
using SlackAPI.Tests.Helpers;
56
using Xunit;
@@ -29,7 +30,9 @@ public void Dispose()
2930

3031
private SlackConfig GetConfig()
3132
{
32-
string fileName = Path.Combine(Environment.CurrentDirectory, @"configuration\config.json");
33+
var currentAssembly = this.GetType().GetTypeInfo().Assembly.Location;
34+
var assemblyDirectory = Path.GetDirectoryName(currentAssembly);
35+
string fileName = Path.Combine(assemblyDirectory, @"configuration\config.json");
3336
string json = System.IO.File.ReadAllText(fileName);
3437

3538
var jsonObject = new {slack = (SlackConfig)null };

SlackAPI.Tests/JoinDirectMessageChannel.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public void ShouldJoinDirectMessageChannel()
2424
JoinDirectMessageChannelResponse actual = null;
2525

2626
string userName = this.fixture.Config.DirectMessageUser;
27-
string user = client.Users.First(x => x.name.Equals(userName, StringComparison.InvariantCultureIgnoreCase)).id;
27+
string user = client.Users.First(x => x.name.Equals(userName, StringComparison.OrdinalIgnoreCase)).id;
2828

2929
// when
3030
using (var sync = new InSync(nameof(SlackClient.JoinDirectMessageChannel)))

SlackAPI.Tests/Properties/AssemblyInfo.cs

-13
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,3 @@
2121

2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
2323
[assembly: Guid("c254f6ff-81d4-46df-aa21-3d1a6456253b")]
24-
25-
// Version information for an assembly consists of the following four values:
26-
//
27-
// Major Version
28-
// Minor Version
29-
// Build Number
30-
// Revision
31-
//
32-
// You can specify all the values or you can default the Build and Revision Numbers
33-
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
2+
<PropertyGroup>
3+
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
4+
<AssemblyName>SlackAPI.Tests</AssemblyName>
5+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
6+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
7+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
8+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
9+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
10+
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
11+
<OutputType Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">Exe</OutputType>
12+
</PropertyGroup>
13+
<ItemGroup>
14+
<Compile Include="**\*.cs" />
15+
<EmbeddedResource Include="**\*.resx" />
16+
<EmbeddedResource Include="compiler\resources\**\*" />
17+
<Content Include="configuration\config.json">
18+
<Link>configuration/config.json</Link>
19+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
20+
</Content>
21+
</ItemGroup>
22+
<ItemGroup>
23+
<None Include="app.config" />
24+
</ItemGroup>
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
27+
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
28+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
29+
</ItemGroup>
30+
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
31+
<PackageReference Include="Microsoft.NETCore.Platforms" Version="1.0.0" />
32+
<Reference Include="System" />
33+
<Reference Include="Microsoft.CSharp" />
34+
</ItemGroup>
35+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
36+
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.0" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<ProjectReference Include="..\SlackAPI\SlackAPI.NetCore.csproj" />
40+
</ItemGroup>
41+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
42+
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
43+
</PropertyGroup>
44+
</Project>

SlackAPI.Tests/SlackAPI.Tests.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
</Reference>
6060
</ItemGroup>
6161
<ItemGroup>
62+
<Compile Include="..\GlobalAssemblyVersion.cs">
63+
<Link>Properties\GlobalAssemblyVersion.cs</Link>
64+
</Compile>
6265
<Compile Include="Configuration\IntegrationCollection.cs" />
6366
<Compile Include="Configuration\IntegrationFixture.cs" />
6467
<Compile Include="Configuration\SlackConfig.cs" />

SlackAPI.Tests/app.config

100644100755
+3
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@
88
</dependentAssembly>
99
</assemblyBinding>
1010
</runtime>
11+
<appSettings>
12+
<add key="xunit.shadowCopy" value="false"/>
13+
</appSettings>
1114
</configuration>

SlackAPI.nuspec

-25
This file was deleted.

SlackAPI/Extensions.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Runtime.Serialization;
43
using Newtonsoft.Json;
54

65
namespace SlackAPI
@@ -27,18 +26,17 @@ public static string ToProperTimeStamp(this DateTime that, bool toUTC = true)
2726
public static K Deserialize<K>(this string data)
2827
where K : class
2928
{
30-
return JsonConvert.DeserializeObject<K>(data, CreateSettings(data));
29+
return JsonConvert.DeserializeObject<K>(data, CreateSettings());
3130
}
3231

3332
public static object Deserialize(this string data, Type type)
3433
{
35-
return JsonConvert.DeserializeObject(data, type, CreateSettings(data));
34+
return JsonConvert.DeserializeObject(data, type, CreateSettings());
3635
}
3736

38-
private static JsonSerializerSettings CreateSettings(object contextData)
37+
private static JsonSerializerSettings CreateSettings()
3938
{
4039
JsonSerializerSettings settings = new JsonSerializerSettings();
41-
settings.Context = new StreamingContext(StreamingContextStates.Other, contextData);
4240
settings.Converters = Converters;
4341

4442
return settings;

SlackAPI/Properties/AssemblyInfo.cs

+1-14
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,4 @@
2222
// The following GUID is for the ID of the typelib if this project is exposed to COM
2323
[assembly: Guid("80fe3ab4-f0d5-4fee-a6ae-524b523cebcc")]
2424

25-
// Version information for an assembly consists of the following four values:
26-
//
27-
// Major Version
28-
// Minor Version
29-
// Build Number
30-
// Revision
31-
//
32-
// You can specify all the values or you can default the Build and Revision Numbers
33-
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.4.1")]
36-
[assembly: AssemblyFileVersion("1.0.4.1")]
37-
38-
[assembly: InternalsVisibleTo("SlackAPI.Tests")]
25+
[assembly: InternalsVisibleTo("SlackAPI.Tests")]

SlackAPI/SlackAPI.NetCore.csproj

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
2+
<PropertyGroup>
3+
<Description>A Slack wrapper for direct interaction with their APIs.</Description>
4+
<Copyright>Inumedia - Copyright © 2014</Copyright>
5+
<AssemblyTitle>SlackAPI</AssemblyTitle>
6+
<NeutralLanguage>en-US</NeutralLanguage>
7+
<VersionPrefix>1.0.0</VersionPrefix>
8+
<VersionSuffix></VersionSuffix>
9+
<Authors>Inumedia</Authors>
10+
<TargetFrameworks>net45;netstandard1.6;netstandard1.3</TargetFrameworks>
11+
<AssemblyName>SlackAPI</AssemblyName>
12+
<PackageProjectUrl>https://github.com/Inumedia/SlackAPI</PackageProjectUrl>
13+
<PackageLicenseUrl>http://choosealicense.com/licenses/mit/</PackageLicenseUrl>
14+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
15+
<RepositoryType>git</RepositoryType>
16+
<RepositoryUrl>https://github.com/Inumedia/SlackAPI</RepositoryUrl>
17+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
18+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
19+
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
20+
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
21+
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
22+
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
23+
</PropertyGroup>
24+
<ItemGroup>
25+
<Compile Include="**\*.cs" />
26+
<EmbeddedResource Include="**\*.resx" />
27+
<EmbeddedResource Include="compiler\resources\**\*" />
28+
</ItemGroup>
29+
<ItemGroup>
30+
<PackageReference Include="Newtonsoft.Json">
31+
<Version>9.0.1</Version>
32+
</PackageReference>
33+
</ItemGroup>
34+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
35+
<PackageReference Include="System.Net.Http">
36+
<Version>4.0</Version>
37+
</PackageReference>
38+
<Reference Include="System" />
39+
<Reference Include="Microsoft.CSharp" />
40+
</ItemGroup>
41+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
42+
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
43+
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
44+
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0" />
45+
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.0" />
46+
</ItemGroup>
47+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
48+
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
49+
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
50+
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0" />
51+
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
52+
</ItemGroup>
53+
<PropertyGroup Label="Configuration">
54+
<RootNamespace>SlackAPI</RootNamespace>
55+
</PropertyGroup>
56+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
57+
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
58+
</PropertyGroup>
59+
</Project>

SlackAPI/SlackAPI.csproj

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
<DebugType>full</DebugType>
1818
<Optimize>false</Optimize>
1919
<OutputPath>bin\Debug\</OutputPath>
20-
<DefineConstants>DEBUG;TRACE</DefineConstants>
20+
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
2121
<ErrorReport>prompt</ErrorReport>
2222
<WarningLevel>4</WarningLevel>
2323
</PropertyGroup>
2424
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2525
<DebugType>pdbonly</DebugType>
2626
<Optimize>true</Optimize>
2727
<OutputPath>bin\Release\</OutputPath>
28-
<DefineConstants>TRACE</DefineConstants>
28+
<DefineConstants>TRACE;NET45</DefineConstants>
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
@@ -44,6 +44,9 @@
4444
<Reference Include="System.Xml" />
4545
</ItemGroup>
4646
<ItemGroup>
47+
<Compile Include="..\GlobalAssemblyVersion.cs">
48+
<Link>Properties\GlobalAssemblyVersion.cs</Link>
49+
</Compile>
4750
<Compile Include="Attachment.cs" />
4851
<Compile Include="Conversation.cs" />
4952
<Compile Include="Reaction.cs" />

0 commit comments

Comments
 (0)