Automatically Configuring Nuget Package in Developer Studio

Topics: Ecosystem
Apr 23, 2014 at 3:38 PM

I wrote an autopkg file and was able to make a nupkg from the command line with Powershell Write-NuGetPackage.ps1.

I was then able to publish it, and using Developer Studio I can search for it online and then it installs. It puts the libraries in a subdirectory with the file name and version in it.

Is there a way to automatically update the Additional Include Directories and Linker Input to add these, or does the user have to manually do it?

It seems like it could be automated.

Thank in advance.
Apr 23, 2014 at 5:02 PM
If you build it correctly, it is automated.

can you post your .autopkg script?
Apr 23, 2014 at 10:37 PM
Edited May 8, 2014 at 7:22 PM
Yes, here it is.

I appreciate your feedback fearthecowboy.

nuget {
nuspec {
    id = opencv_winrt_lib;
    version :;
    title: OpenCV for Windows Real Time;
    authors: {X Corporation};
    owners: {naturalnews461};
    licenseUrl: "";
    projectUrl: "";
    // TODO - set iconUrl
    iconUrl: "";
    summary: Installer for WINRT version of the OpenCV lib's;

    // if you need to span several lines you can prefix a string with an @ symbol (exactly like c# does).
    description: @"OpenCV for WinRT";
    releaseNotes: "Release of OpenCV for WinRT.";
    copyright: Copyright 2014;
    tags: { OpenCV, winRT, DirectX };

// the files that go into the content folders
    files {

    #defines { // NOTE - this uses a relative path and therefore must be run from the opencv (or your root) directory 
                // Example : PS C:\Users\YourName\Documents\github\opencv>Write-NuGetPackage opencv_winrt.autopkg
        OCVPATH      =  .\binWinRT\;  
        OCVCALIB3D   =  opencv_calib3d\opencv_calib3d.lib;
        OCVCORE      =  opencv_core\opencv_core.lib;
        OCVFEATURE2D =  opencv_features2d\opencv_features2d.lib;
        OCVFLANN     =  opencv_flann\opencv_flann.lib;
        OCVIMGPROC   =  opencv_imgproc\opencv_imgproc.lib;
        OCVML        =  opencv_ml\opencv_ml.lib;
        OCVOBJDETECT =  opencv_objdetect\opencv_objdetect.lib;
        OCVPHOTO     =  opencv_photo\opencv_photo.lib;
        OCVSTITCHING =  opencv_stitching\opencv_stitching.lib;
        OCVVIDEO     =  opencv_video\opencv_video.lib;
        OCVVIDEOSTAB =  opencv_videostab\opencv_videostab.lib;  

    // grab all the files in the include folder
    // the folder that contains all the .h files will 
    // automatically get added to the Includes path.
    // TODO - include 3rd party headers?
    include: { ".\IncludeFileDirFilledByBatchFile\**";              



targets {
    // For consistency with example
    Defines += HAS_OCVWINRTLIB;
Apr 28, 2014 at 7:24 PM
Sorry, I was out sick for a few days, now I'm trying to catch up.

lemme look a this and get back to you

May 2, 2014 at 11:29 PM
Glad you are back. I think I did it right but there is a bug with Nuget where you have to close the project and then re-open it. And also to remember to set the Configuration to the one the Nuget package handles.
May 8, 2014 at 7:25 PM
Note that I learned that it's easiest to have a BAT file that takes all the required Include files/directories and puts them into one folder. Then you grab the whole folder as-is with "**". (I edited my previous post to show this).

However, it still requires me to go in and manually add the folder where the NuGet package gets unzipped to my Additional Include Directories under Properties:


(the stuff from my BAT is then put in and below that include path).

I noticed that the C++ REST SDK uses a script file (PS1) that does something with the paths - is that what I need?

May 18, 2014 at 12:35 AM
Edited May 18, 2014 at 12:35 AM
To answer my own question, we needed to

".\IncludeFileDirFilledByBatchFile\ ** \ * "


".\IncludeFileDirFilledByBatchFile\ ** "

(Needed to put spaces as this forum hijacked my wildcards).