-
Notifications
You must be signed in to change notification settings - Fork 258
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
Extra files (i.e. build targets) and ProjectReference #6624
Comments
This doesn't look like it's supported. It'd be very hard for restore to know if a build target is going to be part of a potential package. Don't really have any ideas/pointers here. |
Even when packing from csproj, those targets are non-indentified and are manually added with something like Maybe the build targets should have a way to be explicitely defined in @nkolev92 @rohit21agrawal @zhili1208 If you agree with such a design, I wouldn't mind helping implement it. |
How well would this work for existing applications packing targets? When these kind of files are suddenly imported into other projects' generated obj*.nuget.g.targets, it may cause issues. |
@dasMulli good point. Maybe one approach would be to choose if you target applies for ProjectReference, PackageReference or both. If you choose both, you would have to write it so that it can support both layouts. |
A different approach could be to introduce a special type of item that forwards target files over P2P references. To "send" things to a referencing project, you'd typically extend a project's output groups (built product, documentation, copy local files output group etc.). For imports, this doesn't work since you can't add imports to MSBuild after static evaluation. Everything related to P2P references happens at run time where you can't add project XML. And even then it could create chicken-or-egg problems - If you need a For trivial targets, it seems easier to just modify the projects accordingly rather than finding an abstract solution that may work in some cases and be unusable in others. |
I have a .nupkg that has a
build\LibraryA.targets
file. This works fine when used as a nuget package.I did it by adding this to the
LibraryA.csproj
:This works fine when used as a NuGet package.
However, I also use this project as a
ProjectReference
fromLibraryB
. I assumed theProjectReference
/PackageReference
duality would make it work, but it doesn't seem to pick up the target file.project.assets.json
contains only compile/runtime dependency, no build section:What is the recommended way to achieve that?
The text was updated successfully, but these errors were encountered: