I have created some custom targets for my csproj file and I'm loading it into my csproj file with an import tag. Could you also import from a nuget package? This would make version management and distribution much easier.
Yes you can use the "build" folder in a NuGet package to auto import props/targets: https://docs.microsoft.com/en-us/nuget/reference/nuspec.
Also have a look at Directory.Build.props/targets which can simplify applying settings/targets across an entire tree: https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build.
@davkean I have managed to create my nuget package now.
But the prop files don't seem to load.
According to the documentation: https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#including-msbuild-props-and-targets-in-a-package
Pre Nuget 3.x the package creates imports automatically. But from 3.x onwards the targets are available through the project.lock.json file. But this file doesn't exist anymore?
@sanderobdeijn Please ask over http://github.com/nuget/home, we don't control or own the interaction here.
For other people who have this problem I found the solution in this blog post https://natemcmaster.com/blog/2017/11/11/build-tools-in-nuget/
You have to create a dummy file like -.-
And include it in the nuspec file and target the lib folder.
Otherwise the files in the build folder won't get picked up.