Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I don't think this qualifies as a 3rd party product, so I'm posting here.

I have a clean VM with VS2010 SP1 installed. I then installed the VS Power Tools for SharePoint. I'm attempting to create a Visual Web Part (Sandboxed Solution), but I keep running in to an error.

The name 'InitalizeControl' does not exist in the current context

This is after adding the web part to the project, and attempting to build. I've Google'd the error message, and the results are limited. I found Waldek's post here , but the situation of the length of text is not my problem. I haven't entered any text in yet .

I also noticed that a designer file isn't being generated (ascx.g.cs). I think it's supposed to be there.

share|improve this question
    
Was VS 2010 SP1 installed first? I ask because I installed the PowerTools when they were first released, and didn't have that problem. I'm not sure if I have tried to create a visual web part since, but everything else has been working with SP1, though there were some changes. –  Mike Oryszak Sep 7 '11 at 16:43
    
SP1 was installed first, yes. –  Tim Gabrhel Sep 7 '11 at 16:53
    
I've the same problem with SP13 and VS12 –  Salvatore Di Fazio Feb 14 '13 at 14:53

1 Answer 1

up vote 1 down vote accepted

This was a brand new VM that I began using. The issue was with permissions. My local user account did not have permissions to the Content Database for the site I was trying to connect to. Once I granted db_owner permissions, I was able to validate the address, and my designer file was generated.

share|improve this answer
    
Can you elaborate on this? I've run into the same issue, but I'm having a hard time understanding any possible link to permissions to the Content DB. (And it doesn't work for me). Thanks. –  uosɐſ Apr 8 '12 at 21:41
    
Does your current user account have permissions to WSS_Content for your Sharepoint site in SQL? –  Tim Gabrhel Apr 9 '12 at 13:19
    
Yes, I had added that but it had no effect. But my question was - how could that have any interference with the code generation step in Visual Studio (if we're thinking of the same thing). I have fixed my issue though - in my case, I believe there was some corruption in the set of files. I created a second control which had no problems, so I wiped it all out and started over, no issues now, same code. Thanks for talking it though with me. –  uosɐſ Apr 9 '12 at 13:32
    
@uosɐſ I had same problem and this is how I fixed issue: I simply add some valid url in SharePoint Url property in project –  Hameds Dec 20 '12 at 11:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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