Skip to content

Commit af98820

Browse files
thinkingseriousSam Harrison
andauthored
chore: add targets for .NET Standard to support .NET Core (#103)
Co-authored-by: Sam Harrison <sharrison@twilio.com>
1 parent 6bed6da commit af98820

20 files changed

+75
-11387
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
language: csharp
2+
dotnet: 3.1
3+
4+
env:
5+
- FrameworkPathOverride=/usr/lib/mono/4.5/
6+
7+
install:
8+
- make install
29

310
script:
411
- make test
12+
- make release
513

614
after_success:
715
- bash <(curl -s https://codecov.io/bash)
816

917
deploy:
1018
skip_cleanup: true
1119
provider: script
12-
script: nuget push /home/travis/build/sendgrid/smtpapi-csharp/*.nupkg -ApiKey $NUGET_API_KEY -Source https://api.nuget.org/v3/index.json
20+
script: dotnet nuget push /home/travis/build/sendgrid/smtpapi-csharp/*.nupkg -ApiKey $NUGET_API_KEY -Source https://api.nuget.org/v3/index.json
1321
on:
1422
branch: main
1523
tags: true

Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
.PHONY: test install
1+
.PHONY: clean install test release
2+
3+
clean:
4+
dotnet clean Smtpapi/SendGrid.SmtpApi.sln
25

36
install:
4-
nuget restore Smtpapi/SendGrid.SmtpApi.sln
5-
nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner
7+
@dotnet --version || (echo "Dotnet is not installed, please install Dotnet CLI"; exit 1);
8+
dotnet restore Smtpapi/SendGrid.SmtpApi.sln
69

7-
test: install
8-
xbuild /p:Configuration=Release Smtpapi/SendGrid.SmtpApi.sln
9-
mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./Smtpapi/HeaderTests/bin/Release/SendGrid.SmtpApi.HeaderTests.dll
10-
nuget pack ./Smtpapi/Smtpapi/SendGrid.SmtpApi.csproj -Properties Configuration=Release
10+
test:
11+
dotnet build -c Release Smtpapi/SendGrid.SmtpApi.sln
12+
dotnet test -c Release Smtpapi/SendGrid.SmtpApi.sln
1113
curl -s https://codecov.io/bash > .codecov
1214
chmod +x .codecov
1315
./.codecov
16+
17+
release:
18+
dotnet pack -c Release Smtpapi/SendGrid.SmtpApi.sln

Smtpapi/.nuget/NuGet.Config

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

Smtpapi/.nuget/NuGet.exe

-1.59 MB
Binary file not shown.

Smtpapi/.nuget/NuGet.targets

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

Smtpapi/Example/SendGrid.SmtpApi.Example.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
67
<ProductVersion>12.0.0</ProductVersion>
Lines changed: 11 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,17 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" 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>12.0.0</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{F9F61DE0-D1AF-4A1D-9D62-5C09B22AC31D}</ProjectGuid>
9-
<OutputType>Library</OutputType>
10-
<RootNamespace>SendGrid.SmtpApi.HeaderTests</RootNamespace>
11-
<AssemblyName>SendGrid.SmtpApi.HeaderTests</AssemblyName>
12-
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
13-
<RestorePackages>true</RestorePackages>
4+
<TargetFramework>net40</TargetFramework>
5+
<IsTestProject>true</IsTestProject>
6+
<IsPackable>false</IsPackable>
147
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<DebugSymbols>true</DebugSymbols>
17-
<DebugType>full</DebugType>
18-
<Optimize>false</Optimize>
19-
<OutputPath>bin\Debug</OutputPath>
20-
<DefineConstants>DEBUG;</DefineConstants>
21-
<ErrorReport>prompt</ErrorReport>
22-
<WarningLevel>4</WarningLevel>
23-
<ConsolePause>false</ConsolePause>
24-
</PropertyGroup>
25-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26-
<DebugType>full</DebugType>
27-
<Optimize>true</Optimize>
28-
<OutputPath>bin\Release</OutputPath>
29-
<ErrorReport>prompt</ErrorReport>
30-
<WarningLevel>4</WarningLevel>
31-
<ConsolePause>false</ConsolePause>
32-
</PropertyGroup>
33-
<ItemGroup>
34-
<Reference Include="nunit.framework">
35-
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
36-
</Reference>
37-
<Reference Include="System" />
38-
</ItemGroup>
39-
<ItemGroup>
40-
<Compile Include="TestHeader.cs" />
41-
<Compile Include="TestRepositoryFiles.cs" />
42-
<Compile Include="TestTreeNode.cs" />
43-
<Compile Include="TestUtils.cs" />
44-
</ItemGroup>
45-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
46-
<ItemGroup>
47-
<None Include="packages.config" />
48-
</ItemGroup>
8+
499
<ItemGroup>
50-
<ProjectReference Include="..\Smtpapi\SendGrid.SmtpApi.csproj">
51-
<Project>{314665CE-FB24-4984-9B0D-2C39218930F1}</Project>
52-
<Name>SendGrid.SmtpApi</Name>
53-
</ProjectReference>
10+
<ProjectReference Include="..\Smtpapi\SendGrid.SmtpApi.csproj" />
5411
</ItemGroup>
12+
5513
<ItemGroup>
56-
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
14+
<PackageReference Include="NUnit" Version="2.6.3" />
15+
<PackageReference Include="NUnitTestAdapter" Version="2.1.1" />
5716
</ItemGroup>
58-
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
59-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
60-
<PropertyGroup>
61-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
62-
</PropertyGroup>
63-
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
64-
</Target>
65-
</Project>
17+
</Project>

Smtpapi/HeaderTests/packages.config

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

Smtpapi/SendGrid.SmtpApi.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@ VisualStudioVersion = 12.0.30723.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid.SmtpApi.HeaderTests", "HeaderTests\SendGrid.SmtpApi.HeaderTests.csproj", "{F9F61DE0-D1AF-4A1D-9D62-5C09B22AC31D}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid.SmtpApi.Example", "Example\SendGrid.SmtpApi.Example.csproj", "{3672A2E2-487F-475D-B40B-3B78634A43FF}"
9-
EndProject
108
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid.SmtpApi", "Smtpapi\SendGrid.SmtpApi.csproj", "{314665CE-FB24-4984-9B0D-2C39218930F1}"
119
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{7AD91F7A-9322-4862-8759-A12DF686F6AA}"
13-
ProjectSection(SolutionItems) = preProject
14-
.nuget\NuGet.Config = .nuget\NuGet.Config
15-
.nuget\NuGet.exe = .nuget\NuGet.exe
16-
.nuget\NuGet.targets = .nuget\NuGet.targets
17-
EndProjectSection
18-
EndProject
1910
Global
2011
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2112
Debug|Any CPU = Debug|Any CPU

Smtpapi/Smtpapi/HeaderSettingsNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace SendGrid.SmtpApi
66
{
77
/// <summary>
88
/// </summary>
9-
internal class HeaderSettingsNode
9+
public class HeaderSettingsNode
1010
{
1111
#region Private Members
1212

@@ -128,4 +128,4 @@ public bool IsEmpty()
128128
return _branches == null || _branches.Keys.Count == 0;
129129
}
130130
}
131-
}
131+
}

0 commit comments

Comments
 (0)