Skip to content

Commit ccf5fd0

Browse files
author
maximv
committed
added nuget details
1 parent d81a025 commit ccf5fd0

File tree

6 files changed

+84
-5
lines changed

6 files changed

+84
-5
lines changed

CSharpTypePrinter.snk

596 Bytes
Binary file not shown.

Directory.Build.props

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Authors>Maksim Volkau</Authors>
4+
<Copyright>Copyright © 2020 Maksim Volkau</Copyright>
5+
<NeutralLanguage>en-US</NeutralLanguage>
6+
<LangVersion>Latest</LangVersion>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<None Remove="**\*.orig" />
10+
<None Remove="**\*.ncrunchproject" />
11+
</ItemGroup>
12+
</Project>

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# CSharpTypePrinter
22

3-
Prints a `System.Type` object as a valid C# code, e.g. prints `typeof(A<X>.B<Y>.C)` as a `"A<X>.B<Y>.C"`
3+
Targets **.NET Standard 2.0**
4+
5+
Prints a `System.Type` object as a valid C# literal, e.g. prints `typeof(A<X>.B<Y>.C)` as a `"A<X>.B<Y>.C"`
46

57
It happens that the code for this is the complex pile of details especially if we talk about nested generics.
68

src/CSharpTypePrinter/CSharpTypePrinter.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@
44

55
namespace CSharpTypePrinter
66
{
7+
/// <summary>
8+
/// Contains an extension method for the System.Type to print it as a valid C# code
9+
/// </summary>
710
public static class TypePrinter
811
{
12+
/// <summary>
13+
/// Prints System.Type object as a valid C# literal
14+
/// </summary>
15+
/// <param name="type">The type to print</param>
16+
/// <param name="stripNamespace">self explanatory</param>
17+
/// <param name="printType">function may configure the final result given the input type and the output string</param>
18+
/// <param name="printGenericTypeArgs">if set ti true will output open-generic type arguments otherwise outputs them as empty strings to be used in the typeof construct</param>
19+
/// <returns>The output C# literal for the type</returns>
920
public static string ToCSharpCode(this Type type,
1021
bool stripNamespace = false, Func<Type, string, string> printType = null, bool printGenericTypeArgs = false)
1122
{
Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,61 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
5+
</PropertyGroup>
6+
<PropertyGroup Label="Packaging">
7+
<PackageProjectUrl>https://github.com/dadhi/CSharpTypePrinter</PackageProjectUrl>
8+
<PackageLicense>https://github.com/dadhi/CSharpTypePrinter/blob/master/LICENSE</PackageLicense>
9+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
10+
<RepositoryUrl>https://github.com/dadhi/CSharpTypePrinter</RepositoryUrl>
11+
<RepositoryType>git</RepositoryType>
12+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
13+
<!-- <PackageIcon></PackageIcon> -->
14+
<VersionPrefix>1.0.0</VersionPrefix>
15+
<VersionSuffix></VersionSuffix>
16+
<Product>CSharpTypePrinter</Product>
17+
<PackageId>$(Product)</PackageId>
18+
<Title>$(Product)</Title>
19+
<Description>
20+
<![CDATA[
21+
22+
Prints System.Type object as a valid C# literal, e.g. typeof(A<X>.B<Y>.C) as a "A<X>.B<Y>.C"
23+
24+
]]>
25+
</Description>
26+
<PackageTags>pretty-print;csharp;reflection;code-generation;dotnet;type;to-string;automation;happiness;DryIoc;FastExpressionCompiler;ImTools</PackageTags>
27+
<PackageReleaseNotes>
28+
<![CDATA[
229
3-
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
</PropertyGroup>
30+
## v1.0.0 - First major version
631
32+
]]>
33+
</PackageReleaseNotes>
34+
<AssemblyName>$(Product)</AssemblyName>
35+
<AssemblyTitle>$(Product) $(TargetFramework)</AssemblyTitle>
36+
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
37+
</PropertyGroup>
38+
<PropertyGroup Label="Signing">
39+
<SignAssembly>true</SignAssembly>
40+
<AssemblyOriginatorKeyFile>..\..\CSharpTypePrinter.snk</AssemblyOriginatorKeyFile>
41+
</PropertyGroup>
42+
<ItemGroup>
43+
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" Visible="false"/>
44+
<None Include="..\..\CSharpTypePrinter.snk" Pack="true" PackagePath="CSharpTypePrinter.snk" Visible="false"/>
45+
</ItemGroup>
46+
47+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
48+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
49+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
50+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
51+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
52+
<PackageOutputPath>..\..\.dist</PackageOutputPath>
53+
<DebugType>embedded</DebugType>
54+
<DebugSymbols>true</DebugSymbols>
55+
<IncludeSymbols>false</IncludeSymbols>
56+
</PropertyGroup>
57+
58+
<ItemGroup>
59+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
60+
</ItemGroup>
761
</Project>

test/CSharpTypePrinter.Tests/CSharpTypePrinter.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<IsPackable>false</IsPackable>
55
<IsTestProject>true</IsTestProject>
66
</PropertyGroup>
7-
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
7+
<ItemGroup>
88
<PackageReference Include="NUnit" Version="3.12.0"/>
99
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0"/>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1"/>

0 commit comments

Comments
 (0)