C#, .NET, How can I make a code generator download when my NuGet package is installed?
csproj, Engine: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>JamEngine</Title>
<Authors>3l4z1o_</Authors>
<Description>Un motor pequeño, pero potente para hacer juegos de jam, de manera fácil, rápida, simple y ligera.</Description>
<Version>1.1.0</Version>
<IncludeBuildOutput>true</IncludeBuildOutput>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Engine_Window" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Engine_SourceGenerator" Version="1.0.0">
<IncludeAssets>all</IncludeAssets>
<ExcludeAssets>none</ExcludeAssets>
</PackageReference>
</ItemGroup>
</Project>
csproj, Engine_SourceGenerator: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>EngineSourceGenerator</Title>
<Authors>3l4z1o</Authors>
<Description>Generador de codigo para JamEngine</Description>
<PackageType>Analyzer</PackageType>
<IncludeBuildOutput>false</IncludeBuildOutput>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<IsRoslynComponent>true</IsRoslynComponent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.14.0" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<None Include="bin\$(Configuration)\netstandard2.0\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" />
</ItemGroup>
</Project>
Target: When someone downloads my Engine.dll library through NuGet, for example: <ItemGroup><PackageReference Include="Engine" Version="1.1.0"/></ItemGroup>a code generator should be downloaded that takes care of creating the entry point with a couple of modifications: context.RegisterSourceOutput(context.CompilationProvider, (ctx, compilation) =>{var programSource = @"using Engine;using System;public static class Program{public static void Main(string[] args){EngineInitializer.Initialize();}}";ctx.AddSource("Program.g.cs", SourceText.From(programSource, Encoding.UTF8));});but I want to avoid having the developer install the 2 packages separately. Is it possible to achieve this?