How to: Use Visual Studio 11 to publish solutions to SharePoint Online

Posted Tuesday, January 10, 2012 11:23 PM by CoreyRoth

So I’ve been living under a rock again and I had never gotten around to checking what’s new in Visual Studio 11.  The Developer Preview has been around a while and I wanted to check it out today and was surprised to see some new SharePoint development features that I am really excited about.  If you have been following me, you know I have been doing some work with Office 365 and SharePoint Online, so when I read about the new Publish feature in Visual Studio 11, I had to check it out.  Let’s start by creating a new project with a simple web part.  We’ll look and what’s new and see how exactly we can publish to SharePoint Online.

Open Visual Studio 11 and go to the New Project menu.  If you are familiar with this menu in Visual Studio 2010, you will quickly notice some differences.

VS11DPNewSharePointProject

First, you will notice you have a lot less choices.  I really like this change.  I always found it confusing that there was many project types that really just equated to a SharePoint Project Item that you would create in any project using the New Item menu.  I always used the blank SharePoint project and we now refer to this simply as a SharePoint 2010 Project.  Be sure and change the framework to .NET Framework 3.5 as it default to .NET Framework 4.5 by default.  One other change you might notice is that there are no longer any SharePoint 2007 projects available.

Create a SharePoint 2010 Project and then be sure and check Sandboxed Solution since we are going to the cloud.  Go ahead and create a new Visual Web Part next.  Now you might be thinking, that you can’t do Visual Web Parts in sandboxed solutions.  In the past, we had to rely on tools from the community to make this happen.  Now Visual Studio 11 supports Visual Web Parts out-of-the-box.  We’ll talk more about these in my next post.  Drag a label or whatever ASP.NET controls you want onto the design surface and create your “Hello, World!” text.  When you are done, click Build.  Don’t bother deploying it though.

Now we want to publish this solution to SharePoint Online.  Visual Studio 11 actually makes it quite easy.  Right click on the project and click Publish.  This brings up a new dialog prompting you for the URL to your site.  You can specify another SharePoint 2010 server or in our case we’ll specify my URL to a site collection in SPO.

VS11DPPublishSolution

Once you click the Publish button, it will take a few seconds to connect and finally it will prompt you for authentication.

VS11PublishO365Signin

Enter your credentials and the solution will publish soon.  When it is done, you will be taken to the Solutions gallery.  At this point, you need to select the solution and click the Activate button to make your solution available.

VS11DPO365SolutionGallery 

At this point, you can edit any page and find your web part in the list.  I just added it to the home page of the site as you can see in the screenshot below.

VS11DO365SandboxedWebPart

I’ve talked about how to deploy solutions to SharePoint Online in the past and this makes things much easier.  This will definitely reduce development time.  We still have to throw our solution “over the fence”, but at least it’s somewhat automated now.  I can only hope for debugging in the cloud some day. :)

One thing to note is that you still have to do the development on a machine that has SharePoint installed.  I even tried to trick it, but it wouldn’t cooperate. 

Now, you might be thinking this is great and wondering if you should switch to Visual Studio 11 for SharePoint Online development.  At this point, I don’t see any huge risk in doing that, but don’t blame me if things blow up. :)  Make use of source control and backups and you should be able to correct anything that VS11 manages to break.  When you are using source control, I see the worst that could happen is that you might have to go back a version or two in source control.  For the extreme pessimist, I am sure worse could happen, but you always take that risk with pre-release software.

If you haven’t checked out Visual Studio 11 yet, head over to the developer site where you can get the download link and find out everything that’s new.

Comments

# How to: Use Visual Studio 11 to publish solutions to SharePoint Online - Grid User Post - Office 365 Technical Blog - Office 365 - Microsoft Office 365 Community

Pingback from  How to: Use Visual Studio 11 to publish solutions to SharePoint Online - Grid User Post - Office 365 Technical Blog - Office 365 - Microsoft Office 365 Community

# SharePoint Daily » Blog Archive » Selling SharePoint 2010 to Your Enterprise; TechNet Content on Amazon; Windows 8 in October?

Pingback from  SharePoint Daily  » Blog Archive   » Selling SharePoint 2010 to Your Enterprise; TechNet Content on Amazon; Windows 8 in October?

# Selling SharePoint 2010 to Your Enterprise; TechNet Content on Amazon; Windows 8 in October?

Thursday, January 12, 2012 8:16 AM by SharePoint Daily

My photography skills are severely lacking so I always look forward to seeing what others did in the

# Selling SharePoint 2010 to Your Enterprise; TechNet Content on Amazon; Windows 8 in October? – Bamboo Solutions

Pingback from  Selling SharePoint 2010 to Your Enterprise; TechNet Content on Amazon; Windows 8 in October? – Bamboo Solutions

Leave a Comment

(required)
(required)
(optional)
(required)