문제

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.

도움이 되었습니까?

해결책

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top