UniqueConstraint bundle issue in 2.5 when targeting Framework 4.5

152 views
Skip to first unread message

Barry Hagan

unread,
Jun 15, 2013, 10:20:28 PM6/15/13
to rav...@googlegroups.com
I'm starting to look at 2.5 and there appears to be an issue with the NuGet package of Raven.Client.UniqueConstraints (build 2603)

There are different net40 vs net45 assemblies for Raven.Client.Lightweight and Raven.Abstractions, but only net40 for the UniqueConstraints bundle.  If I create a project that targets 4.5 and add the UniqueConstraints client, it adds the net45 versions of the dependent assemblies, but since the unique constraint only has a net40 version it complains when using it in code:  

Instance argument: cannot convert from 'Raven.Client.IDocumentSession' [Raven.Client.Lightweight-4.5] to 'Raven.Client.IDocumentSession' [Raven.Client.Lightweight]

and

The type 'Raven.Client.IDocumentSession' is defined in an assembly that is not referenced. You must add a reference to assembly 'Raven.Client.Lightweight, Version=2.5.0.0, Culture=neutral, PublicKeyToken=37f41c7f99471593'.


Fitzchak Yitzchaki

unread,
Jun 16, 2013, 2:38:15 AM6/16/13
to <ravendb@googlegroups.com>
Thanks for reporting this, it will be fixed in the next build.




--
You received this message because you are subscribed to the Google Groups "ravendb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Barry Hagan

unread,
Jun 16, 2013, 2:16:31 PM6/16/13
to rav...@googlegroups.com
Raven.Client.UniqueConstraints looks good with 2604, but  the same issue affects Raven.Bundles.UniqueConstraints which I use as a plugin for my embedded unit tests.

Barry Hagan

unread,
Jun 16, 2013, 8:33:51 PM6/16/13
to rav...@googlegroups.com
Actually, this is now unraveling into a slightly larger problem for me:

I have a couple custom Analyzers and Plugins that were targeting net45 in Raven 2.0 and need to reference Raven.Database.  It seems like right now I would be forced to drop those to net40 if I want to use them with any server setup running the pre-compiled RavenDB download package.  Of course I'm also using these in my unit tests which have other 4.5 dependencies and I'm back to needing a mix of net40 and net45 raven assemblies in one project.

Any thoughts besides abandoning NuGet and specifically referencing the net40 versions of Raven everywhere including my 4.5 targeted projects?

Also, why are these split apart to begin with?  Do we gain/lose anything between the different targeted versions in NuGet packages?

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2013, 12:33:47 AM6/17/13
to ravendb
They are split because of async stuff, basically.
One of the things that is going to happen in 3.0 is that we drop 4.0 support, so we won't have this issue.

Barry Hagan

unread,
Jun 17, 2013, 9:36:15 AM6/17/13
to rav...@googlegroups.com
So for now is my only approach to make separate versions of my plugins and analyzers for 2.5?  (one targeting 4.0 that can be used in production with Raven.Web, and one targeting 4.5 for use in my unit testing)

It seems my only other option would be having you provide a download package that includes release builds of the 4.5 versions.

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2013, 10:02:33 AM6/17/13
to ravendb
You can do that using bidning redirect, no?

Barry Hagan

unread,
Jun 17, 2013, 1:07:58 PM6/17/13
to rav...@googlegroups.com
I certainly could be wrong here, but I've only done binding redirects for different versions of the same assembly.  Raven.Database.dll and Raven.Database-4.5.dll have the same versions so how can I redirect?

The summary of my issue:

- I must target net40 for my plugin or it will not work when copied to the Plugins directory of a release build server since it has a Raven.Database dependency.
- The rest of my codebase uses 4.5 features
- Unit testing my codebase against an embedded store that registers my plugin is not possible.  I have mixed dependencies.

The simplest answer I see is to build analogous net40/net45 versions of my plugin just like Raven knowing that the net40 version is only there to copy to a production server, and the net45 version can be referenced and used by my unit tests.

Oren Eini (Ayende Rahien)

unread,
Jun 17, 2013, 3:38:41 PM6/17/13
to ravendb
I'll check that, I am not sure how good that would work.

Oren Eini (Ayende Rahien)

unread,
Jun 18, 2013, 4:08:17 AM6/18/13
to ravendb
Please check the next build.

Fitzchak Yitzchaki

unread,
Jun 18, 2013, 4:14:06 AM6/18/13
to <ravendb@googlegroups.com>
Did you pushed?
I already run the build locally and validated that the .NET 4.5 dlls were copy to the right locations

Barry Hagan

unread,
Jun 19, 2013, 10:32:25 AM6/19/13
to rav...@googlegroups.com
2608 and later fixes the NuGet bundles so I can now run my unit test project targeting 4.5 with an embedded store and include UniqueConstraints.

Now I have to deal with the same issue for my own custom bundle.  I'll need to build two versions so I can:

1) reference it in my unit test project targeting 4.5 (referencing Raven.Database-4.5.dll)
2) copy it to a production IIS server that was setup using the download package "Web" folder (referencing Raven.Database.dll)

For now I created a new project targeted to 4.0 and linked my source files so I can easily build both versions of the bundle.  Or were you thinking there was a better way to deal with that?

Fitzchak Yitzchaki

unread,
Jun 20, 2013, 2:53:39 AM6/20/13
to <ravendb@googlegroups.com>
This is a good solution, I don't see a better one.
Reply all
Reply to author
Forward
0 new messages