views:

722

answers:

1

Hello all,

We're attemtping to merge our DLL's into one for deployment, thus ILMerge. Almost everything seems to work great. We have a couple web controls that use ClientScript.RegisterClientScriptResource and these are 404-ing after the merge (These worked before the merge).

For example one of our controls would look like

namespace Company.WebControls
{
  public class ControlA: CompositeControl, INamingContainer
  {
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        this.Page.ClientScript.RegisterClientScriptResource(typeof(ControlA), "Company.WebControls.ControlA.js");                
    }      
  }
}

It would be located in Project WebControls, assembly Company.WebControls. Underneath would be ControlA.cs and ControlA.js. ControlA.js is marked as an embedded resource. In the AssemblyInfo.cs I include the following:

[assembly: System.Web.UI.WebResource("Company.WebControls.ControlA.js", "application/x-javascript")]

After this is merged into CompanyA.dll, what is the proper way to reference this web resource? The ILMerge command line is as follows (from the bin directory after the build): "C:\Program Files\Microsoft\ILMerge\ILMerge.exe" /keyfile:../../CompanySK.snk /wildcards:True /copyattrs:True /out:Company.dll Company.*.dll

Thanks in advance!

+2  A: 

OK - I got this working. It looks like the primary assembly was the only one whose assembly attributes were being copied. With copyattrs set, the last one in would win, not a merge (as far as I can tell). I created a dummy project to reference the other DLL's and included all the web resources from those projects in the dummy assembly info - now multiple resources from multiple projects are all loading correctly.

Final post-build command line for dummy project: "C:\Program Files\Microsoft\ILMerge\ILMerge.exe" /keyfile:../../Company.snk /wildcards:True /out:Company.dll Company.Merge.dll Company.*.dll

Thanks.

benjynito