When importing existing library projects into an existing solution (after I copied them locally from somewhere else), when I try to install or uninstall a Nuget package through the package manager, it justs builds my solution showing me all of the errors I have because the package is not installed. It does nto try to install or uninstall the package. Why is it building my project instead of just installing / uninstalling the bloody package?
Why is it building my project instead of just installing / uninstalling the bloody package?
It's not default behavior of VS IDE itself.
As for VS2017, if we install a normal package using Package Manager UI , VS will check the compatibility between the package to consume and the current project. If they're compatible, the package will be installed successfully, if not, VS will throw nuget error like NU1202
or others in ErrorList window
.
But I'm sure for VS2017, installing/uninstalling won't call a build.
Possible causes of the issue and corresponding suggestions:
1.This behavior results from one third-party extension .
Reset all VS settings => disable all the third-party extensions => restart VS
to check if the issue persists. If after the check you find this issue results from one extension, you need to make sure if the extension provides one option to turn on/off the auto-build. Or you may need to disable/uninstall the extension temporarily and contact the author of the extension to post the issue.
You may get more details for trouble-shooting from this similar issue .
2.Custom script(.ps1,.targets) from one specific nuget package causes this.
The authors can place powershell script and PackageID.targets in .nupkg when generating packages. Some of these scrips will execute when we install the package, others will execute when we uninstall the package. See similar issue here .
You can create a new simple console project TestProject
in TestProject
solution. Then right-click solution=>add=>Existing project
to import a new external project. Now let's install the Newtonsoft.Json
package to check if the issue disappears. If the issue disappears in new project with Newtonsoft.Json
package. I think it indicates one special package you try to install/uninstall may cause the issue.
Hope all above helps and feel free to let me know if there's any update.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.