I've been working on a project where I had two document libraries (one upload library and one archive library) and a number custom Site Content Types. We have an event receiver on the upload library that will sometimes move the document (using the C# API SPListItem.File.MoveTo method) to the archive library.
Here's what we saw happening:
We had content type Child which was based on content type Parent. When in the upload library, the document was categorized as Child. When the event receiver moved it to the archive library it would arrive as content type Parent. This made no sense!
We stepped through the code and there was nothing at all that indicated a problem with our event receiver. It was truly happening inside the MoveTo function, so it seems to be a SharePoint bug.
Our only solution was to change recreate the Child content type (as Child2)so that it didn't inherit from Parent and instead inherited from something else (like document). Once we created Child2, we then changed all the documents of Child to Child2. Then we removed the Child content type from both libraries, and deleted the site content type. Finally we renamed the Child2 site content type, and then the instances of that content type in each libary.
Problem solved!
This blog is to discuss my adventures in designing and developing custom SharePoint solutions. I am a SharePoint Consultant, so please feel free to contact me if you have any SharePoint needs and I'd be happy to help.
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Tuesday, June 25, 2013
Thursday, March 7, 2013
Visual Studio ignoring Step In and Referencing GAC DLL instead of local copy
I've been working on a large project for SharePoint 2010 and we just started using Visual Studio 2012. I needed to reference and use a SharePoint helper project that I wrote in the past so I added it to my solution (as I knew I'd need to update some of the functions) and then referenced it in my new class.
When building and trying to step into methods in my SharePoint helper project VS2012 was ignoring my Step In and was just stepping over.
I finally found out that VS was ignoring my direction to copy the referenced dll locally and was instead loading the dll from the GAC. I hadn't incremented the assembly version but had changed the code of the SharePoint helper so I couldn't even manually load the symbol file.
So all I did was increment the assembly version on the SharePoint helper project and immediately it copied the dll locally and stepped in properly during debugging.
Lesson learned!
When building and trying to step into methods in my SharePoint helper project VS2012 was ignoring my Step In and was just stepping over.
I finally found out that VS was ignoring my direction to copy the referenced dll locally and was instead loading the dll from the GAC. I hadn't incremented the assembly version but had changed the code of the SharePoint helper so I couldn't even manually load the symbol file.
So all I did was increment the assembly version on the SharePoint helper project and immediately it copied the dll locally and stepped in properly during debugging.
Lesson learned!
Subscribe to:
Posts (Atom)