New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleans binding redirects #1235

Merged
merged 4 commits into from Nov 19, 2015

Conversation

Projects
None yet
5 participants
@mrinaldi
Contributor

mrinaldi commented Nov 18, 2015

This PR closes #1218.

It removes all binding redirects when the --hard flag is used.

It also marks all binding redirects with a <!--Paket--> comment.
This was the best way I've found to mark the paket's redirects.
Since it does that, it also removes all binding redirects marked with the comment, regardless the --hard is used.

Take this app.config for example:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.36.9.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="7.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <!-- Paket -->
    <assemblyIdentity name="xunit.extensions" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="1.9.2.1705" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>

This project only needs Castle.Core and Newtonsoft.Json binding redirect

Running paket install, this is the result:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.36.9.0" />
  </dependentAssembly>
  <dependentAssembly>
    <!--Paket-->
    <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <!--Paket-->
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="7.0.0.0" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>

Note that Ploeh.AutoFixture redirect was not removed because it was not marked.
xunit.extensions redirect was marked though, hence it was removed.

On the other hand, running paket install --hard this is the resulting file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <!--Paket-->
    <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <!--Paket-->
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="7.0.0.0" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>

Note that regardless the redirect was marked, it was removed, leaving only the required redirects.

@forki

This comment has been minimized.

Show comment
Hide comment
@forki
Member

forki commented Nov 18, 2015

@baronfel

This comment has been minimized.

Show comment
Hide comment
@baronfel

baronfel Nov 18, 2015

Contributor

What's the rationale for using <!--Paket--> instead of <Paket>True</Paket> like in the .csproj?

<Reference Include="FSharpx.Collections">
    <HintPath>..\packages\FSharpx.Collections\lib\portable-net4+sl4+wp71+win8\FSharpx.Collections.dll</HintPath>
    <Private>True</Private>
    <Paket>True</Paket>
</Reference>
Contributor

baronfel commented Nov 18, 2015

What's the rationale for using <!--Paket--> instead of <Paket>True</Paket> like in the .csproj?

<Reference Include="FSharpx.Collections">
    <HintPath>..\packages\FSharpx.Collections\lib\portable-net4+sl4+wp71+win8\FSharpx.Collections.dll</HintPath>
    <Private>True</Private>
    <Paket>True</Paket>
</Reference>
@isaacabraham

This comment has been minimized.

Show comment
Hide comment
@isaacabraham

isaacabraham Nov 18, 2015

Contributor

Was just going to ask the same question - surely better to use an attribute or element?

Also - whilst you're at this, can you see if it's possible to properly format the BR area of XML as well? If it's more than 60 seconds work, leave it and I'll raise an issue for it.

Contributor

isaacabraham commented Nov 18, 2015

Was just going to ask the same question - surely better to use an attribute or element?

Also - whilst you're at this, can you see if it's possible to properly format the BR area of XML as well? If it's more than 60 seconds work, leave it and I'll raise an issue for it.

@mrinaldi

This comment has been minimized.

Show comment
Hide comment
@mrinaldi

mrinaldi Nov 18, 2015

Contributor

I checked the urn:schemas-microsoft-com:asm.v1 schema and for some reason I thought a <Paket>True</Paket> was not allowed. I never tested it though. <-- that's me being stupid

I just tested it and it does work. I'm gonna change it and update the PR.

@isaacabraham I'd rather do it in another PR

Contributor

mrinaldi commented Nov 18, 2015

I checked the urn:schemas-microsoft-com:asm.v1 schema and for some reason I thought a <Paket>True</Paket> was not allowed. I never tested it though. <-- that's me being stupid

I just tested it and it does work. I'm gonna change it and update the PR.

@isaacabraham I'd rather do it in another PR

@isaacabraham

This comment has been minimized.

Show comment
Hide comment
@isaacabraham

isaacabraham Nov 18, 2015

Contributor

That's cool. Cheers.

Contributor

isaacabraham commented Nov 18, 2015

That's cool. Cheers.

@mrinaldi

This comment has been minimized.

Show comment
Hide comment
@mrinaldi

mrinaldi Nov 18, 2015

Contributor

I've updated the PR to create <Paket> nodes instead.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="7.0.0.0" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>
Contributor

mrinaldi commented Nov 18, 2015

I've updated the PR to create <Paket> nodes instead.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="3.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <Paket>True</Paket>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="7.0.0.0" />
  </dependentAssembly>
</assemblyBinding></runtime></configuration>

forki added a commit that referenced this pull request Nov 19, 2015

@forki forki merged commit 56c66ad into fsprojects:master Nov 19, 2015

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Nov 19, 2015

Member

Awesome. Thanks

Member

forki commented Nov 19, 2015

Awesome. Thanks

@mrinaldi mrinaldi deleted the mrinaldi:clean_binding_redirects branch Nov 19, 2015

@mavnn

This comment has been minimized.

Show comment
Hide comment
@mavnn

mavnn Nov 20, 2015

Contributor

@mrinaldi thanks for that! Saved me a lot of work :D

Contributor

mavnn commented Nov 20, 2015

@mrinaldi thanks for that! Saved me a lot of work :D

@mrinaldi

This comment has been minimized.

Show comment
Hide comment
@mrinaldi

mrinaldi Nov 20, 2015

Contributor

awesome

Contributor

mrinaldi commented Nov 20, 2015

awesome

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Nov 21, 2015

Member

❤️

Member

forki commented Nov 21, 2015

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment