Add Worker.Extensions.Shared.csproj and targets (#1308)

This commit is contained in:
Jacob Viau 2023-02-02 15:36:37 -08:00 коммит произвёл GitHub
Родитель 651e9adbf5
Коммит 1bafdc34c2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 89 добавлений и 0 удалений

5
Directory.Build.targets Normal file
Просмотреть файл

@ -0,0 +1,5 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)build\SharedReferences.targets" />
</Project>

Просмотреть файл

@ -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}

Просмотреть файл

@ -0,0 +1,15 @@
<Project>
<Target Name="IncludeSharedItems" BeforeTargets="BeforeCompile" Condition="'@(SharedReference)' != ''">
<PropertyGroup>
<_SharedReferenceCompileIncludes>@(SharedReference->'%(RelativeDir)**/*.cs')</_SharedReferenceCompileIncludes>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(_SharedReferenceCompileIncludes)" LinkBase="Shared" Visible="false" />
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.Build.NoTargets/3.7.0">
<!--
This project is to never be referenced directly. Instead, the files are directly
included into each source project individually via targets. The purpose of this
csproj is just so the files can show up in Visual Studio.
-->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<EnableDefaultCompileItems>true</EnableDefaultCompileItems>
<EnableDefaultEmbeddedResourceItems>true</EnableDefaultEmbeddedResourceItems>
</PropertyGroup>
<ItemGroup>
<!-- Include packages here as appropriate so that intellisense still works. -->
<!-- <PackageReference Include="PackageId" Version="PackageVersion" /> -->
</ItemGroup>
</Project>

Просмотреть файл

@ -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
<ItemGroup>
<ProjectReference Include="../../Worker.Extensions.Shared/Worker.Extensions.Shared.csproj" />
</ItemGroup>
```
**GOOD** Include this project as a `SharedReference`
``` xml
<ItemGroup>
<SharedReference Include="../../Worker.Extensions.Shared/Worker.Extensions.Shared.csproj" />
</ItemGroup>
```