企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 开发插件 ## 项目准备 1. 新建一个NetCore项目 2. 引入主程序目录的LinkCore.Interface.dll **(所有插件都需要引入)** 4. 新建一个类名为"Runner.cs" ``` using LinkCore.Interface; using LinkCore.Interface.Router; using System; namespace Demo { public class Runner : IPlugin.IRunner { public void Dispose() { } public void OnStart() { Logger.Info(this.GetType().Namespace + "插件被启动"); } } } ``` ## 生命周期 OnStart 当插件被激活时触发运行 # 编译发布 ``` //输出类型为类库,NetCore版本为6.0 <PropertyGroup> <OutputType>Library</OutputType> <TargetFramework>net6.0</TargetFramework> <DebugType>embedded</DebugType> </PropertyGroup> //删除无效的文件 <Target Name="PostBuild" AfterTargets="PostBuildEvent"> // 已经过时 <Exec Command="cd $(OutDir)&#xD;&#xA;del /f /s /q LinkCore.*&#xD;&#xA;del /f /s /q *.json&#xD;&#xA;del /f /s /q *.pdb&#xD;&#xA;del /f /s /q Microsoft.*&#xD;&#xA;rd/s/q ref" /> <Exec Command="$(OutDir)..\..\PluginBuildAfter.exe $(MSBuildProjectName)" /> </Target> //linux环境 <Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Command="dotnet $(OutDir)..\..\PluginBuildAfter.dll $(MSBuildProjectName)" /> </Target>         //Release发布路径 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <OutputPath>主程序路径\Plugins\Demo\</OutputPath> <NoWarn>1701;1702;1591;0219</NoWarn> </PropertyGroup> //Debug发布路径 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <OutputPath>主程序路径\Plugins\Demo\</OutputPath> <NoWarn>1701;1702;1591;0219</NoWarn> </PropertyGroup> ``` 配置好后 `CTRL` + `B` 完成编译