1

I have a Feature with an event receiver (written in c#), which for the sake of brevity creates a list which is a data store for a form on a custom web part. I have ps1 scripts which retract and deploy my solution and up until recently, this process has worked with no issues. Recently, however, I have had to add a new field to the list. So I used the same logic to add the new field following the same code logic that I have used for the other list fields. When going through the form to submit to the list I get the error:

Column 'MyNewColumn' does not exist. It may have been deleted by another user

Weirdly enough, if I deactivate the feature and reactivate via the UI, the error does not appear and everything works as expected. I am not sure why this is happening on initial activation. Why is it referencing the old list schema even though the solution is retracted and the DLL is removed from the GAC before another deployment is made? I have spent hours trying to figure this out, hopefully someone out there can assist.

3

Looks like it is a DLL caching issue. When you start Powershell command line window, it loads all DLLs available in the GAC. So, if you have updated DLL for the feature receiver, and deploying it within the same PS session then it will not reload updated DLL. I had experienced similar behaviour before. To tackle it, I created two seperate PS1 files. First one to deploy WSPs and second one to activate features. I called both PS1 scripts from another PS1 called Master.PS1.

For Example, to call powershell script from another powershell, use Invoke-Expression "Deploy.ps1". This command creates separate process altogether and it will load updated DLL.

Hope this helps!

  • Oh man, thank you so much! Such a simple explanation and solution. I wish I could get the hours back that I spent wasting trying to figure out what was going here. – KidBatman Sep 18 '14 at 15:06
  • i am also facing the same issue. PowerShell command prompt is still looking at the old dll and not picking up new one. Its picking up old dll even if i reopen new PowerShell window. Is there any command where we can clear the cache of PowerShell command prompt? – Ravi Khambhati Nov 10 '14 at 15:39
  • Make sure if WSP is completely deployed before launching new powershell process. When you launch new process using Invoke-Expression command, it creates separate process and reloads DLLs. So, no need to clear the cache. – Kiran Chauhan Nov 11 '14 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.