Publish
Have you developed an extension for DevToys and are ready to share it with the world? That's fantastic! Publishing your extension is both simple and free.
Considerations when Release build
DevToys' extensibility is made possible through the Managed Extensibility Framework (MEF). MEF is excellent for desktop applications as it enables an app to dynamically load any .NET class library that implements specific interfaces used by DevToys for extensibility, without the main DevToys app needing prior knowledge of your extension.
However, this flexibility comes with a significant caveat. Extensions are discovered through Reflection, which has implications for Release builds:
- Exercise caution when using trimming, as Reflection can be affected by it.
- Native AOT can introduce a lot of complications. It can modify your Class Library such that DevToys won't locate your components via Reflection. You'll also need to compile and release a distinct binary file for each platform you aim to target (Windows, macOS, Linux).
Unless there's a compelling reason to use AOT and trimming, we advise against using trimming and AOT when building an extensions for DevToys in Release mode.
Packing an extension
DevToys extensions should be packaged as NuGet package. When installing an extension through the Manage extensions page in DevToys, the app unpacks the NuGet package and stores it in a directory. DevToys uses the .nuspec file of the NuGet package (a file containing declarative package information) to display details about the extension in the extension manager, such as its title, description, and version number.
As of DevToys 2.0 preview, the app does not automatically verify whether a new version of the extension is available, but this feature may be supported soon.
To create an extension package, start by editing the *.csproj
file you created in the previous steps and add the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- NuGet package -->
<IsPackable>true</IsPackable>
<Version>1.0.0</Version>
<Title>MyExtension</Title>
<Description>A description of my extension.</Description>
<PackageProjectUrl>https://my-website.com</PackageProjectUrl>
<RepositoryUrl>https://github.com/user/repository</RepositoryUrl>
<Authors>my name</Authors>
<PackageTags>devtoys-app</PackageTags>
</PropertyGroup>
<ItemGroup>
<None Include="$(RepoRoot)LICENSE.md" Link="docs\LICENSE.md" Pack="true" PackagePath="\" />
<None Include="$(RepoRoot)README.md" Link="docs\README.md" Pack="true" PackagePath="\" />
<!-- This makes sure to include platform-specific binaries into the NuGet package, if any-->
<None Include="runtimes\**" Pack="true" PackagePath="\lib\net8.0\runtimes\">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- This makes sure to include dependencies of the project into the NuGet package, if any -->
<Target Name="IncludeAllFilesInTargetDir" BeforeTargets="_GetPackageFiles">
<ItemGroup>
<None Include="$(OutputPath)\**">
<Pack>true</Pack>
<PackagePath>lib\net8.0</PackagePath>
</None>
</ItemGroup>
</Target>
</Project>
These project properties will allow the creation of the nuspec file automatically. You can then use the dotnet pack command to generate a .nupkg
file, which is a NuGet Package.
Platform-specific binaries
Sometimes, an extension needs some resources that are built for a specific operating system. If properly configured, DevToys can automatically extract binaries matching the operating system on which the app is running. To do so, simply place platform-specific files into a folder runtimes/[operating-system]
.
Here are the supported folder names:
- runtimes/linux/
- runtimes/linux-x86/
- runtimes/linux-x64/
- runtimes/linux-arm64/
- runtimes/osx/
- runtimes/osx-x86/
- runtimes/osx-x64/
- runtimes/osx-arm64/
- runtimes/win/
- runtimes/win-x86/
- runtimes/win-x64/
- runtimes/win-arm64/
Example: If a user installs an extension on Windows x64, only files from runtimes/win/
and runtimes/win-x64/
will be installed on the user machine.
Publishing an extension
There are several ways to share your extension online. Here are a few recommendations:
- Publish it on nuget.org for free. We recommend using the tag
devtoys-app
, where we aim to centralize most extensions for DevToys, making them easier to discover. - Publish it on a private NuGet feed. This can be beneficial if you want to share your extension internally within an organization.
- Publish it on GitHub for free, especially if your extension is open-source.
- Publish it on your own website.