-
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
How to reference different version dependencies for different frameworks #3377
Comments
You will need to use paket groups to do this. |
I am already familiar with groups but I don’t see how it gets around the problem of having one paket.references file for both projects.
… On Oct 1, 2018, at 5:04 AM, Chris Blyth ***@***.***> wrote:
You will need to use paket groups to do this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Why not have 2 paket reference files... |
Yes, split out your framework-dependent deps into two groups in your
We do this exact practice in several places and it works well. Nuget packaging and everything works as expected, with conditional group references. Then, in the single, unified
|
Two files with the same name in the same folder?
… On Oct 1, 2018, at 12:27 PM, Chris Blyth ***@***.***> wrote:
Why not have 2 paket reference files...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Ah, I didn’t see any documentation on having framework: inside my group, that sounds promising. I will give it a try tonight.
Thanks for the suggestion 😀
… On Oct 1, 2018, at 12:27 PM, Chet Husk ***@***.***> wrote:
Yes, split out your framework-dependent deps into two groups in your paket.dependencies file. Each group should have the appropriate framework constraint in it.
source ...
nuget ...
nuget ...
group Net40Deps
source normal_nuget
framework: net40
nuget Microsoft.Owin 2.1.0
group Net45Deps
source normal_nuget
framework: net45
nuget Microsoft.Owin 3.0.1
Then, in the single, unified paket.references, you can conditionally include some deps or the other based on framework like so:
# deps from main group
Blah
Foo
Bar
#deps for net40
group Net40Deps
Microsoft.Owin framework: net40
# deps for net45
group Net45Deps
Microsoft.Owin framework: net45
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I can not find any documentation on conditional groups, but some of the error messages referred to them, so they are supported in some way. I tried making files exactly as you suggested, and many other variations of placement for the various parts of the syntax, but I could not find any combination that worked. With this
and this
The output from
|
For the sake of completeness the paket.lock file contains:
|
Well... an hour later and I did get it working. The |
My team and I hit this issue while trying to share common libraries across projects within the solution who may target framework, netstandard, or netcore. Paket will not properly restore packages, yielding a significant amount of MSB3245, MSB warnings (> 300) when building, meaning it flat-out couldn't find the package and won't do anything about it. To compound the issue, Paket seemingly doesn't respect when a framework was upgraded when in this confused state. Despite performing an 'add' on every single dependency in every single project effectively re-installing every possible dependency, paket leaves the package hint paths pointing to an older framework version than what the projects were updated to. @Bikeman868 : did you have much success getting around this or did you abandon it / stick with an alternate pattern? This is also similar to what we were experiencing: dotnet/standard#481 |
What do you mean it does not restore packages properly? |
@forki Transitives, in particular, will not be copied to the output directory. They may “restore” in the sense that they make it to the package cache, but they will not be copied to the output folder which causes runtime errors. Some of these transitives, when converted/specified as a direct dependency in the paket.references file, will still not be copied to the output directory. That one in particular is especially frustrating. I am using the latest non-preview Visual Studio 2019 at the time of writing, but I’m trying to get a CI build working. I’m therefore using MSBuild from the command line for the majority of builds. There are also dotnet build commands included, but those all work without issue—its only the .NET framework projects that are encountering this issue. |
do you have a small repro? |
@forki This repository is somewhat large and is the result of attempting to merge together a few different repositories into a single solution. I'm not logging a bug against paket, I'm mostly looking to see if the issue was worked around in the past or if there is perhaps some way to accomplish what the original author was trying to do. I don't want to place the burden on anyone other than myself at this point basically. |
When I opened this ticket I included a link to an open source project that demonstrates this problem.
Whilst waiting for a bug fix I am manually maintaining project references but it’s a real pain.
I recently started using Visual Studio 2019 and it’s Nuget Package Manager is considerably better than in earlier versions so I am considering abandoning Paket.
… On Aug 12, 2019, at 8:30 AM, Jim Hume ***@***.***> wrote:
@forki This repository is somewhat large and is the result of attempting to merge together a few different repositories into a single solution.
I may be able to come up with a small repro, but it may be difficult to do so. I'm mostly looking for information about workarounds and whatnot, as this may be the result of any number of issues that were encountered while attempting to merge said repositories.
I'm not logging a bug against paket, I'm mostly looking to see if the issue was worked around in the past or if there is perhaps some what to accomplish what the original author was trying to do. I don't want to place the burden on anyone other than myself at this point basically.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I am using the
Microsoft.Owin
NuGet package in my solution.My solution needs to be compiled for .Net 4.0 and .Net 4.5. I am doing this by having two
.csproj
files in the same folder. Both of the.csproj
files reference all of the same source files but target different .Net framework versions and specify different output folders.This works great with NuGet, but I can not see how to make this work with Paket because projects compiled for .Net 4.0 must reference
Microsoft.Owin
version 2.1.0 and projects compiled for .Net 4.5 must referenceMicrosoft.Owin
version 3.0.1 and I can only have onepaket.references
file in my project folder.You can see my source code here
Is this possible with Paket?
The text was updated successfully, but these errors were encountered: