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:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...