Skip to content

Commit

Permalink
Introduced new csproj for VS2017 (with netcore support)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gpailler committed Jan 20, 2017
1 parent 4ab98f7 commit 4f509cd
Show file tree
Hide file tree
Showing 22 changed files with 612 additions and 123 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,9 @@ pip-log.txt
packages
*.private
.vs/config/applicationhost.config

#.Net core
*.lock.json

# Cake
tools/
11 changes: 11 additions & 0 deletions GlobalAssemblyVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Cake.
// </auto-generated>
//------------------------------------------------------------------------------
using System.Reflection;

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

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

# SlackAPI

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

# Creating NuGet package

Example:

```nuget pack SlackAPI.nuspec -version 1.2.3```
# NuGet package
SlackAPI NuGet package is build with following platforms support:
- .NET Framework 4.5 (support .NET Framework 4.5 and 4.5.1)
- .NET Standard 1.6 (support .NET Framework 4.6 and later)
- .NET Standard 1.3 (support UWP).
- The version cannot detect SlackSocketRouting attributes in loaded assemblies (used to extend SlackAPI to handle custom messages).
13 changes: 0 additions & 13 deletions SlackAPI.Console/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,3 @@

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("523b8aa3-1079-44e3-9dd3-70066a09684b")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
3 changes: 3 additions & 0 deletions SlackAPI.Console/SlackAPI.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyVersion.cs">
<Link>Properties\GlobalAssemblyVersion.cs</Link>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions SlackAPI.NetCore.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26014.0
MinimumVisualStudioVersion = 10.0.40219.1
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}"
EndProject
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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x64.ActiveCfg = Debug|x64
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x64.Build.0 = Debug|x64
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x86.ActiveCfg = Debug|x86
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Debug|x86.Build.0 = Debug|x86
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|Any CPU.Build.0 = Release|Any CPU
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x64.ActiveCfg = Release|x64
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x64.Build.0 = Release|x64
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x86.ActiveCfg = Release|x86
{7EED3D9B-9B7A-49A4-AFBF-599153A47DDA}.Release|x86.Build.0 = Release|x86
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x64.ActiveCfg = Debug|x64
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x64.Build.0 = Debug|x64
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x86.ActiveCfg = Debug|x86
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Debug|x86.Build.0 = Debug|x86
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|Any CPU.Build.0 = Release|Any CPU
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x64.ActiveCfg = Release|x64
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x64.Build.0 = Release|x64
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x86.ActiveCfg = Release|x86
{DEFA9559-0F8F-4C38-9644-67A080EDC46D}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
5 changes: 4 additions & 1 deletion SlackAPI.Tests/Configuration/IntegrationFixture.cs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Reflection;
using Newtonsoft.Json;
using SlackAPI.Tests.Helpers;
using Xunit;
Expand Down Expand Up @@ -29,7 +30,9 @@ public void Dispose()

private SlackConfig GetConfig()
{
string fileName = Path.Combine(Environment.CurrentDirectory, @"configuration\config.json");
var currentAssembly = this.GetType().GetTypeInfo().Assembly.Location;
var assemblyDirectory = Path.GetDirectoryName(currentAssembly);
string fileName = Path.Combine(assemblyDirectory, @"configuration\config.json");
string json = System.IO.File.ReadAllText(fileName);

var jsonObject = new {slack = (SlackConfig)null };
Expand Down
2 changes: 1 addition & 1 deletion SlackAPI.Tests/JoinDirectMessageChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void ShouldJoinDirectMessageChannel()
JoinDirectMessageChannelResponse actual = null;

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

// when
using (var sync = new InSync(nameof(SlackClient.JoinDirectMessageChannel)))
Expand Down
13 changes: 0 additions & 13 deletions SlackAPI.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,3 @@

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c254f6ff-81d4-46df-aa21-3d1a6456253b")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
44 changes: 44 additions & 0 deletions SlackAPI.Tests/SlackAPI.Tests.NetCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
<AssemblyName>SlackAPI.Tests</AssemblyName>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<OutputType Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<EmbeddedResource Include="compiler\resources\**\*" />
<Content Include="configuration\config.json">
<Link>configuration/config.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20161123-03" />
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-beta4-build1194" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
<PackageReference Include="Microsoft.NETCore.Platforms" Version="1.0.0" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SlackAPI\SlackAPI.NetCore.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions SlackAPI.Tests/SlackAPI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyVersion.cs">
<Link>Properties\GlobalAssemblyVersion.cs</Link>
</Compile>
<Compile Include="Configuration\IntegrationCollection.cs" />
<Compile Include="Configuration\IntegrationFixture.cs" />
<Compile Include="Configuration\SlackConfig.cs" />
Expand Down
3 changes: 3 additions & 0 deletions SlackAPI.Tests/app.config
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="xunit.shadowCopy" value="false"/>
</appSettings>
</configuration>
25 changes: 0 additions & 25 deletions SlackAPI.nuspec

This file was deleted.

8 changes: 3 additions & 5 deletions SlackAPI/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace SlackAPI
Expand All @@ -27,18 +26,17 @@ public static string ToProperTimeStamp(this DateTime that, bool toUTC = true)
public static K Deserialize<K>(this string data)
where K : class
{
return JsonConvert.DeserializeObject<K>(data, CreateSettings(data));
return JsonConvert.DeserializeObject<K>(data, CreateSettings());
}

public static object Deserialize(this string data, Type type)
{
return JsonConvert.DeserializeObject(data, type, CreateSettings(data));
return JsonConvert.DeserializeObject(data, type, CreateSettings());
}

private static JsonSerializerSettings CreateSettings(object contextData)
private static JsonSerializerSettings CreateSettings()
{
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.Context = new StreamingContext(StreamingContextStates.Other, contextData);
settings.Converters = Converters;

return settings;
Expand Down
15 changes: 1 addition & 14 deletions SlackAPI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,4 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("80fe3ab4-f0d5-4fee-a6ae-524b523cebcc")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.1")]
[assembly: AssemblyFileVersion("1.0.4.1")]

[assembly: InternalsVisibleTo("SlackAPI.Tests")]
[assembly: InternalsVisibleTo("SlackAPI.Tests")]
59 changes: 59 additions & 0 deletions SlackAPI/SlackAPI.NetCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<Description>A Slack wrapper for direct interaction with their APIs.</Description>
<Copyright>Inumedia - Copyright © 2014</Copyright>
<AssemblyTitle>SlackAPI</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>Inumedia</Authors>
<TargetFrameworks>net45;netstandard1.6;netstandard1.3</TargetFrameworks>
<AssemblyName>SlackAPI</AssemblyName>
<PackageProjectUrl>https://github.com/Inumedia/SlackAPI</PackageProjectUrl>
<PackageLicenseUrl>http://choosealicense.com/licenses/mit/</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Inumedia/SlackAPI</RepositoryUrl>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
<EmbeddedResource Include="compiler\resources\**\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json">
<Version>9.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<PackageReference Include="System.Net.Http">
<Version>4.0</Version>
</PackageReference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="1.1.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
</ItemGroup>
<PropertyGroup Label="Configuration">
<RootNamespace>SlackAPI</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
</PropertyGroup>
</Project>
7 changes: 5 additions & 2 deletions SlackAPI/SlackAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;NET45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand All @@ -44,6 +44,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyVersion.cs">
<Link>Properties\GlobalAssemblyVersion.cs</Link>
</Compile>
<Compile Include="Attachment.cs" />
<Compile Include="Conversation.cs" />
<Compile Include="Reaction.cs" />
Expand Down
Loading

0 comments on commit 4f509cd

Please sign in to comment.