How to add files to a package but exclude from the target project.

Jan 18, 2012 at 1:34 AM

We've been happily using nuget to retrieve 3rd party dependencies, and have just started to use Nuget to manage our own internal dependencies.  

We've come across an issue where we want to install files into a projects content, but not add those files to the project.  The issue is that when Content files are added at a path that is currently ignored by VS, it will attempt to add that ignored path to the project.  This can take a significant amount of time.

Is there a way to indicate that files should be installed,  but only added to a project if the parent path is currently included?

More details:

Our package file has the following structure:

/Content/directory/provided/by/3rd/party/mynewfile.txt

In our consuming VS project, we have this structure:

/our-content <- included in VS project
    /directory/ <- excluded by VS project
        /*lots-of-files*
        /provided/             
            /by/
 		/3rd/
                     /party

As you might predict, when we add our nuget package, we end up with this:

    /directory/ <- *included* by VS project
         /*lots-of-files*
         /provided/  
            /by/
               /3rd/
                   /party/
                       mynewfile.txt

This addition recursively adds, to the project, all the files in the 3rd party directory.  Takes upwards of an hour.

We'd love to be able to say to nuget, "Add these files to the filesystem, but don't add references to the project".  

Any ideas?

Developer
Jan 18, 2012 at 4:10 AM

There's no support for this scenario currently. What you can do is to put mynewfile.txt outside of 'content' folder (e.g under the package root) and then write PS script in install.ps1 to copy the file to file system yourself.

Aug 10 at 11:06 AM
Any news on this? I'd like to do exactly the same.