-
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
Group conditions for dotnet sdk projects #2394
Comments
This comment has been minimized.
This comment has been minimized.
Well I guess I want to end up with this as my dependency tree on nuget when I go to pack it
If someone is consuming my lib on net45, i don't want to force them to update their |
@baronfel Doing something like this is messy one way or another.
|
from #2612 (comment) by @yevhen In a mixed solution where some of the projects use new VS17 csproj format and target multiple frameworks (net462/nestandard) conditional references are required for some scenarios, such as referencing Example: <ItemGroup>
<PackageReference Include="System.AppDomain" Version="2.0.11"
Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'" />
</ItemGroup> |
As .net 5 is the way forward, I'm gonna close this. |
@TheAngryByrd Does it mean that it is not going to be possible until .NET 5 is released? How would .NET 5 help with this? |
Everything is going to be .NET 5. There won't really be a .NET core or .NET framework. |
.NET framework will be supported by Microsoft so long Windows variants (with .NET included) are supported. So this problem will still be unsolvable with paket if you need to support both .NET 4 and .NET 5 in your code. |
I'm not concerned with supporting super old versions of frameworks. This post covers some similar thoughts I have about supporting older frameworks. |
I hope this doesn't reflect the general consensus here. .NET 5 doesn't replace anything, it's just one more on top. .NET Framework and .NET Core are not going away ... |
I'm sure you don't, but paket as a project did not declare that it's abandoning all versions except .NET 5, so this issue in paket still stands and therefore it should not be closed? |
we will continue to support old frameworks as good as we as a community can. |
@forki So shouldn't this issue be reopened then? |
I ran into this issue since some libraries only target It took me a while to figure this out as it doesn't seem to be documented, but I was eventually able to get conditions working so that it would reference the proper package based on the targeted framework.
group Net5
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json
condition: net5_0
framework: net5
...
nuget Microsoft.AspNetCore.Authentication.JwtBearer ~> 5
group NetCoreApp3
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json
condition: netcoreapp3_1
framework: netcoreapp3.1
...
nuget Microsoft.AspNetCore.Authentication.JwtBearer ~> 3
group NetCoreApp3
...
Microsoft.AspNetCore.Authentication.JwtBearer
group Net5
...
Microsoft.AspNetCore.Authentication.JwtBearer I haven't really dug too deep into the source code, but I suspect that |
Shouldn't this be
Looks like preprocessor symbols? But I couldn't even find documentation on |
Yes, that was a typo on my part! I fixed it.
Yes, it doesn't seem to be documented at all. I figured this out by spending a bunch of time digging through the paket code and ancient issues 😅. |
Thank you @Shmew for the solution! I've found that order of targets in the project file matters, meaning [1] fails to resolve proper package, but [2] works as expected |
Also conditions on dependencies do not work right? Is someone working on this? |
Description
I'm trying to move this type of code to from nuget to paket
However when I move to setup below I get this error and similar (truncated since it's very long)
Repro steps
paket.dependencies
paket.references
fsproj
Then run
dotnet restore
onsrc\MyLib
https://github.com/TheAngryByrd/paketConditonNetcore
Expected behavior
Ability to restore and build net45 and netstandard1.6 with different versions of FSharp.Core
Actual behavior
Known workarounds
Use nuget 😭
Version info
The text was updated successfully, but these errors were encountered: