Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: johnkors/dotnet-library
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.1.0
Choose a base ref
...
head repository: johnkors/dotnet-library
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0.1.1
Choose a head ref
  • 2 commits
  • 8 files changed
  • 1 contributor

Commits on Nov 9, 2021

  1. update readme

    johnkors committed Nov 9, 2021

    Verified

    This commit was signed with the committer’s verified signature.
    kianenigma Kian Paimani
    Copy the full SHA
    a9619ca View commit details

Commits on Nov 10, 2021

  1. How to add p2p dependencies in a nuget package when using dotnet pack (

    …#2)
    
    * Adds new transient dependency in the nuget
    
    * Adds hack to include peer dependencies in nuget
    johnkors authored Nov 10, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    979faec View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -348,3 +348,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
.DS_Store
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# dotnet-library

Template repo for setting up a simple .NET library show casing some common use cases:
### Sample badges
[![Build](https://github.com/johnkors/dotnet-library/workflows/CI/badge.svg)](https://github.com/johnkors/dotnet-library/actions)
[![NuGet](https://img.shields.io/nuget/v/SomeClassLib.svg)](https://www.nuget.org/packages/SomeClassLib/)
[![NuGet](https://img.shields.io/nuget/dt/SomeClassLib.svg)](https://www.nuget.org/packages/SomeClassLib/)


# What is this?

Template repo for setting up a simple .NET library (nuget) show casing some common use cases:


- GitHub actions (CI, deploy)
@@ -17,7 +25,7 @@ Template repo for setting up a simple .NET library show casing some common use c
- Package icon (embedded in nuget)
- Readme showing in nuget.org (embedded in nuget),
- Multi-targeting and conditional dependencies dep on TFM
- Funding for Github Sponsors
- Funding for GitHub Sponsors
- MIT License


8 changes: 7 additions & 1 deletion source/DotNetLibrary.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30114.105
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomeClassLib", "SomeClassLi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomeClassLib.Tests", "SomeClassLib.Tests\SomeClassLib.Tests.csproj", "{5DBA7F8C-9688-40CA-A3AD-7028B65FC30E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SomePeerDependency", "SomePeerDependency\SomePeerDependency.csproj", "{7BB23A40-B696-42A8-9610-35A1076182AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -24,5 +26,9 @@ Global
{5DBA7F8C-9688-40CA-A3AD-7028B65FC30E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DBA7F8C-9688-40CA-A3AD-7028B65FC30E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DBA7F8C-9688-40CA-A3AD-7028B65FC30E}.Release|Any CPU.Build.0 = Release|Any CPU
{7BB23A40-B696-42A8-9610-35A1076182AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BB23A40-B696-42A8-9610-35A1076182AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BB23A40-B696-42A8-9610-35A1076182AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BB23A40-B696-42A8-9610-35A1076182AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion source/SomeClassLib.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -5,6 +5,6 @@ public class UnitTest1
[Fact]
public void Test1()
{
Assert.Equal("Hello, John", Class1.Greet("John"));
Assert.Equal("Hello, JOHN", Class1.Greet("John"));
}
}
6 changes: 4 additions & 2 deletions source/SomeClassLib/Class1.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace SomeClassLib;
using SomePeerDependency;

namespace SomeClassLib;

public class Class1
{
public static string Greet(string name)
{
return $"Hello, {name}";
return $"Hello, {PeerClass.Upper(name)}";
}
}
13 changes: 13 additions & 0 deletions source/SomeClassLib/SomeClassLib.csproj
Original file line number Diff line number Diff line change
@@ -37,4 +37,17 @@
<None Include="../../README.md" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SomePeerDependency\SomePeerDependency.csproj" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeP2PAssets</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="IncludeP2PAssets">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)SomePeerDependency.dll" />
</ItemGroup>
</Target>

</Project>
8 changes: 8 additions & 0 deletions source/SomePeerDependency/PeerClass.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SomePeerDependency;
public class PeerClass
{
public static string Upper(string text)
{
return text.ToUpper();
}
}
11 changes: 11 additions & 0 deletions source/SomePeerDependency/SomePeerDependency.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

</Project>