Importing custom targets does not work with .NET Core & Paket 4.X
See original GitHub issueDescription
We have a NuGet package with a build target inside it which we use to enforce our “build police” (checking for things like namespace prefix and other things). I can see that paket is not adding the targets reference into the csproj file.
paket.dependencies:
source http://nuget.geniussports.net/NugetWebFeed/nuget
nuget GeniusSports.Common.Targets import_targets: true
nuget System.Net.NetworkInformation ~> 4.0
nuget Newtonsoft.Json ~> 9.0
paket.references
GeniusSports.Common.Targets import_targets: true
Newtonsoft.Json
System.Net.NetworkInformation
Repro steps
Please provide the steps required to reproduce the problem
See attached ZIP. I have also attached our target nuget package.
GeniusSports.Common.Targets.1.0.2.nupkg.zip
Expected behavior
This is added to the csproj:
<Import Project="..\packages\MSBuildTasks\build\MSBuildTasks.targets" />
<Import Project="..\packages\GeniusSports.Common.Targets\build\GeniusSports.Common.targets" />
Actual behavior
No build targets are added.
Issue Analytics
- State:
- Created 7 years ago
- Comments:29 (26 by maintainers)
Top Results From Across the Web
Adding .targets file to .NET framework nuget won't import ...
I have a project that I import RawDataConverter.nuget into (GeoApp). The framework type for GeoApp is .NET Core 2.1. I've never had an...
Read more >PackageReference in project files - NuGet
Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, as opposed to ...
Read more >Paket and the .NET SDK / .NET Core CLI tools (dotnet CLI ...
The general workflow is not very different from using Paket with traditional .NET projects which it is described in the "Getting started" tutorial....
Read more >prometheus-net 8.0.1
This library allows you to instrument your code with custom metrics and provides some built-in metric collection integrations for ASP.NET Core.
Read more >Consume NuGet packages | JetBrains Rider Documentation
To find a NuGet package, use the search field and the list of Available packages, which appears under the list of Installed packages....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah sorry I didn’t realise that, I thought they had just move the references into obj. I can now see this in my obj g.targets file:
So that has imported the MS packages fine. Interestingly I still can’t get it to import my custom targets:
paket.dependencies:
paket.references:
Comparing my package to the MSBuildTasks packages it looks like everything is fine:
I have tried:
All without luck. I can see that the dependency has been added to the obj references file:
But nothing has been added to the g.targets file for the Genius Sports targets. Hopefully I’m not doing something silly here.
I have attached our targets package for reference as well.
GeniusSports.Common.Targets.2.0.0.nupkg.zip
and queue the “it was the being silly part” music! 😃 Thanks for your help! I will test this when I’m back in the office on Monday and report back