You need to set up an ResourceManager by defining an IResourceWriter
and write to it, then read in the icon as bytes and set it, according to this documentation from MSDN, I guess the code would look something like this, as I have not done this before, judging by the code sample, after you save the assembly, add the unmanaged resource and name it as 'app.ico':
// Defines a standalone managed resource for this assembly.
IResourceWriter myResourceWriter = myAssembly.DefineResource("myResourceIcon",
"myResourceIcon.ico", "MyAssemblyResource.resources",
ResourceAttributes.Public);
myResourceWriter.AddResource("app.ico", "Testing for the added resource");
myAssembly.Save(myAssembly.GetName().Name + ".dll");
// Defines an unmanaged resource file for this assembly.
bool bSuccess = false;
byte[] iconB = null;
using (System.IO.FileStream fStream = new FileStream("icon.ico", FileMode.Open, FileAccess.Read)){
iconB = new byte[(int)fStream.Length];
int nRead = fStream.Read(out iconB, 0, iconB.Length);
if (nRead == iconB.Length) bSuccess = true;
}
if (bSuccess){
myAssembly.DefineUnmanagedResource(iconB);
}