I have an application which uses an unmanaged library libtidy.dll
. In our code are using a wrapper TidyManaged
to use it.
We want to pull in libtidy
from our Team Services private package feed for it to be placed in the bin
directory
To do this I am creating a NuGet package as follows:
- Create a directory
libtidy-managed
- Put both
libtidy.dll
andTidyManaged.dll
into the new directory - Run
nuget spec
from this directory, with the following files
Package.nuspec:
<?xml version="1.0"?>
<package >
<metadata>
<id>libtidy-tidymanaged</id>
<version>1.0.0</version>
<authors>Name</authors>
<owners>Name</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Libtidy TidyManaged</description>
<releaseNotes>Libtidy TidyManaged</releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>Libtidy TidyManaged</tags>
</metadata>
<files>
<file src="libtidy.dll" target="content" />
<file src="TidyManaged.dll" target="lib" />
<file src="Install.ps1" target="tools" />
</files>
</package>
Install.ps1
param($installPath, $toolsPath, $package, $project)
$file = $project.ProjectItems.Item("libtidy.dll");
If ($file -eq $null)
{
$project.ProjectItems.AddFromFile("libtidy.dll");
$file = $project.ProjectItems.Item("libtidy.dll");
}
$file.Properties.Item("CopyToOutputDirectory").Value = [int]1;
I then create the package using nuget pack
and reference the new package in a local nuget feed.
When I build the solution
libtidy.dll
is placed in the root directory, instead of the bin directory
- When I look at the properties of
libtidy
(in the root directory) after building,Copy to output directory
is set toCopy always
- When I look at the project properties, under the
build
tab, theOutput path
is set tobin\
Can anyone see what I am doing wrong?
Note: This question is a follow up from this Stack Overflow question - the user from the accepted answer says everything should work, but I am still getting this problem.
As far as I can see, I am following his instructions to the letter...