So I just had an interesting experience recently at work. I did my first webpart upgrade from Visual Studio 2010 to Visual Studio 2012 last week (SharePoint 2010 to 2013). I realized when I deployed the webpart that I got a “this user control does not exist” error, when the ascx file for the Visual Webpart did exist. I’m not sure if it was something simple and ridiculous or if I had to change the entire webpart, but here is what I had to to do to fix things:
- Open your webpart in Visual Studio 2012 or 2010
- Create a brand new solution in a new window in Visual Studio 2012
- Copy everything into the new ascx file and make sure any files reference “_/layouts/15/…” or it will not find your embedded links to javascript and css files
- Copy all your properties from the cs webpart container file in your old webpart to your code behind for the new webpart. You only need one set of properties, so you can dump anything in the user control code behind that involves a property.
- Copy all your code other code behind data and make sure to change in appropriately referencing only the webpart properties.
- Compile your webpart and it should deploy properly.
So there was a tool called Visual Studio Power Tools that was an add-on for Visual Studio 2010. It included a webpart called the sandbox visual webpart. This webpart is now the sandbox and farm visual webpart in Visual Studio 2012. Everything compiles into a design and cs file, instead of deploying an ascx file to the control templates. You might be able to mess with the xml to get everything to deploy, but honestly it’s not that hard to drop everything into a new webpart and test it. Now that you have read this blog post you should understand what needs to be done. I hope that you guys enjoy my trials from this week. I know that it was an adventure and it was fun. Good luck!