2
votes

Repro is like this: create an Empty SharePoint Solution, add new item, choose Content Type template, put a name, ok, it connects to a brand new test site, then I get the infamous "value does not fall within expected range".

Didn't get into debugging VS to get a stack etc, just wanted to ping here to know whether it's a known issue, I'm missing a VS patch, etc.

Ideas appreciated, thanks!

3
Ok, doesn't repro with another cleanly created VS SP empty solution... - Ariel

3 Answers

3
votes

I saw the same type of behavior when creating content types using VS2010/SP2010. This is especially problematic if you're making changes to a previously deployed content type. The issue seems to stem from Visual Studio keeping a connection to SharePoint open and cacheing what is available (content types, etc.) for use in development. The best order I came up with for developing content types was this:

  • Deploy Content Type
  • Test
  • Retract Solution
  • Delete Solution
  • Close and Reopen VS
  • Reopen VS
  • Repeat

Content Type definitions also seem to be more picky in SP2010 in regard to several items:

  • { and } around your field IDs
  • Requiring the name of the included field IDs
  • Make sure to use Inherits, Overwrite, Version and FeatureID. This helped with making sure the content type was removed consistently, and redeployed consistently.
3
votes

I have had this happen when creating a content type where a folder of that name already existed on disk.

(because I had previously deleted a content type of that name from the project, but not from my hard disk)

0
votes