NuGet package is not completely installed - c#

I am creating a NuGet package via Azure DevOps. The NuGet package contains an Example.exe file and an Example.exe.nlog file. So far all is well. WWhen I install the NuGet into my project in Visual Studio, only the Example.exe is added. The Example.exe.nlog is missing.
It is not clear to me why this is not also added to the project.
As a test I have added an Example.dll as well. But this is added to the project. Why not the .exe.nlog?
Thanks for the help.

I found the solution. I have to add "content\Folder\Folder" in the nuspec target Tag

Related

Can't access installed Nuget Package

I've got a NuGet package installed, OpenCvSharp4.Windows, but for some reason when I try to use it in my code it is not recognized. I have other C# projects that have it installed the same way and it works fine.
Does anyone know why the package isn't being recognized?
delete obj and bin
rebuild
if problem remains, reinstall Opencvsharp4.Windows, and rebuild
When I tried to test/reproduce this issue on my side, I clicked to install OpenCvSharp4.Windows NuGet package. The installation was automatic and after the process finished installing, I saw that there are several other related NuGet packages installed as well, such as OpenCvSharp4, OpenCvSharp4.runtime.win and OpenCvSharp4.WpfExtensions. It seems OpenCvSharp4.Windows depends on these NuGet packages.
Checked the screenshot you shared, it seems only OpenCvSharp4.Windows NuGet package was installed. Could you please elaborate how you install this OpenCvSharp4.Windows NuGet package?
Suggestion
Please try to install other three NuGet packages which I mentioned above manually and reopen your project to see if it works this time.

File is not accessible - Visual Studio 2017

I have downloaded Visual Studio 2017/Community, for test automation, but when I added the reference selenium-dotnet 3.14.0 , it's saying that this file is not accessible.
Please help. Thanks
click here to see the problem
Have you tried going to the NuGet Package Manager?
Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Then Search for Selenium and v3.14.0 is at the top
You can also do this from the NuGet Package Manager Console with:
Install-Package Selenium.WebDriver
According to the screenshot, you're trying to add a NuGet package through the "Add reference" dialog, which is designed to add references to DLLs directly. NuGet packages typically contain DLLs but you have to install them using the Manage NuGet Packages for Solution dialog as #ZP123 explained and not through Add Reference.

Nuget Packages are missing in Visual Studio

I have been using xamarin studio, it works fine when I download a sample project from mvvmcross. It compiles and deploys the device perfectly.
But when I open the project in the visual studio, there are a lot of missing packages for some reasons. Is there a way of handling ? I am using Nuget 2.8 in Visual studio 2013
When I open Nuget as follows, there is a button to restore the missing packages. I clicked on it.
Then it is attempting to download the missing packages, and then it realizes there are dependencies as follows:
Then I am attempting to download the dependency manually as follows but it shows the packages has already downloaded but I am still seeing the missing packages in the solution, nothing is affected.
Therefore I am getting hundreds of errors as follows:
When I take a look at the property of missing packages, I see as follows
You should update your NuGet Package Manager extension in Visual Studio and then try restoring the packages again.
The restore error MvvmCross.Binding already has a dependency defined for MvvmCross.Core is caused by an old version of the NuGet package manager extension not recognising the newer target frameworks that the MvvmCross.Binding NuGet package is using in its group dependencies. This bug has been fixed in a newer version of the NuGet Package Manager.
If you search for the 'already has a dependency defined' error message you will find several cases of this, such as this StackOverflow question, for example:
Can not install NuGet package
Right click on the solution in solution explorer and choose 'restore nuget packages'

How to add a nuget package to the package.config the proper way?

For my C# project I am maintaining a packages.config which includes all the dependencies my project requires. Over the time I have been copy-pasting the entries manually using a regular text editor, checking in the version number I found on the NuGet website and so on. To restore the package upon a checkout, I use nuget -o nuget-packages install packages.config which worked good so far (I am using Xamarin Studio on non-windows systems, so no VS available).
I was just realizing that messing with the packages.config in a text editor couldn't be the intended way. I know from npm and bower that a npm install --save-dev <pkg-xy> will to the job and write the package version back to the config. Is there an equivalent of this in NuGet.exe?
From the command line this not supported. You will have to edit the packages.config file manually, or write a utility to do this work for you, or extend NuGet.exe with this feature.
There is no equivalent in NuGet to NPM's npm install -save
Currently the only way to have the packages.config file automatically updated when you want to install a new NuGet package to your project is to use an IDE, such as Visual Studio or Xamarin Studio, and actually install the package. Using NuGet.exe from the command line does not have an option to add/remove entries in to/from the packages.config file when installing a new package.
NuGet.exe does have an update command which will update the package to the latest version. Whilst this would update your packages.config file it also updates your project file by adding any assembly references that the NuGet package needs.
You really shouldn't be editing packages.config. Package Restore doesn't do what you think it does. It simply downloads any missing packages that are listed in packages.config.
You might think this is what you want, but Package Restore does NOT add references to your project. It also doesn't do any of the other things the package creator had intended like running an install.ps1 script.
When installing a package, NuGet handles all of this, so your project files have added references, content, etc. This and the packages.config file is what you would commit to source control. You can leave out the actual packages folder, so you don't have to commit large binary files.
When you open the solution and build, NuGet will see that the packages are missing and will download them as if you had checked them in. The actual "install" was already done (and committed). That is all that Package Restore does: no more, no less.
If you are using Xamarin Studio, you can install NuGet by following the instructions here:
https://github.com/mrward/monodevelop-nuget-addin

cannot install NuGet package into project

I cannot install the NuGet package System.IdentityModel.Tokens.Jwt (.Net JWT Handler) into my project. If i try to install the package with NuGet, it will install into the root of the solution only (a .nuget folder is created in the root of the solution). I need to install the package in my project, not the solution.
Why would this happen? I tried passing in the project name to the Install-Package command in the Package Manager Console, and that looks like it installs correctly but no references are added to my project and the packages.config file is not updated.
My project is currently referencing .Net 4.5.1 and I have also tried with .Net 4.5.
The package I am trying to install is here:
System.IdentityModel.Tokens.Jwt
I'm having the same issue. I was trying to install the package as said in this article http://msdn.microsoft.com/en-us/library/dn205064(v=vs.110).aspx
So, I look into the package history and finally I installed the previous package
http://www.nuget.org/packages/System.IdentityModel.Tokens.Jwt/3.0.0
It works fine for me.
With NuGet, you can now specify the directory the packages are installed in.
http://docs.nuget.org/docs/release-notes/nuget-2.1
Specify ‘packages’ Folder Location
In the past, NuGet has managed a solution’s packages from a known ‘packages’ folder found beneath the solution root directory. For development teams that have many different solutions which have NuGet packages installed, this can result in the same package being installed in many different places on the file system. NuGet 2.1 provides more granular control over the location of the packages folder via the ‘repositoryPath’ element in the NuGet.config file. Building on the previous example of hierarchical nuget.config support, assume that we wish to have all projects under C:\myteam\ share the same packages folder. To accomplish this, simply add the following entry to C:\myteam\nuget.config.
The package System.IdentityModel.Tokens.Jwt 3.0.1 has some problems: the file System.IdentityModel.Tokens.Jwt.dll and System.IdentityModel.Tokens.Jwt.Xml should be put in directory lib\net45, but they are put in the root directory instead. This causes NuGet to think the package is a solution level package, and will not install the package into a project.
This problem was fixed in System.IdentityModel.Tokens.Jwt 3.0.2

Categories