-
Notifications
You must be signed in to change notification settings - Fork 525
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
Paket changes my config files #1248
Comments
//cc @isaacabraham @mrinaldi |
Urgh. Don't know why that's there. I think this should be done as part of the cleanup of the formatting of the BRs anyway (you can see from the |
How about Paket leave XML formatting alone? We have never ending problem with Paket always changing our config files (incl. those it should not be touching at all). It keeps removing spaces in lines like 'value="false" />' So it removes the space between doublequote and slash and does it for ALL configs. We would leave it like that, but some other automated tool has different idea what the right spacing is and it keep adding that space back! This creates enormous churn and makes reviewing config file changes very hard. Please, please let Paket NOT CHANGE existing XML formatting. Especially considering we have "redirects: off" at the top of paket.dependencies. |
Yes it's definitely the plan to keep formatting as stable as possible. Will
|
@forki, thank you for speedy response! It is always great to work with you! |
@konste can you give me the app.config in question (which contains value = false) for a unit test? |
wow. even if we disable formatting it seems .NET always writes |
I may look into it. Which exactly .NET Xml facility is employed here? XmlDocument? XDocument? But why rewrite configs which are not touched a bit at all? |
that are two separate issues. one is we should not touched configs that we don't change logically. second is that we don't stuff outside of redirects |
I understand that the second part is harder than it seems. Writing XML file is usually one call to a Save method (unless combination of reader and writer is used, which seems like overkill here), so we just need a way to preserve original formatting. So what .NET class is used to handle XML in Paket? |
As far as I can tell from src\Paket.Core\BindingRedirects.fs XDocument is used. Then formatting preservation is as easy as calling Save like that: x.Save(writeFileName, SaveOptions.DisableFormatting); |
^^ it's not I'm already doing this in my local version |
@konste with latest changes we should not touch files when we don't do logical changes. can you please test it? |
Is binary available? I don't have F# build environment at the moment. |
Yes it's in latest release.
|
Version 2.32.5 keeps updating all config files when I do "paket update" which otherwise does nothing. |
what's the diff? |
Same - space before slash. |
nothing else? only the spaces? |
<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" /></runtime>
|
ah ok. I assume 3 is the reason. since I didn't find a way to tel the .NET API to keep formatting of that char I tried to come up with "logical changes comparison". If no logical changes => we don't touch the file at all. But 3 indicates a logical change => we touch it. please just commit that removement of .0 and the try again. BTW: sorry. but this stuff is really tricky (and annoying) |
-- If no logical changes => we don't touch the file at all. Can we make it: no changes in BindingRedirect => we don't touch the file at all? Because in our case we have "redirects: off" and I would expect it to cut short all attempts to even read config files. |
yeah that's the next step.
why is that even in there if you have redirects: off? |
".0" in versions is stripped in paket.lock. Nothing to do with configs. |
ok I'm confused now. let's start over:
|
Both Right. |
is there a chance for me to reproduce? Can you mail me and tell me what you did? I won't make it public. |
I think the problem is that last line it adds - it is basically empty BindingRedirects section. So the logic seems to be - if we are not going to add BindingRedirects to config, but it does not even have corresponding section - empty section is added. And "while we are here" extra spaces are added too. |
ook just to confirm. can you commit that line and try again? does it stay stable and doesn't remove the space before the slashes? |
Ok, here we go: when I replace this: </configuration> with this (literally!): <runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" /></runtime></configuration> then Paket leaves that config alone and does not add extra spaces or change it in any other way. But if I add this section formatted differently than all in one line, then it is ignored and config is reformatted. Weird. |
GOOD! that's what I wanted to hear - means we're on the right track. I will remove this tomorrow ;-) |
And sorry for all the trouble... |
No prob, thank you for the help! I wish I could contribute more than testing. |
@konste please retry agan. we now remove |
2.32.7 is better and removing empty binding redirects section definitely works, but it is still not good enough. When config file does contain binding redirects section, then Paket still adds extra space! We have 17 files like that in solution. Still too much unnecessary churn. |
don't really know how to fix that. yet |
do you have bindind redirects completely disabled in paket? even for these 17 files? |
If that is what "redirects: off" at the top of paket.dependencies does - then yes. |
@mrinaldi can we skip the redirects processing completely in this case? |
Yep, will do when I have the time. |
For now I decided that space before slash is "standard enough" and I'm going to make all our configs look like that. Now Paket does not seem to change them anymore. One little concern though is that Paket still changes XML formatting as shown in the picture: Let's keep the issue open waiting for @mrinaldi to bypass config sniffing completely when possible. |
Latest version should not do this anymore |
Yep, this is a problem for us too, add and update both are wiping out the binding redirects in our app.config files. (As of 24 hours ago using the latest from nuget. I see @forki 13 hours ago says the latest fixes this. If it changed within those 11 hours I have not tested.) |
my comment was 13 days ago. |
No, not using redirect or force. Here is the most common binding redirects Paket is overwriting. I can't remember why we need the FSharp.Core redirect, but we do need it. I think Paket wrote the
|
Use "nuget fsharp.core redirects:force" in your dependencies file. We
|
Do you know why?
XML should not contain BOMs imo, as no other language really support them.
The text was updated successfully, but these errors were encountered: