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:
- Create a new project and don't add it to Source Control eg at C:\Temp\WebApplication1
- Add the same package in question to the new project eg. MyPackage
- Open solutions folder in windows explorer and navigate to packages subfoler eg at C:\Temp\WebApplication1\Packages
- Locate the package folder by its name and copy it eg. C:\Temp\WebApplication1\Packages\MyPackage.1.1.0
- Open the packages folder at our source control stored solution eg. C:\Work\MyCompanyWebsite\Packages
- Paste the copied package folder here eg. C:\Work\MyCompanyWebsite\Packages\MyPackage.1.1.0
- Open source control explorer in the solution where we want to add this package
- Right click in the right hand pane and select Add Items to Folder ...
- Add the newly copied folder to the source control
- Open Nuget package manager window, search for MyPackage and install it.
No comments:
Post a Comment