0
votes

I`m using VS 2013 ULTIMATE but project is created in 2010 version because I have got old Sharepoint 2010. When I create new project I have got problem with 'InitializeControl'. Do you know how can I fix problem with 'InitializeControl'?

enter image description here

Warning 1

The custom tool 'SharePointWebPartCodeGenerator' failed. The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.

Error 2

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

I check this but does not help ->

http://big.info/2013/08/the-name-initializecontrol-does-not.html

5

5 Answers

3
votes

In my case the g.cs file was missing and I have then create a new control on ascx page. I have added asp button control and add onclick event and I found that g.cs file has been created automatically and it is running now.

This is for Sand box solution as well as for On premise solution.

1
votes

In my case it solved by adding the setting for hosts file like

127.0.0.1 mysite.domain.com

1
votes

I had the same problem with Visual studio 2015 and SharePoint 2016:
1. Give rights to access the config db to your user
2. Right click .ascx file and select "Run Custom Tool"

Maurizio

1
votes

The file doesn't get generated if the connection to the SharePoint environment wasn't successful.
Check the "Site URL" and "Server Connection" under project properties,
then right click on your *.ascx and click "Run Custom Tool".