I'm having issues with NuGet prerelease packages and was wondering what others had done in this situation. NuGet functionality seems completely different, and frankly, strange, from expected behavior in Maven. For a quick example, let's say we have assemblies FooAssembly and BarAssembly, with classes defined as follows:
Foo:
namespace Foo {
class FooClass {
public void TestA(){
}
}
}
Bar:
namespace Bar {
class BarClass {
public static void Main(string[] args){
FooClass foo = new FooClass();
foo.TestA();
}
}
}
When I build Foo, it's versioned such that it generates Foo-1.0.0-SNAPSHOT.nupkg. NuGet installs this into Bar when I add it as a dependency, placing it in both my local cache under %APPDATA% and a packages folder in my source tree. Now, if I add method TestB() to Foo, and rebuild, it also generates Foo-1.0.0-SNAPSHOT.nupkg. My build places this new nupkg file into my %APPDATA% cache as expected. However, when I try to do a rebuild of Bar, NuGet doesn't detect that my nupkg in %APPDATA% has changed, and therefore doesn't have the new TestB method available. I have to manually delete the src/packages folder (or at least the Foo subdirectory in packages) for it to reacquire the package from my cache.
In Maven, if I were to rebuild Foo with the TestB method added, it would place Foo-1.0.0-SNAPSHOT in my .m2 cache, and Bar would link against the new version of the jar and would know about TestB.
My question is, firstly, am I missing something with NuGet? Secondly, if I'm not, what have people done to work around this shortcoming? Add an MSBuild pre-build step to wipe out the project package cache? Append build numbers to the end of SNAPSHOT (e.g. SNAPSHOT42...this seems like it would be problematic with more than one developer on the project)?
Any insight is appreciated. Thanks.