Let's say, I've got two projects. A.csproj and B.csproj. A.csproj references B.csproj which contains files that needs to be pregenerated during the compilation and included in the output. I would like to treat them as post compilation artifacts that are required to be present in the final binary directory.
in b.csproj I defined custom after compile target:
<Target Name="GenerateEmails" AfterTargets="AfterCompile">
<MakeDir Directories="$(ProjectDir)$(OutDir)Emails\ForgetPassword"/>
<MakeDir Directories="$(ProjectDir)$(OutDir)Emails\PasswordChanged"/>
<MakeDir Directories="$(ProjectDir)$(OutDir)Emails\Removed"/>
<MakeDir Directories="$(ProjectDir)$(OutDir)Emails\Welcome"/>
<Exec Command="mjml $(ProjectDir)EmailTemplates\ForgetPassword\Content.mjml -o $(ProjectDir)$(OutDir)Emails\ForgetPassword\Content.html"/>
<Exec Command="mjml $(ProjectDir)EmailTemplates\Removed\Content.mjml -o $(ProjectDir)$(OutDir)Emails\Removed\Content.html"/>
<Exec Command="mjml $(ProjectDir)EmailTemplates\Welcome\Content.mjml -o $(ProjectDir)$(OutDir)Emails\Welcome\Content.html"/>
<Copy SourceFiles="$(ProjectDir)EmailTemplates\PasswordChanged\Subject.txt" DestinationFolder="$(ProjectDir)$(OutDir)Emails\PasswordChanged\"/>
<Copy SourceFiles="$(ProjectDir)EmailTemplates\ForgetPassword\Subject.txt" DestinationFolder="$(ProjectDir)$(OutDir)Emails\ForgetPassword\"/>
<Copy SourceFiles="$(ProjectDir)EmailTemplates\Removed\Subject.txt" DestinationFolder="$(ProjectDir)$(OutDir)Emails\Removed\"/>
<Copy SourceFiles="$(ProjectDir)EmailTemplates\Welcome\Subject.txt" DestinationFolder="$(ProjectDir)$(OutDir)Emails\Welcome\"/>
</Target>
and it works fine if I build B.csproj where this target is defined however when I build it from A.csproj required folder is missing in A\bin\debug\netcore\6.0 folder.
How to make this folder to be considered as a regular .dll file that must be present especially when B project is referenced project