I'm looking to embed the scoped css bundle file that a razor class library project generates. This file is placed on the obj folder upon build. I'm having a challenge defining the correct msbuild target to emit the embedded resource at the right time during the build.
After much digging into the dotnet target files, this is what I currently have in the .csproj file.
<Target Name="EmbedScopedCss" BeforeTargets="BeforeResGen" AfterTargets="BundleScopedCssFiles">
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)scopedcss\bundle\$(PackageId).styles.css" Type="Non-Resx" WithCulture="false" />
</ItemGroup>
</Target>
This is supposed to make the embedded resource item be emitted just before the BeforeResGen target, which is the last moment, to my knowledge, before resources are enumerated to be embedded into the assembly.
However, this still appears to be running too early in the build process, as the file itself does not exist at this time.
I have inferred AfterTargets="BundleScopedCssFiles" from the razor sdk scoped css target file but it doesn't appear to be enough.
Is there a way to do this?