microsoft / krabsetw

KrabsETW provides a modern C++ wrapper and a .NET wrapper around the low-level ETW trace consumption functions.
Other
588 stars 147 forks source link

Native Nuget - Visual Studio / MsBuild integration is broken #184

Closed mediantt closed 2 years ago

mediantt commented 2 years ago

Adding the Nuget to a project implies it can be easily referenced in the code, such as: #include <krabs.hpp>

This works well for other Nugets, such as AWSSDKCPP-Core, but it doesn't work here, and one is forced to explicitly specify path to the package folder (in either #include or the project file) - which is quite cumbersome and requires constant maintenance (as it includes the actual revision number): #include "../packages/Microsoft.O365.Security.Krabsetw.2.0.2/lib/native/include/krabs.hpp"

MsBuild integration is taken care of with krabsetw.targets file, that is meant to be automatically added to the project file - which is what's broken here, I suppose, due to the following: Within the \build folder, you can provide a “.props” file and/or a “.targets” file that will be automatically imported into the project. For this convention, the file name must match your package id with either a “.props” or “.targets” extension. For example, the ‘cpprestsdk‘ package includes a ‘cpprestsdk.targets’ file in its \build folder.

image

I suppose for this integration to work, krabsetw.targets file must match the package name, i.e. be renamed to Microsoft.O365.Security.Krabsetw.targets

swannman commented 2 years ago

Nice find @mediantt! I've created #186 which should resolve this in nuget version 4.2.2.