Embed Resource that's dynamically generated into a C# assembly

I am trying to figure out how to tweak my project's .csproj file to get it to embed a resource (a text file) that I generate dynamically (either in the BeforeBuild or BeforeResGen targets). I have tried adding the generated resource to EmbeddedResource but no joy. What's the "right" way to do this

Answer this question

Embed Resource that's dynamically generated into a C# assembly

  • ofer ebert

    Keith,

    I took a brand new C# project and added this below the import at the bottom:

    <Target Name="beforebuild">
    <CreateItem Include="foo.txt">
    <Output TaskParameter="Include" ItemName="EmbeddedResource"/>
    </CreateItem>
    </Target>

    I then get foo.txt embedded into the main assembly. Could you check you're defining the target below the import

    Sorry for the delay replying,

    Dan



  • Embed Resource that's dynamically generated into a C# assembly