Skip to content

Commit

Permalink
feat: Copy plugins to publish directory (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDave1999 authored Jan 14, 2024
1 parent d3c518a commit 5fcfe4c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 28 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CopyPluginsToPublishDirectory" Version="1.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,12 @@

<ItemGroup>
<PackageReference Include="DotEnv.Core" />
<PackageReference Include="CopyPluginsToPublishDirectory" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Core\CPlugin.Net.csproj" />
<ProjectReference Include="..\..\Contracts\Example.Contracts.csproj" />
</ItemGroup>

<ItemGroup>
<!--
Copy the plugins directory to the publish directory.
This copies the directories and subdirectories (including files with extension)
from the plugins folder to the publish directory.
For this to work, the plug-ins must be compiled.
-->
<Content
Include="bin\$(Configuration)\$(TargetFramework)\plugins\**"
CopyToPublishDirectory="PreserveNewest"
TargetPath="plugins\%(RecursiveDir)\%(Filename)%(Extension)"
/>
</ItemGroup>

</Project>
15 changes: 1 addition & 14 deletions samples/HostApplications/WebApi/Example.HostWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Swashbuckle.AspNetCore" />
<PackageReference Include="SimpleResults.AspNetCore" />
<PackageReference Include="CopyPluginsToPublishDirectory" />
</ItemGroup>

<ItemGroup>
Expand All @@ -16,18 +17,4 @@
<ProjectReference Include="..\..\SharedEntities\Example.SharedEntities.csproj" />
</ItemGroup>

<ItemGroup>
<!--
Copy the plugins directory to the publish directory.
This copies the directories and subdirectories (including files with extension)
from the plugins folder to the publish directory.
For this to work, the plug-ins must be compiled.
-->
<Content
Include="bin\$(Configuration)\$(TargetFramework)\plugins\**"
CopyToPublishDirectory="PreserveNewest"
TargetPath="plugins\%(RecursiveDir)\%(Filename)%(Extension)"
/>
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions targets/CopyPluginsToPublishDirectory.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>CopyPluginsToPublishDirectory</id>
<version>1.0.0</version>
<authors>Dave Roman</authors>
<owners>Dave Roman</owners>
<projectUrl>https://github.com/MrDave1999/CPlugin.Net</projectUrl>
<license type="expression">MIT</license>
<readme>README.md</readme>
<icon>plugin-icon-nuget.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
A simple package that allows to copy the plugins directory from the output directory to the publish directory
</description>
<releaseNotes></releaseNotes>
<copyright>Copyright (c) Dave Roman</copyright>
<tags>targets target plugins addons plugin plugin-architecture</tags>
</metadata>

<files>
<file src="README.md" target="" />
<file src="..\plugin-icon-nuget.png" target="" />
<file src="build\**" target="build" />
</files>
</package>
3 changes: 3 additions & 0 deletions targets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## About

A simple package that allows to copy the plugins directory from the output directory (e.g. bin/Debug/net8.0) to the publish directory.
17 changes: 17 additions & 0 deletions targets/build/CopyPluginsToPublishDirectory.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>

<ItemGroup>
<!--
Copy the plugins directory to the publish directory.
This copies the directories and subdirectories (including files with extension)
from the plugins folder to the publish directory.
For this to work, the plugins must be compiled.
-->
<Content
Include="bin\$(Configuration)\$(TargetFramework)\plugins\**"
CopyToPublishDirectory="PreserveNewest"
TargetPath="plugins\%(RecursiveDir)\%(Filename)%(Extension)"
/>
</ItemGroup>

</Project>

0 comments on commit 5fcfe4c

Please sign in to comment.