-
Notifications
You must be signed in to change notification settings - Fork 252
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
Can package references suppress grouping by target framework when packing? #7154
Comments
I don't think you can achieve it through project file, but I'll let Rohit answer it when he's back. But I'd recommend to have the target framework specific groups without making it generic. |
@jainaashish Unless I'm misunderstanding you, you seem to be suggesting I do the exact thing I'm trying to avoid, and opened this issue about! For the package in question, none of the dependencies have any framework requirements, so the fact that the package gets built with the dependency groups is an artificial limitation. The dependency groups are actively causing me problems, because if someone adds a reference to my package but they are targeting a TFM that I haven't included, then they don't get the transitive references, and that leads to silent build failures. In this specific case, it means that the project doesn't generate the correct version, and the binaries are missing SourceLink information. It's not immediately obvious what the problem is either. |
@bording unfortunately there is no way to do this, and while I agree that this maybe a problem for some of the packages, i am not sure the right solution here is to avoid grouping dependencies into framework. what if you targeted the lowest possible framework so it becomes compatible with most of them? |
In general, grouping dependencies is definitely the right thing to do, it's just this sort of build tools/dev dependency style of package where it would be nice to turn the grouping off.
That might at least address the difficulty of needing to keep the TFMs I'm targeting updated. |
I will let this issue remain open, but i can't promise by when this would get resolved. (I would gladly accept a PR for this though). The solution I would come up with would probably involve introducing a property like "GroupDependenciesByFrameworkInPackage" , which defaults to true but can be set to false, and that would cause dotnet pack to output all dependencies in the package independent of TFM. |
Sounds good. I might try and work on a PR for this. |
@rohit21agrawal I'm not sure if that's the right thing to do, when we want packages to be This may seems like a reasonable ask for @bording scenario since he just have a development dependency which only includes some msbuild assets but having I'd rather discuss it before committing that we're fine with such a feature and willing to take a PR for that. cc @rrelyea |
@jainaashish the point here is that we don't decide on behalf of authors what is the right way to author a package, at least not force it on them - which is why we have the all powerful nuspec in the first place. What we do for |
When packing via csproj, is there a way to have the project's package references not be grouped by the target frameworks of the project?
I have a package that is a development dependency, and it only has props and targets files in it. It also references a couple other packages that I want any consuming project to include transitively. You can see the csproj here: https://github.com/Particular/Particular.Packaging/blob/master/src/Particular.Packaging/Particular.Packaging.csproj
None of the these packages have any sort of framework dependencies, but because package references are turned into framework-specific dependencies in the nuspec, I currently have to multi-target my csproj to cover all the TFMs we use in consuming projects.
This results in the following section in the nuspec:
While this works okay for us in most cases, recently it's been causing some problems where the package has been referenced in projects that have a
TargetFramework
other thannet452
ornetstandard2.0
. I don't want to have to keep updating this package as another TFM edge case is discovered.What I'd really like to see instead is:
@rohit21agrawal Is there any way to make this happen without having to fall back to a manually-created nuspec file?
The text was updated successfully, but these errors were encountered: