From 7a95ed386e55462fc571f34e8c13ca8621f3d32c Mon Sep 17 00:00:00 2001 From: John Korsnes Date: Wed, 10 Nov 2021 10:58:10 +0100 Subject: [PATCH 1/2] Adds new transient dependency in the nuget --- .gitignore | 1 + source/DotNetLibrary.sln | 8 +++++++- source/SomeClassLib.Tests/UnitTest1.cs | 2 +- source/SomeClassLib/Class1.cs | 6 ++++-- source/SomeClassLib/SomeClassLib.csproj | 4 ++++ source/SomePeerDependency/PeerClass.cs | 8 ++++++++ source/SomePeerDependency/SomePeerDependency.csproj | 10 ++++++++++ 7 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 source/SomePeerDependency/PeerClass.cs create mode 100644 source/SomePeerDependency/SomePeerDependency.csproj diff --git a/.gitignore b/.gitignore index dfcfd56..a73a38f 100644 --- a/.gitignore +++ b/.gitignore @@ -348,3 +348,4 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ +.DS_Store diff --git a/source/DotNetLibrary.sln b/source/DotNetLibrary.sln index 191825e..5b01a05 100644 --- a/source/DotNetLibrary.sln +++ b/source/DotNetLibrary.sln @@ -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 diff --git a/source/SomeClassLib.Tests/UnitTest1.cs b/source/SomeClassLib.Tests/UnitTest1.cs index 8835a46..e269843 100644 --- a/source/SomeClassLib.Tests/UnitTest1.cs +++ b/source/SomeClassLib.Tests/UnitTest1.cs @@ -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")); } } diff --git a/source/SomeClassLib/Class1.cs b/source/SomeClassLib/Class1.cs index d04ddf0..11ab6b0 100644 --- a/source/SomeClassLib/Class1.cs +++ b/source/SomeClassLib/Class1.cs @@ -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)}"; } } diff --git a/source/SomeClassLib/SomeClassLib.csproj b/source/SomeClassLib/SomeClassLib.csproj index 565ea73..0b9f460 100644 --- a/source/SomeClassLib/SomeClassLib.csproj +++ b/source/SomeClassLib/SomeClassLib.csproj @@ -37,4 +37,8 @@ + + + + diff --git a/source/SomePeerDependency/PeerClass.cs b/source/SomePeerDependency/PeerClass.cs new file mode 100644 index 0000000..1d62385 --- /dev/null +++ b/source/SomePeerDependency/PeerClass.cs @@ -0,0 +1,8 @@ +namespace SomePeerDependency; +public class PeerClass +{ + public static string Upper(string text) + { + return text.ToUpper(); + } +} diff --git a/source/SomePeerDependency/SomePeerDependency.csproj b/source/SomePeerDependency/SomePeerDependency.csproj new file mode 100644 index 0000000..dbd45b3 --- /dev/null +++ b/source/SomePeerDependency/SomePeerDependency.csproj @@ -0,0 +1,10 @@ + + + + net5.0;net6.0 + enable + enable + latest + + + From 55ee530f957548e2c6960e1da9918ac05282179b Mon Sep 17 00:00:00 2001 From: John Korsnes Date: Wed, 10 Nov 2021 11:04:29 +0100 Subject: [PATCH 2/2] Adds hack to include peer dependencies in nuget --- source/SomeClassLib/SomeClassLib.csproj | 11 ++++++++++- source/SomePeerDependency/SomePeerDependency.csproj | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/SomeClassLib/SomeClassLib.csproj b/source/SomeClassLib/SomeClassLib.csproj index 0b9f460..0e58e77 100644 --- a/source/SomeClassLib/SomeClassLib.csproj +++ b/source/SomeClassLib/SomeClassLib.csproj @@ -38,7 +38,16 @@ - + + + $(TargetsForTfmSpecificBuildOutput);IncludeP2PAssets + + + + + + + diff --git a/source/SomePeerDependency/SomePeerDependency.csproj b/source/SomePeerDependency/SomePeerDependency.csproj index dbd45b3..5642489 100644 --- a/source/SomePeerDependency/SomePeerDependency.csproj +++ b/source/SomePeerDependency/SomePeerDependency.csproj @@ -5,6 +5,7 @@ enable enable latest + false