I have a Web Forms page and it uses Sitecore.Context.Item.Fields.

This works when I publish to the local Sitecore instance. But in my project that is external to the Sitecore instance, Visual Studio is telling me that the name Sitecore does not exist in the current context. The project will build and deploy and work, but how do I get rid of this error in Visual Studio?

  • Did you add references to the Sitecore.Kernel dll (and any other required libraries) to your VS project, using Nuget for example?
    – jammykam
    Jul 6 '18 at 21:35
  • @jammykam Yes I added Sitecore.Kernel.NoReferences and Sitecore.Web.NoReferences with NuGet. Maybe I need to add the ones with references? Jul 7 '18 at 0:57
  • @jammykam i will try the ones with references at some point when I go in tomorrow and let you know. Jul 7 '18 at 1:29
  • @BrettDrake Can you post the code snippet for both C# class as well as the ASP user control markup? Jul 8 '18 at 18:04
  • Thank yall both very much for posting. It turns out that the problem was I had used the Sitecore.Kernel.NoReferences and Sitecore.Web.NoReferences instead of Sitecore.Kernel and Sitecore.Web. Intellisence fails with the NoReferences libraries but works fine with the libraries having references. @jammykam, if you want to write this up as the answer, I will accept as your comment helped me to figure out what I did wrong. Thank yall both again for your help. Jul 9 '18 at 11:18

No one followed up so I will answer what I found. This answer applies to projects outside of the Sitecore instance. The problem was I used the NoReferences versions of the Sitecore libraries. It turns out that if you want reliable Intellesense, then use the libraries with references making sure to add from the NuGet Sitecore repo the correct revision for your install. Set Copy Local to false for any references already in Sitecore's bin folder so publishing doesn't break your local instance.

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.