From 1bafdc34c2e061cc756c68a4ecbb88fca2079e71 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Thu, 2 Feb 2023 15:36:37 -0800 Subject: [PATCH] Add Worker.Extensions.Shared.csproj and targets (#1308) --- Directory.Build.targets | 5 +++ DotNetWorker.sln | 8 ++++ build/SharedReferences.targets | 15 +++++++ .../Worker.Extensions.Shared.csproj | 22 +++++++++++ extensions/Worker.Extensions.Shared/readme.md | 39 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 Directory.Build.targets create mode 100644 build/SharedReferences.targets create mode 100644 extensions/Worker.Extensions.Shared/Worker.Extensions.Shared.csproj create mode 100644 extensions/Worker.Extensions.Shared/readme.md diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..0f261217 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,5 @@ + + + + + diff --git a/DotNetWorker.sln b/DotNetWorker.sln index c383b76a..b09625ee 100644 --- a/DotNetWorker.sln +++ b/DotNetWorker.sln @@ -22,6 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{1B6B4B62 build\icon.png = build\icon.png build\Icon.props = build\Icon.props build\PackageInfo.props = build\PackageInfo.props + build\SharedReferences.targets = build\SharedReferences.targets EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sdk", "sdk\Sdk\Sdk.csproj", "{E28BAAEF-4E70-4CAB-8475-759ECBAF1AF5}" @@ -115,6 +116,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetWorker.ApplicationIns EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker.Extensions.Tables", "extensions\Worker.Extensions.Tables\src\Worker.Extensions.Tables.csproj", "{004DEF24-7EBB-499D-BD1C-E940AC4E122D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worker.Extensions.Shared", "extensions\Worker.Extensions.Shared\Worker.Extensions.Shared.csproj", "{277D77B9-8915-41E3-8763-0B66328ADDDA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -281,6 +284,10 @@ Global {004DEF24-7EBB-499D-BD1C-E940AC4E122D}.Debug|Any CPU.Build.0 = Debug|Any CPU {004DEF24-7EBB-499D-BD1C-E940AC4E122D}.Release|Any CPU.ActiveCfg = Release|Any CPU {004DEF24-7EBB-499D-BD1C-E940AC4E122D}.Release|Any CPU.Build.0 = Release|Any CPU + {277D77B9-8915-41E3-8763-0B66328ADDDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {277D77B9-8915-41E3-8763-0B66328ADDDA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {277D77B9-8915-41E3-8763-0B66328ADDDA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {277D77B9-8915-41E3-8763-0B66328ADDDA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -330,6 +337,7 @@ Global {B37E6BAC-F16B-4366-94FB-8B94B52A08C9} = {9D6603BD-7EA2-4D11-A69C-0D9E01317FD6} {65DE66B6-568F-46AC-8F0D-C79A02F48214} = {083592CA-7DAB-44CE-8979-44FAFA46AEC3} {004DEF24-7EBB-499D-BD1C-E940AC4E122D} = {A7B4FF1E-3DF7-4F28-9333-D0961CDDF702} + {277D77B9-8915-41E3-8763-0B66328ADDDA} = {A7B4FF1E-3DF7-4F28-9333-D0961CDDF702} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {497D2ED4-A13E-4BCA-8D29-F30CA7D0EA4A} diff --git a/build/SharedReferences.targets b/build/SharedReferences.targets new file mode 100644 index 00000000..aa4179a8 --- /dev/null +++ b/build/SharedReferences.targets @@ -0,0 +1,15 @@ + + + + + + <_SharedReferenceCompileIncludes>@(SharedReference->'%(RelativeDir)**/*.cs') + + + + + + + + + diff --git a/extensions/Worker.Extensions.Shared/Worker.Extensions.Shared.csproj b/extensions/Worker.Extensions.Shared/Worker.Extensions.Shared.csproj new file mode 100644 index 00000000..4a308872 --- /dev/null +++ b/extensions/Worker.Extensions.Shared/Worker.Extensions.Shared.csproj @@ -0,0 +1,22 @@ + + + + + + netstandard2.0 + false + false + true + true + + + + + + + + diff --git a/extensions/Worker.Extensions.Shared/readme.md b/extensions/Worker.Extensions.Shared/readme.md new file mode 100644 index 00000000..ee7af5c5 --- /dev/null +++ b/extensions/Worker.Extensions.Shared/readme.md @@ -0,0 +1,39 @@ +# Worker.Extensions.Shared + +This is much like the shared-project `.shproj` where files are included directly in referencing projects. The purpose of this is to let us have common code between projects that we do not want to be part of our public API surface. + +## What belongs here? + +Include helpers, utility classes, or extension methods here. Keep in mind the dependencies of the types you include here, as this is intended for minimal dependencies. Try to keep the dependencies here rather "Core". If it is not good enough for **ALL** `Worker.Extensions.*` packages to reference it, it does not belong here. + +✅ **GOOD** using base class library types +✅ **GOOD** "Core" `Microsoft.Extensions.*` packages (ie `Microsoft.Extensions.Configuration`) +❌ **BAD** Specific Azure services. ie: `Azure.Storage.*` +❌ **BAD** AspNetCore libraries `Microsoft.AspNetCore.*` + +## Adding files + +Just add any `.cs` file here as needed. Some things to keep in mind: + +❌ `.resx` files are not yet supported. Additional work is needed to transform how they are included into the target projects. +❌ **never** include `public` types. \ +✅ `internal` or `private` are fine. \ +⚠️ consider always rooting the namespace as `Microsoft.Azure.Functions.Worker`. \ + +## How to reference + +❌ **BAD** Do not include this as a `ProjectReference` + +``` xml + + + +``` + +✅ **GOOD** Include this project as a `SharedReference` + +``` xml + + + +```