Is there a way to add specific folders in the project that the package is installed?
For example, according to this blogpost you can add multiple files to the project, but what I want to add are folders. I added folders in the content folder before I create my nuget package, but the folders are not added to the project after the package is installed.
Thanks !
If you create a directory hierarchy in the content folder, nuget will replicate that in your project.
Related
I am trying to create a nuget package from .net6 project xml file. I have added README.md into the project file. When I install the package in another project, I want the README file to be copied to the output directory. Since I m working with pipelines, I am directly creating packages from project file without separately creating nuspec file. Is there a way to add some property in the project file which enables copying readme files upon installation of package?
I am still confused about how nuget works. I git clone a C# .sln project and from console, and I ran this nuget command:
nuget restore my_project.sln
it came to my attention that it generates two packages containing all dependencies required by my_project.
One package is located under my_project/src/packages, the other c:/users/my_user_name/.nuget/packages. While the file structures are a little different the DLL files in both packages are identical.
That confused me. Why two packages are generated by default? Where exactly does Visual studio look up for the project's dependencies?
More important, which config file should I update in order to only keep a copy of the dependencies and how can I specify the location in my file system for the packages?
Recent versions of NuGet support package references in project files.
This format will restore packages on demand, using your %USERPROFILE%.nuget folder as a cache. And your solution folder won't be "polluted" by a packages folder with binaries that you probably don't want to commit to source control.
VS2017 allows you to select "PackageReferences" or the older "Packages.Config" format when you create new projects (Tools/Options/NuGetPackageManager/General).
You probably have some projects in your solution that use the older "Packages.config" format, which stores in the packages folder in the solution directory, and newer "PackageReferences" format.
To convert the older projects to the new format, I believe you need to remove all packages from the project, then add them back again. They will be added using the default format you selected, with a prompt for confirmation if you selected "Allow format selection on first package install".
We're creating a global architecture for all products of our company, and we've come to have a very specific file-system structure in which packages folder should not be in the root of solutions directory.
Of course we can reference EF dll files from somewhere else, because it's configuration is done in csproj file.
However, when we delete packages folder, add-migration breaks, because it depends on the tools existing in the tools folder.
Is it possible to add paths to Nuget package management console? or is it possible to use add-migrations out of PMC, or do we have any other choice?
Based on our experience we think it should be possible, but we can't find out how.
I have a C# project that uses Nuget for package management. I enabled package restore so it created the .nuget folder. Then I want to create a Nuget package of this project. Can I create nuget .nuspec files in the .nuget folder and modify the Nuget.targets file to allow the creation of the package and upload to the galery when I'm in release mode?
Thanks.
You can do that.
Alternatively you can use nuget.exe pack command in the post build event ( more details # http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command )
or use true in the csproj file.
We have a .csproj that is being worked on by a number of people.
Unfortunately nuget has installed its 'packages' in different locations on each users machine, meaning when another user does an SVN 'update', their project wont compile because the .csproj file's 'hintpath' element is pointing to the dll in a different location.
Are there any other solutions to this?
Use NuGet packages restore feature and don't commit packages to source control.
This allows NuGet client application to download packages on demand. Downloaded packages will be located in solution folder, so, references to packages content will work at any machines.