Tuesday, January 31, 2012

How to keep Nuget from getting the latest version of an assembly/dependent assembly (for example, Log4net 1.2.10 and not 1.2.11)

Krzysztof Kozmic - How to force Nuget not to update log4net to 1.2.11

"That’s a quick one. There’s been a new release of log4net recently that’s signed with a new key, and therefore is incompatible with old version 1.2.10.

Therefore, due to near-ubiquity of the library in .NET space, it may cause some problems if you happen to have a dependency (direct or indirect) on it.

The matters are made worse by Nuget’s default of getting the latest available version of the package. I dealt with this problem the other day, and I saw a few people in my twitter stream struggling with the same issue.

The solution is quite simple. It’s not specific to log4net and I’m not picking on log4net here. Here’s how you can restrict Nuget’s package to specific version in your solution.



Thought this a good tip and reminder how how to deal issues like this, where getting the latest version of an assembly isn't what you really want Nuget to do...

No comments: