I got this error "Error occurred in deployment step Add Solution: Operation is not valid due to the current state of the object." when deploying a SharePoint solution in SharePoint 2016.
Error occurred in deployment step 'Add Solution': Operation is not valid due to the current state of the object.
To solve this error "Error occurred in deployment step Add Solution: Operation is not valid due to the current state of the object.", you have to do the following:
Again, if the issue still persists, so it means there is an issue in the Cache.ini file or one of the cache folders is completely deleted - So to ensure that all folders in the registry are already located in the SharePoint Config folder try to run the below cmdlets one by one
SharePoint Config folder
$ConfigDbId = [Guid](Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\Secure\ConfigDB' -Name Id).Id $CacheFolder = Join-Path -Path ([Environment]::GetFolderPath("CommonApplicationData")) -ChildPath "Microsoft\SharePoint\Config\$ConfigDbId"
C:\ProgramData\Microsoft\SharePoint\Config
Cache.ini
Note: In case, you got this error in SharePoint Event Receiver, and you have followed this issue even after applying the above instructions, so the issue is mainly related to your code, but Initially, don't use configuration manage for connection string instead use "AppKey", and avoid having _ (underscore) in your event name.
1.1k questions
678 answers
456 comments
193k users
Related Activities
Categories
Most popular tags