ILMerge and Web Resources

We are trying to combine our DLL into one for deployment, thus ILMerge. Almost everything seems to work just fine. We have several web controls that use ClientScript.RegisterClientScriptResource, and it is 404-ing after the merge (they worked before the merge).

For example, one of our controls will 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 will be located in Project WebControls, the assembly of Company.WebControls. Under it would be ControlA.cs and ControlA.js. ControlA.js is marked as an embedded resource. In AssemblyInfo.cs, I include the following:

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

After it is combined into CompanyA.dll, what is the correct way to link to this web resource? The ILMerge command line looks like this (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

+3
source share
2

- . , , . copyattrs , ( ). DLL - - .

: "C:\Program Files\Microsoft\ILMerge\ILMerge.exe" /keyfile:../../Company.snk/wildcards: True/out:Company.dll .Merge.dll . *. Dll

+4

/allowMultiple /copyattrs. ILMerge .

0

Source: https://habr.com/ru/post/1696483/


All Articles