nuget,nuget-package,nuget-spec , How to include content files in project if resources are specified in nuspec file?

How to include content files in project if resources are specified in nuspec file?


Tag: nuget,nuget-package,nuget-spec

I am creating a nuget package definition to include a whole bunch of DLLs. Some of them are needed only at design time, so according to the Nuspec Reference I created a references section to specify which assemblies should be referenced by the project.

I also specified a list of files to be included. Some of these files being the libraries, one is a PowerShell script that gets executed during package installation and one is simply a content file that should be added to the project lateron.

These are the relevant sections of my nuspec file:

<package xmlns="">
    <!-- Most of the metadata stuff left out for brevity -->
    <dependencies />
      <reference file="MyComponent.dll" />
      <reference file="MyComponent.Data.dll" />
      <reference file="MyComponent.Other.dll" />
    <file src="MyPackage.install.ps1" target="tools\install.ps1" />
    <file src="MyComponent.ReadMe.txt" target="ReadMe.txt" />
    <file src="C:\Some\Path\MyComponent.*.dll" target="lib\net45" />
    <file src="C:\Some\Path\MyComponent.*.xml" target="lib\net45" />
    <file src="C:\Some\Other\Path\*.dll" target="lib\net45" />

Now here is my problem: The licenses.licx file does not get included in the project when the package is being installed. What must I change to achieve this?

Adding it to the references section does not work, because, well, it is no library...


I found out what was wrong. To include a file into the targeted project the file needs to be placed in a sub-folder named content in the package's folder structure:

The correct files section of the nuspec file would then look like this:

  <!-- other files omitted for brevity  -->
  <file src="MyComponent.ReadMe.txt" target="content\ReadMe.txt" />


Trying to add non-.NET libraries to NuGet package

I have a .NET DLL that is using non-.NET DLLs. I'm trying to create a NuGet package out of this, but I don't seem to be penetrating the magic behind this. I read the NuGet reference about the <files> and <references> but that didn't really work out for me -...

How do i reset nuget and start afresh?

here's what's happening. within the last few days something happened to my solution that apparently broke nuget. when i go into package manager/installed and do a find on SignalR, nothing comes back as if SignalR wasn't installed when i know it is. when i go into manager/online and do the...

Add reference to same Nuget package but for different targets

I have a solution in Visual Studio 2013 with more C# project files that have source code in common but are targeting for different platforms (.Net, WinRT, .Net Micro Framework and so on). All the csproj files are under the same directory. These projects use a Nuget package that is...

NuGet Package Manager Console Command Fails But Search -> Install Works

I was just installing a new package thats not in my local cache. I took the command directly from the NuGet site. Executing the command in the PMC failed with the following error: The source at All [(Aggregate source)] is unreachable. Falling back to NuGet Local Cache at C:\Users\Jammer\AppData\Local\NuGet\Cache Install-Package...

Package Manager in VS2015 RC fails on installing/restoring some packages

I'm trying to install a nuget package - NGenerics.1.4.1 from ( into a ASP.NET 5 project (website). Package Manager fails with UriFormatException. After that a reference is added into Reference folder in the Solution Explorer but with yellow triangle ('warning'). The error added into the Error List: "Dependency NGenerics...

NuGet fails to find existing package

How it's possible that NuGet's Install-Package fails with Unable to find version 'x' of package 'y' when that exact version is released as NuGet to official repository and it shown on the page. Here is specific sample with content and NuGet Install-Package command output. UPDATE. Package sources are...

Can't reinstall package

On a new Win8.1 reinstall, with all of my code restored from backup, I'm suddenly now getting a yellow NuGet warning when I issue the command update-package -reinstall -project ui: Skipped reinstalling package 'AeroWizard 2.0.9' in project 'Ui' because the package does not exist in the package source. I'm using...

nuget security - malware installed by nuget packages?

Is it possible that you can be infected with malware by installing nuget packages? This is especially interesting when you think of Microsoft Visual Studio 2016 which will be fully dependent on Nuget....

“ExcelReaderFactory.cs not found” Error

I've downloaded ExcelDataReader from the Visual Studio Package Manager Console and followed the C# instructions on its Code Plex page, but, during run-time, I get an "ExcelReaderFactory.cs not found" message when the code fails at the ExcelReaderFactory. The entirety of my code block is below. I've tried removing and...

Can I use my OctopusDeploy built-in Package Repository in Manage NuGet Packages?

I have a working Octopus Deploy server which has a library of packages I built. I have an assembly which depends on one of the assemblies which I have deployed in Octopus Deploy and which is currently in that repository. I tried adding it as a package source in NuGet...

Nuget-deployed C# files excluded from Resharper analysis

I'm having trouble understanding a behaviour of Nuget. I've created a basic package that deploys a single Test.cs file into an "HtmlHelpers" folder in a project. I'm following the "convention based working directory" method described on the Nuget site. The issue I'm having is Resharper file analysis isn't enabled for...

NuGet restore unable to resolve host 'www.nuget'

I am trying to use the nuget restore command to restore NuGet packages on a CI server. I can run it locally without issue, but on the server I am getting a number of warnings (errors, really): WARNING: The remote name could not be resolved: 'www.nuget' WARNING: The remote name...

Given two C# projects on the same base directory, how to use different packages.config for each

I have two projects (*.csproj) on the same directory (I am porting and this seems like a good workflow) however the problem is that I can only have 1 packages.config on the folder. I have tested having the project on a different folder and linking the files I need, however,...

Can't build a project with Postsharp 4.1.14

I have a project which references a postsharp 4.1.14. When I build a project the error occurred. Postsharp is installed by nuget package. There is .net version 4.0 installed on computer, but Microsoft.Build.Utilities.ToolLocationHelper.GetPlatformSDKLocation method is from .net 4.5. Can I use different version of postsharp? Is there another way to...

How can I stop my ClickOnce install from requiring Newtonsoft.Json v4.5 in the GAC?

We have a ClickOnce deployment of a WPF desktop application, and recently installed the Newtonsoft.Json version 6.0.8 nuget package. After making this change and publishing the ClickOnce deployment, users can't run the update, because of this error message: The first thing that strikes me as odd is the dependency on...

How to pass credentials when accessing a Nuget feed

I am trying to download packages from a Nuget repository which requires credentials for it to be accessed using NuGet.Core. I know that Nuget repositories with no authentication can be accessed as follows: //ID of the package to be looked up string packageID = "EntityFramework"; //Connect to the official package...

C# sqlite Unable to load sqlite3.dll

I have used nuget to install sqlite-net and System.Data.SQLite (x86/x64). I have rebuilt and I have restarted and I still get the following error: Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E). This is the line that triggers it: db = new...

Tab completion for array not shows after first selection

This is a script for VS PowerShell. function global:Add-Shape { param([string]$Shape, [string[]]$Colors) Write-Host "Shape Name:$Shape" foreach ($i in $Colors) { Write-Host "Color Name:$i" } } Register-TabExpansion 'Add-Shape' @{ 'Shape' = { "Circle", "Square", "Triangle" } 'Colors' = { "Brown", "Red", "Blue" } } In Package Manager Console When I try...

how to create nuspec file in specific folder?

I tried to create .nuspec file in a different folder by giving path but it is giving me error Nuget.exe spec ..\MYDEMOFOLDER Nuget.exe pack ..\MYDEMOFOLDER\MYPROJECT.csproj pause want to create MYPROJECT.nuspec in ..\MYDEMOFOLDER folder location getting error to create nuspec file The package ID '..\MYDEMOFOLDER' contains invalid characters. Examples of valid...

Visual Studio 2015, Nuget and “same key has already been added.”

I have Visual Studio 2015 RC. When I open a console app or a Windows Phone 8 Silverlight project, everything works fine, I can use Nuget without problems. When I open a Universal App project (Windows 8.1 + Windows Phone 8.1), Nuget breaks. When I open the Nuget console, I...

Github and Nuget packages

I am attempting to contribute to a project on Github (First time). I added a new Project to the solution and added NUnit and AutoFixture (via Nuget), now when I clone that repo it's missing all of the references to NUnit and AutoFixture. Now when I did a pull request...

NuGet - Dependee project referencing different DLL according to selected build configuration

I'm completely new to NuGet and just researching/proof-of-concept'ing it at the moment: Is it possible to package a NuGet package in such a way that the dependee project (the one that has the dependency) references a different DLL according to the project configuration build? Example: Dependee-Debug.DLL -> References Dependency-Debug.DLL Dependee-Release.DLL...

Link error: Installing boost zlib filters using NuGet in Visual Studio (2012)

I've installed these packages: boost boost-vc110 boost_iostreams_zlib zlib But the linker is unable to find the required lib: 2>LINK : fatal error LNK1104: cannot open file 'libboost_zlib-vc110-mt-1_58.lib' Is there a way to fix this problem manually by changing the file name or am I still missing a package?...

Where to find Microsoft.VisualStudio.QualityTools.WebTestFramework

I am missing a reference to this .dll file and I can't find it from the add references tab, it is not there in both extensions and frameworks and neither nuget package manager lists it.

Can not download nuget packages

I'm getting the following error: WARNING: The ServicePointManager does not support proxies with the https scheme. This started happening randomly. I'm not behind a proxy, and restarting did not fix anything....

NuGet Entity Framework 6.1.3 as default not 7 Beta 4

Today I updated Visual Studio 2013 from Update1 to Update4 and the last version of NuGet. Now all time when I create a new solution, as default installs the Entity Framework 7 Beta 4 and I'm forced to change it in every new solution from NuGet Package Manager. There is...

Can't open namespaces in a Nuget package

I did the following: Create a new F# project in VS2013 In Package Manager Console, execute while targetting the new project: Install-Package FSharp.Azure.StorageTypeProvider In the file, type: open FSharp.Azure.StorageTypeProvider can be seen in the examples included in the Github project. But I get the error: "The namespace or module...

NuGet on mono behind proxy not able to connect to the internet

I have a Linux machine behind a corporate proxy. For the proxy I have setup CNTLM to handle the authentication for me, so my proxy is located at http://localhost:3128. CNTLM connects to a corporate proxy that uses NTLMv2. Now when I try to run Nuget on Mono with the following...

How to change CopyToOutputDirectory on project reference via powershell

I created a nuget package which contains 3rd party assemblies so that I don't have to put them in a lib folder in every repo where I want to reference them. The nature of the 3rd party libraries is that I cannot have their references set to copy to the...

Forked a project but what is .pp?

Sorry if this is not the right place to post this type of question...if it's supposed to be on another site please let me know or feel free to close. I've got a simple question about github. I am very new to it and "forked" a project I wanted to...

Visual Studio 2013 - Setting up Nuget packages for every project

I want all of our future projects to use Bootstrap LESS and other nuget packages. Rather than supply a document to all my team members and hope they remember to set it up, am I able to create a skeleton project then template it so it appears under File ->...

Proget Server Up but Feed Inaccessible in Visual Studio

We have reinstalled ProGet as we rebuilt our server after a security hole was discovered (unrelated to ProGet). The feed is visible in the browser, but inaccessible in Visual Studio. While rebuilding our server, we have ProGet running on a temporary Azure server, which is working and serving our NuGet...

“Unable to satisfy package dependency constraints” with Breeze.Server.WebAPI2

I am trying to add the Breeze.Server.WebAPI2 Nuget package to Visual Studio Community 2015 RC. When I click on install I get "Unable to satisfy package dependency constraints" The listed dependencies are: Microsoft.AspNet.WebApi.OData (>= 5.2.2 && < 6.0.0) Microsoft.AspNet.WebApi.WebHost (>= 5.2.2 && < 6.0.0) Breeze.Server.ContextProvider (=1.5.4) WebActivator I tried adding...

How to install Visual Studio Gallery extensions from command line

TL;DR Is there a way to access Visual Studio Gallery from command line, similar to chocolatey? I am trying to configure a Visual Studio dev environment using Vagrant. Now, team members use various extensions available from Visual Studio Gallery and it would be great if they could script their installation...

Tfs and nuget: project files are forever in check out after build with restore nuget packages

MS VS 2012 I have solution in tfs with enabled nuget packages restore. Every time when I build solution all my project files are cheked out with this changes: <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <PropertyGroup> <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet...

New Automatic NuGet package resotore and NuGet.Config

I'm migrating to new version of Automatic package restore as described in docs This documents says, that .nuget folder should be removed completely. Including NuGet.Config, that contained a property, we need: <config> <add key="repositoryPath" value="..\..\..\commonNugetPackages" /> </config> So how one should specify path where packages should be restored? Update: Updating...

Editing Nuget Package C# Helixtoolkit.WPF

I am using the Helixtoolkit.WPF in my C# program. I have imported the NuGet package and it is working perfectly. However, I am wanting to edit one of the files, specifically GridLinesVisual.cs. I want to change how one of the functions in that file operates, but can’t seem to get...

How to disable automatic Nuget Package Update in Xamarin

How to disable automatic Nuget Package updates in Xamarin 5.9 (build 539) when opening a new Project?

How to create a powershell script that triggers a NuGet Update-Package –reinstall?

I have a nuget spec that installs both library file (dll) and two zip packages on a specific folder. Updating the packages is no issue when doing it from Visual Studio 2013 manually. However, when it is being triggered from either our CI servers TeamCity and CCNet, it is only...

Unable to add any nuget dependency with ASP.NET 5

I've just downloaded Visual Studio Enterprise 2015 RC and I'm trying to create a simple ASP.NET 5 application. But each time i'm modifying the project.json to add a dependency, I always have an error. For example, when adding a dependency to Newtonsoft.Json I have : "Dependency Newtonsoft.Json >= 6.0.8 could...

LocalPackageRepository returns IsLatestVersion=true for all packages

I've created a folder on my C:\packages. Inside I've created two packages with identical Ids but have different versions. I the use Nuget.Core to create a LocalPackageRepository pointing to this directory. When I query for the packages using respository.FindPackages("myId")both packages are correctly returned by the service. However, the IsLatestVersion is...

An error occurred while configuring the solution to restore NuGet packages on build. The operation has timed out

When I right-click my solution and click "enable nuget package restore" I get the message: Configuring the solution to restore NuGet packages on build... And after that the error: An error occurred while configuring the solution to restore NuGet packages on build. The operation has timed out What can it...

VS Online Build - Publish to local NuGet feed

I'm trying to migrate from running Team Foundation Server locally to VS Online. I need to set up a build that will publish a nuget package to our local feed. Is this possible? I assume I need to set up VPN or something. I'm not even sure where to start....

WPF 'Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.'

My application runs fine in VS 2010 but when I copy the executable from the bin folder to another location I get this error: 'Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.' Line number '15' and line position '23'. Did a bit of testing and found out that if I include the...

cURL with Visual Studio 2013

So i have came along with cURL as a very nice library and working very fine in OSX. But on windows now i have got big troubles with getting ready with this library. I googled now for about 2 days and tried over a dozen (in detail) different ways to...