Skip to content

Propose to improve binding redirects genenration #34

@gillg

Description

@gillg

Hello,

The current solution with a target to replace web.config with the build config file is not so bad, but implies to version kind of "statics" binding redirects. Moreover, I guess they will remains even if your dependancy doesn't need a binding redirect anymore, or if you uninstall it...

I suggest something like that in SystemWeb targets :

  <Target Name="AfterBuild">
    <XmlPeek XmlInputPath="$(TargetDir)\$(AssemblyName).dll.config"
             Query="/configuration/runtime">
      <Output TaskParameter="Result" ItemName="GeneratedBindings" />
    </XmlPeek>
    <WriteLinesToFile
        File="$(TargetDir)\Web.bindings.config"
        Overwrite="true"
        Lines="&lt;?xml version=&quot;1.0&quot;?&gt;&lt;configuration&gt;;@(GeneratedBindings);&lt;/configuration&gt;" />
  </Target>

And in your personal Web.config you remove ALL the binding redirects and you replace them by :

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  [...]
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <linkedConfiguration href="file:./bin/Web.bindings.config"/>
  </assemblyBinding>
</configuration>

What do you think about it ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions