I developed a tool that besides DLL requires a strong named folder with 2 files in solution. Using NuGet GUI I created the folder and populated with files, but when I install package, the only DLL created but folder with 2 files are not. How can that be fixed?
NuGet has a set of conventions that define certain folders inside the NuGet package that will result in different actions being taken when the package is installed or uninstalled.
In order for folders to be created inside the project, when the NuGet package is installed, the folders need to be inside a Content directory. If you look at the jQuery package, it has a Content\Scripts folder with files inside it. This Scripts folder will be created inside your project, along with its files, when you install the jQuery NuGet package.
\Content
\Scripts
\jquery-2.1.0.js
Related
I have a PS1 script that I use in all my projects to sign the assemblies. Until now I copied this file over to all my projects. Now I wanted to create a nuget package with the PS1 file.
I created a nuspec file and put the file in "content". Unfortunately nothing happened. Then I tried to put it in lib. Still noting happened. When I restore the package in my project no files where created in this project.
When I analyst the nupkg file with my 7-Zip the file looks OK. The ps1 file was in content, lib respectively.
I didn't found anything to this topic online. Can someone explain to me, how to create such a NuGet-Package?
When a project using packages.config installs a NuGet package, the package's tools\install.ps1 script will run. However, this no longer happens when the project using the package uses PackageReference (such as SDK style projects, used by .NET Core).
Similarly, the files in the content folder of the nupkg are copied into the project on install, but only when the project uses packages.config. PackageReference projects use the contentFiles folder in the nupkg, however the behaviour is different. Those files are copied only on build, not install, for .NET Framework projects and on publish for .NET Core projects. Probably not what you want for signing assemblies.
The feature you probably want to use is including MSBuild props and targets in your package. Note that the props and targets file names must match the package id exactly for NuGet to use them. You probably want to use afterTargets="build" at a guess.
I have a UWP class library for Windows 10 which contains a custom templated control, VisualControl. The default template is defined in the Themes\Generic.xaml file.
Here is the directory structure I have created for the NuGet package which targets x86, x64 and ARM.
When I creat a NuGet package with these files, add it to my test application and add the VisualControl to the XAML file, the default theme is not applied to the VisualControl.
Am I packaging the file in an incorrect way? How do I ensure that the default template defined in the Generic.xaml file is picked up and applied to the Control.
Also, are the following files required in the NuGet package? If yes, where should they be placed?
Generic.xbf
TestVisualControl.pri
TestVisualControl.xr.xml
Found out the solution.
The Generic.xbf file should be placed in the Themes folder along with Generic.xaml.
The TestVisualControl.xr.xml file should be placed in a folder named TestVisualControl. This folder should be placed inside uap10.0 folder of each platform.
The TestVisualControl.pri should be placed inside the uap10.0 folder of each platform.
Here is what the final folder structure should look like
Creating a NuGet package with this folder structure would ensure that the style defined in the Generic.xaml file is loaded.
I have a Visual Studio 2015 solution with many projects. For one of the projects I would like the files from NuGet to download to a specific folder in my project. For example, I intend to use Bootstrap and also Signalr. I would like Bootstrap to download everything into one folder in my application, and not create folders within my project root. For example, I have a folder called 'Libs' in the project and would like those libraries to use 'Libs' as their root folder. This is due to an external build solution that handles everything in the 'Libs' folder.
I've found these docs about using a NuGet.config folder for the solution, but this does not handle my problem. Any ideas?
As far as I'm aware, this isn't possible. Each Nuget package is written with specific instructions on how to install into a project. One of those instructions is where to put files, another example would be what transform to apply to the web.config. Nuget doesn't specify a way to modify these instructions. The only thing you could do would be to modify the packages yourself - download the .nupkg file and open it up as a zip file, you will be able to edit the folder structure from there.
We would like to use Octopus Deploy for our Deployments. I am trying to package our assemblies using Nuget for the same. We maintain lots of solutions (contains lots of independent projects) and We have our custom windows host which doesn't have any direct reference to the application assemblies. Currently We Zip all the files and extract them to install the windows services. I am exploring a way to package all the content in zip file to NuGet Package. is that possible. What is the best and easiest way to package considering our current implementation. I tried creating .NuSpec file and NuPkg manually using package explorer. But it's not visible and only visible in package explorer.
you can bundle all artifacts by defining metadata inside a nuspec files , nuget package created using that nuspec file will contain all artifacts defined in nuspec file, you can do the whole process from your command line as well , when creation of package is done from command line you can see your package in the same path where nuspec file resides and most important thing nuget package is also a type of zip file , so you can simply rename your example.nupkg to example.zip and verify the bundled contents.
I have some automated tests that are using Selenium WebDriver. Tests should run on Chrome so I need to have ChromeDriver.exe. I am using NuGet to download the libraries and found that the ChromeDriver could be downloaded as a package too (http://www.nuget.org/packages/WebDriver.ChromeDriver).
However, this package contains only ChromeDriver.exe in the Tools folder. I need to copy this file into the bin folder because tests need to find it. Is there some way to do the copy in a generic way (without specific paths), because in the folder where the ChromeDriver.exe is unpacked from package contains version number so I would need to change the paths when the new version will be used. Also I would need to do similar thing with the NUnit.Runner package.
You could probably use a post-build event. Then inside the event use copy/xcopy and move it into the bin folder after the project has successfully built.