Created
September 21, 2015 18:30
-
-
Save FransBouma/efc7b8b5e3e2b4577ee1 to your computer and use it in GitHub Desktop.
Nuget and restore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What I'm doing: | |
- I work on LLBLGen Pro, an entity modeling system | |
- I generate for an entity model two codebases: one with the entity classes (A) and one with code-first entity framework code (B). | |
- I generate csproj files with references to the files in the projects, one for A and one for B. A and B are in separate folders, the | |
csproj files are in the folders of the projects, just like when you'd create them manually. | |
- What I want now is that B, on build, pulls the entity framework v6 assembly from nuget. | |
What I have tried: | |
- I generate the packages.config file with proper xml which defines a reference to the EntityFramework package, v6.1.3, for net45. | |
- This packages.config file is added to the csproj file of B. | |
- I add references (<reference /> elements) to B for EntityFramework dll and the Entity Framework SQL server dll, the full assembly name | |
like it should, but no Hintpath element. | |
First this failed, due to a bug in my code which generated 'package.config', instead of 'packages.config'. After this was fixed, it worked | |
and nuget was happily restoring the dlls on disk in the packages folder of the solution, but the references in the csproj of B weren't | |
loaded by VS.NET: the hintpath is empty so it's not aware of any location of the dlls. | |
So I miss a piece of the puzzle: the hintpath in the csproj of B has to be updated by nuget at package restore (it knows what to update | |
as it knows the packages.config file, and can see which assemblies are references in the csproj referring to the packages.config file), so | |
when the files are restored by nuget, a build succeeds. It now still fails. | |
I can only make this work if I add a valid Hintpath to the csproj file, but that's impossible as I don't produce a sln file, just csproj | |
files and I don't know where the sln file is when the csproj files are added to it. | |
Is there a way to do this? | |
TIA! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We decided that if we can't guarantee it's ok for 100% we can better leave it to the user (as it's not a lot of work for the user to add a package reference to EF in vs.net) as the work needed from the user to get the input to produce valid hintpaths is as much work as typing install-package entityframework in the package console.
Thanks for your time and help on this. With project.json I figure this is all solved anyway, but till that's the way to go, the user has to live with this inconvenience. But alas, there are bigger problems in life than this ;) Cheers