Skip to content

Commit

Permalink
Merge pull request #121 from CommunityToolkit/nuget-package-fixes
Browse files Browse the repository at this point in the history
nuget package fixes
  • Loading branch information
aaronpowell authored Oct 21, 2024
2 parents b9909ed + 686d7cd commit b6e837e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 8 deletions.
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,10 @@
<IsPackable>false</IsPackable>
<UsePublicApiAnalyzers>true</UsePublicApiAnalyzers>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
</PropertyGroup>

<PropertyGroup>
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>
18 changes: 17 additions & 1 deletion docs/create-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ To create a new integration, you'll need to create a new project in the `src/` d
To improve discovery of the integration when someone consumes the NuGet package, extension methods for adding the integration should be placed in the `Aspire.Hosting` for hosting integrations or `Microsoft.Extensions.Hosting` for client integrations. For custom resources created in hosting integrations, use the `Aspire.Hosting.ApplicationModel` namespace.

If your integration will be pulling a container image from a registry, you should specify a specific tag for the image in a `major.minor` format to pull, and not use the `latest` tag. This will ensure that the integration is stable and not affected by changes to the image. If the image is not versioned, you should use the `sha256` digest of the image.

## 🪧 Example application

To demonstrate how to use the integration, you should create an example application in the `examples/` directory. This should be a simple application that demonstrates the minimal usage of the integration. At minimum there will need to be an AppHost project which uses the integration. This example application will also be used in the integration tests if it's a hosting integration.
Expand Down Expand Up @@ -120,7 +121,22 @@ Lastly, update the `README.md` in the root of this repository to include your ne

Your integration will be automatically packaged as a NuGet package when a PR is created and added as an artifact to the CI job (assuming it builds!), allowing you to test it in other projects while it is being reviewed. Once reviewed it will move through the release workflow that the maintainers have set up. You can learn more about that in the [versioning documentation](./versioning.md).

### 💡 NuGet Package metadata

Most of the NuGet metadata will be automatically added to the generated nuspec file during the packaging process in the CI pipeline but there are two pieces of metadata that you will need to add manually to the csproj file for your integration:

- `Description` - A short description of the integration.
- `AdditionalTags` - A comma-separated list of tags that describe the integration (some tags are added by default, such as `aspire`, use this to add more specific tags for your integration).

Here's an example from the OllamaSharp integration:

```xml
<PropertyGroup>
<Description>A .NET Aspire client integration for the OllamaSharp library.</Description>
<AdditionalPackageTags>ollama ai ollamasharp</AdditionalPackageTags>
</PropertyGroup>
```

## 🎉 You're done

That's it! You've created a new integration for the .NET Aspire Community Toolkit. If you have any questions or need help, feel free to reach out to the maintainers or the community on GitHub Discussions.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AdditionalPackageTags>azure staticwebapps hosting</AdditionalPackageTags>
<Description>A hosting package that wraps endpoints with the Azure Static Web Apps emulator.</Description>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AdditionalPackageTags>hosting golang</AdditionalPackageTags>
<Description>A .NET Aspire for hosting Golang apps.</Description>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AdditionalPackageTags>hosting java</AdditionalPackageTags>
<Description>A .NET Aspire for hosting Java apps using either the Java executable or container image.</Description>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<AdditionalPackageTags>hosting nodejs vite yarn pnpm npm</AdditionalPackageTags>
<Description>A .NET Aspire for hosting NodeJS apps using Vite, Yarn, PNPM, or NPM.</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<Description>A .NET Aspire client integration for the OllamaSharp library.</Description>
<AdditionalPackageTags>ollama ai ollamasharp</AdditionalPackageTags>
Expand Down
10 changes: 10 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>

<DocsPath>README.md</DocsPath>
<PackageReadmeFile>$(DocsPath)</PackageReadmeFile>
<PackageOutputPath>../../nuget</PackageOutputPath>
<PackageTags>aspire integration communitytoolkit dotnetcommunitytoolkit $(AdditionalPackageTags)</PackageTags>
</PropertyGroup>
Expand All @@ -47,4 +48,13 @@
<PackagePath>/</PackagePath>
</None>
</ItemGroup>

<!--
Create local branding
-->
<PropertyGroup Condition=" '$(ContinuousIntegrationBuild)' == 'false' AND '$(VersionSuffix)' == '' ">
<_VersionSuffix>$([System.DateTime]::Now.ToString(yyMMdd-HHmm))</_VersionSuffix>
<VersionSuffix>dev.$(_VersionSuffix)</VersionSuffix>
<PackageVersion>$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
</PropertyGroup>
</Project>

0 comments on commit b6e837e

Please sign in to comment.