Is there a way to dynamically add an embedded resource during the build process? I am currently using Ajax-Minifier to reduce two files down into one. The result works great. However I need to include this file as an embedded resource when the code is running in release mode (currently toggled by a Preprocessor directive of if(!DEBUG)
Here's a simple version of the target command I am using in my MSBUILD
<Target Name="TestMinifiy" Condition=" '$(ConfigurationName)' == 'Release' ">
<ItemGroup>
<MyScript Include="..\Test1.js" />
<MyScript Include="..\Test2.js" />
</ItemGroup>
<AjaxMin JsSourceFiles="@(MyScript)" JsCombinedFileName="$(IntermediateOutputPath)\Final.js" />
</Target>
So basically I would like to include Final.js as an embedded resource, I then can reference within the code.
From the C# side this is what I am looking to do:
#if (!DEBUG)
[assembly: WebResource("Final.js", "text/javascript")]
#endif
Any help or ideas would be appreciated.
EDIT:
I've changed the JsCombinedFileName to $(IntermediateOutputPath)\Final.js. So that should create the file. I've then created a separate target to embed this file.
<Target Name="EmbedResource" Condition=" '$(ConfigurationName)' == 'Release' ">
<Message Text="Copying into Embedded..." Importance="high" />
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)\Final.js" >
<LogicalName>
Final.js
</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
However, still no luck.