Detours icon indicating copy to clipboard operation
Detours copied to clipboard

Detours via Nuget package ?

Open DrusTheAxe opened this issue 4 years ago • 18 comments

I need to use Detours in a project so the simplest answer is "use Detours' nuget package" - except that doesn't exist :-(

I tried adding Detours source into my project but for complicated reasons its fails and requires invasive changes to my project settings and/or structure

I could clone Detours source + makefiles and make a project whose sole purpose is to run make to build Detours' static lib for my project to consume but that's irksome (to live with as well as to setup - local builds, build pipelines, etc)

Is there a reason Detours offers no Nuget package?

DrusTheAxe avatar Aug 20 '20 23:08 DrusTheAxe

You can use the vcpkg package. NuGet is generally a poor package manager for native dependencies.

sylveon avatar Aug 20 '20 23:08 sylveon

Yea, the vcpkg that @sylveon contributed is a good option. See: https://github.com/microsoft/vcpkg/tree/master/ports/detours

bgianfo avatar Aug 20 '20 23:08 bgianfo

@sylveon Be that as it may Nuget has a certain currency in my process. An official nuget from the Detours team would be ideal

@bgianfo I'm not familiar with vcpkg. How do I use that? Do I have to build something or can I point VS2019 at something to import it?

DrusTheAxe avatar Aug 21 '20 01:08 DrusTheAxe

If you follow the instructions in the vcpkg readme for setting it up and then run vcpkg install detours:x64-windows (replace x64 by the preferred architecture), it should be automatically picked up by Visual Studio under <detours/detours.h>

sylveon avatar Aug 21 '20 07:08 sylveon

I built and installed the 4 flavors of Detours vcpkgs

mklink /j c:\vcpkg c:\users\howard\source\repos\vcpkg
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
c:\vcpkg install detours:x86-windows
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64
c:\vcpkg install detours:x64-windows
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=x64 -arch=arm
c:\vcpkg install detours:arm-windows
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=x64 -arch=arm64
c:\vcpkg install detours:arm64-windows

and then added vcpkg to VS2019

c:\vcpkg integrate project

then as directed I opened my solution in VS2019 and at the nuget console ran

Install-Package vcpkg.C.vcpkg -Source "C:\vcpkg\scripts\buildsystems"

but it only updated 1 of my solution's 4 projects

Speak to me like I've never used of vcpkg before...

Also, once I git commit will this require every dev working on the project to do something locally (install vcpkg?) or will the project be self-contained and ready for use by anyone who opens the solution?

DrusTheAxe avatar Aug 21 '20 16:08 DrusTheAxe

but it only updated 1 of my solution's 4 projects

That's normal, the NuGet console is per-project: image

Also, once I git commit will this require every dev working on the project to do something locally (install vcpkg?) or will the project be self-contained and ready for use by anyone who opens the solution?

Yes, it requires them to install vcpkg locally. The NuGet package provided by vcpkg is a redirect that will make projects able to use all of the locally installed vcpkg libraries. It's effectively the same than vcpkg integrate install but at a per-project scope.

Also, pro tip: you don't need to run vcpkg in a VS developer command prompt at all, it'll automatically pick up the right (cross-)compiler by itself.

sylveon avatar Aug 21 '20 21:08 sylveon

@sylveon That's normal, the NuGet console is per-project That makes sense. Thanks

@sylveon Yes, it requires them to install vcpkg locally. Ugh. Not so appealing.

I renew my ask for a Nuget package

Lacking that I'll have to slurp up the code into my own project. I already tried that but the flood of errors was irksome. The Detours source wasn't happy with precompiled header settings and I didn't even get close to unwinding whatever was horribly wrong with headers, missing symbols and redefinitions :-(

DrusTheAxe avatar Aug 21 '20 21:08 DrusTheAxe

Ping

Still using a forked copy of Detours source and still interested in prebuilt Nuget packages

DrusTheAxe avatar Jan 25 '21 01:01 DrusTheAxe

I think I am using a nuget package and it works well enough. 4.0.1

acepace avatar Apr 24 '21 09:04 acepace

Ping

Any news?

DrusTheAxe avatar Feb 28 '22 21:02 DrusTheAxe

Ping. Any update?

DrusTheAxe avatar Jun 16 '22 04:06 DrusTheAxe

No updates as of yet, sorry.

@DrusTheAxe Do you or the WindowsAppSDK team have cycles to help contribute the Nuget creation automation? That would certainly help move the needle here.

bgianfo avatar Jun 23 '22 21:06 bgianfo

No updates as of yet, sorry.

@DrusTheAxe Do you or the WindowsAppSDK team have cycles to help contribute the Nuget creation automation? That would certainly help move the needle here.

I don't anytime soon. Will ask around but folks are generally pretty booked with higher pri work

DrusTheAxe avatar Jul 22 '22 00:07 DrusTheAxe

FYI, there is this nuget package: https://www.nuget.org/packages/Detours

which to the nuget package manager looks like it's created by Microsoft: image

but turns out it isn't: image

kinda scary that it's this easy to spoof being microsoft

stevenbrix avatar Mar 05 '24 15:03 stevenbrix