Skip to content

Commit a0c130e

Browse files
committed
add support for net40 and net45
1 parent 12aac09 commit a0c130e

File tree

6 files changed

+51
-51
lines changed

6 files changed

+51
-51
lines changed
Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,10 @@
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">
32
<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>{F9D3B288-1A73-4C91-8ED7-11ED1704B817}</ProjectGuid>
93
<OutputType>Exe</OutputType>
10-
<RootNamespace>ReadText.Demo</RootNamespace>
11-
<AssemblyName>ReadText.Demo</AssemblyName>
4+
<TargetFrameworks>net40;net45;net461;netcoreapp2.1;netcoreapp2.0</TargetFrameworks>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
126
</PropertyGroup>
13-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14-
<DebugSymbols>true</DebugSymbols>
15-
<DebugType>full</DebugType>
16-
<Optimize>false</Optimize>
17-
<OutputPath>bin\Debug</OutputPath>
18-
<DefineConstants>DEBUG;</DefineConstants>
19-
<ErrorReport>prompt</ErrorReport>
20-
<WarningLevel>4</WarningLevel>
21-
<Externalconsole>true</Externalconsole>
22-
</PropertyGroup>
23-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
24-
<DebugType>full</DebugType>
25-
<Optimize>true</Optimize>
26-
<OutputPath>bin\Release</OutputPath>
27-
<ErrorReport>prompt</ErrorReport>
28-
<WarningLevel>4</WarningLevel>
29-
<Externalconsole>true</Externalconsole>
30-
</PropertyGroup>
31-
<ItemGroup>
32-
<Reference Include="CommandLine, Version=2.0.275.0, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
33-
<HintPath>packages\CommandLineParser.2.1.1-beta\lib\net40\CommandLine.dll</HintPath>
34-
</Reference>
35-
<Reference Include="System" />
36-
<Reference Include="System.Core" />
37-
</ItemGroup>
38-
<ItemGroup>
39-
<Compile Include="..\..\src\SharedAssemblyInfo.cs">
40-
<Link>Properties\SharedAssemblyInfo.cs</Link>
41-
</Compile>
42-
<Compile Include="Program.cs" />
43-
<Compile Include="Properties\AssemblyInfo.cs" />
44-
<Compile Include="Options.cs" />
45-
</ItemGroup>
467
<ItemGroup>
47-
<None Include="packages.config">
48-
<SubType>Designer</SubType>
49-
</None>
8+
<ProjectReference Include="..\..\src\CommandLine\CommandLine.csproj" />
509
</ItemGroup>
51-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
5210
</Project>

demo/ReadText.Demo/ReadText.Demo.sln

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.31101.0
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28307.106
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadText.Demo", "ReadText.Demo.csproj", "{F9D3B288-1A73-4C91-8ED7-11ED1704B817}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadText.Demo", "ReadText.Demo.csproj", "{F9D3B288-1A73-4C91-8ED7-11ED1704B817}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandLine", "..\..\src\CommandLine\CommandLine.csproj", "{A03AADAC-F7E5-44A6-8BCC-492B1697CCC9}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,8 +17,15 @@ Global
1517
{F9D3B288-1A73-4C91-8ED7-11ED1704B817}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{F9D3B288-1A73-4C91-8ED7-11ED1704B817}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{F9D3B288-1A73-4C91-8ED7-11ED1704B817}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{A03AADAC-F7E5-44A6-8BCC-492B1697CCC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{A03AADAC-F7E5-44A6-8BCC-492B1697CCC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{A03AADAC-F7E5-44A6-8BCC-492B1697CCC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{A03AADAC-F7E5-44A6-8BCC-492B1697CCC9}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE
2127
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {FF14CDF0-EF51-448B-918C-47CD369568DF}
30+
EndGlobalSection
2231
EndGlobal

src/CommandLine/CommandLine.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<AssemblyName>CommandLine</AssemblyName>
55
<OutputType>Library</OutputType>
6-
<TargetFramework>netstandard2.0</TargetFramework>
6+
<TargetFrameworks>netstandard2.0;net40;net45;net461</TargetFrameworks>
77
<DefineConstants>$(DefineConstants);CSX_EITHER_INTERNAL;CSX_REM_EITHER_BEYOND_2;CSX_ENUM_INTERNAL;ERRH_INTERNAL;ERRH_DISABLE_INLINE_METHODS;CSX_MAYBE_INTERNAL;CSX_REM_EITHER_FUNC</DefineConstants>
88
<DefineConstants Condition="'$(BuildTarget)' != 'fsharp'">$(DefineConstants);SKIP_FSHARP</DefineConstants>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -14,14 +14,15 @@
1414
<Authors>gsscoder;nemec;ericnewton76</Authors>
1515
<Title>Command Line Parser Library</Title>
1616
<Version Condition="'$(VersionSuffix)' != ''">$(VersionSuffix)</Version>
17-
<Version Condition="'$(VersionSuffix)' == ''">2.3.0</Version>
17+
<Version Condition="'$(VersionSuffix)' == ''">2.5.0</Version>
1818
<Description Condition="'$(BuildTarget)' != 'fsharp'">Terse syntax C# command line parser for .NET. For FSharp support see CommandLineParser.FSharp. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.</Description>
1919
<Description Condition="'$(BuildTarget)' == 'fsharp'">Terse syntax C# command line parser for .NET with F# support. The Command Line Parser Library offers to CLR applications a clean and concise API for manipulating command line arguments and related tasks.</Description>
2020
<Copyright>Copyright (c) 2005 - 2018 Giacomo Stelluti Scala &amp; Contributors</Copyright>
2121
<PackageLicenseUrl>https://raw.githubusercontent.com/gsscoder/commandline/master/doc/LICENSE</PackageLicenseUrl>
2222
<PackageProjectUrl>https://github.com/gsscoder/commandline</PackageProjectUrl>
2323
<PackageIconUrl>https://raw.githubusercontent.com/commandlineparser/commandline/master/art/CommandLine20.png</PackageIconUrl>
2424
<PackageTags>command line;commandline;argument;option;parser;parsing;library;syntax;shell</PackageTags>
25+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2526
</PropertyGroup>
2627

2728
<ItemGroup Condition="'$(BuildTarget)' != 'fsharp'">

src/CommandLine/Infrastructure/ReflectionHelper.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ public static Maybe<TAttribute> GetAttribute<TAttribute>()
5252
}
5353

5454
var assembly = GetExecutingOrEntryAssembly();
55+
56+
#if NET40
57+
var attributes = assembly.GetCustomAttributes(typeof(TAttribute), false);
58+
#else
5559
var attributes = assembly.GetCustomAttributes<TAttribute>().ToArray();
60+
#endif
5661

5762
return attributes.Length > 0
5863
? Maybe.Just((TAttribute)attributes[0])
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace CommandLine
8+
{
9+
#if NET40
10+
11+
internal static class IntrospectionExtensions
12+
{
13+
public static Type GetTypeInfo(this Type type)
14+
{
15+
return type;
16+
}
17+
}
18+
#endif
19+
}
20+

tests/CommandLine.Tests/CommandLine.Tests.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
<DefineConstants Condition="'$(BuildTarget)' != 'fsharp'">$(DefineConstants);SKIP_FSHARP</DefineConstants>
88
<AssemblyOriginatorKeyFile>..\..\CommandLine.snk</AssemblyOriginatorKeyFile>
99
<SignAssembly>true</SignAssembly>
10+
<Authors>gsscoder;nemec;ericnewton76</Authors>
11+
<Title>Command Line Parser Library</Title>
12+
<Version Condition="'$(VersionSuffix)' != ''">$(VersionSuffix)</Version>
13+
<Version Condition="'$(VersionSuffix)' == ''">2.5.0</Version>
14+
<Copyright>Copyright (c) 2005 - 2018 Giacomo Stelluti Scala &amp; Contributors</Copyright>
1015
</PropertyGroup>
1116

1217
<ItemGroup Condition="'$(BuildTarget)' != 'fsharp'">
@@ -24,6 +29,8 @@
2429
<PackageReference Include="FSharp.Core" Version="4.5.1" Condition="'$(BuildTarget)' == 'fsharp'" />
2530
<PackageReference Include="xunit" Version="2.4.0" />
2631
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
32+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
2733
</ItemGroup>
2834

35+
2936
</Project>

0 commit comments

Comments
 (0)