Thursday, July 7, 2016

Adding Nuget package to a project in Source Control

While trying to add a package to a project via Nuget I was consistently getting the error "Invalid file path". While looking at the output windows I realized that the underlying issue was Nuget package manager was not able to add package files to source control and hence the files were not available in current workspace. This issue was resolved by following these steps:


  1. Create a new project and don't add it to Source Control eg at C:\Temp\WebApplication1
  2. Add the same package in question to the new project eg. MyPackage
  3. Open solutions folder in windows explorer and navigate to packages subfoler eg at C:\Temp\WebApplication1\Packages
  4. Locate the package folder by its name and copy it eg. C:\Temp\WebApplication1\Packages\MyPackage.1.1.0
  5. Open the packages folder at our source control stored solution eg. C:\Work\MyCompanyWebsite\Packages
  6. Paste the copied package folder here eg. C:\Work\MyCompanyWebsite\Packages\MyPackage.1.1.0
  7. Open source control explorer in the solution where we want to add this package
  8. Right click in the right hand pane and select Add Items to Folder ...
  9. Add the newly copied folder to the source control
  10. Open Nuget package manager window, search for MyPackage  and install it.

No comments:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...