Start Using Visual Studio Live Share

Before getting into this post, do yourself a favor and download the extension for Visual Studio Live Share.  There is a version for Visual Studio 2017 (15.6 or higher, but recommend 15.7 which just released this week) or Visual Studio Code (1.22 or higher).

Background

Back in November 2017 the Visual Studio team announced a new feature called Live Share (blog post) that allows a team to collaborate on the same codebase using the same development tools, settings, or environment.  When I first heard about this I thought to myself “no thanks, I’m fine with screen-sharing through Skype / Sococo / Google Hangouts / etc. for real-time collaboration on code projects.”

A few weeks later I listened to Scott Hanselman’s Hanselminutes podcast on “Revolutionizing remote pair programming with Live Share” and realized what I was missing.  Screen sharing works when both users have a copy of the same codebase (re: checked-in to source control, shared permissions, etc.) but what happens when you want to collaborate with someone who doesn’t have access to the codebase?  Or the codebase is rather large to download?  Or the bandwidth needed to screen-share a 4k monitor display is causing poor performance on the screen-share session?  And on and on with limitations.

Problems Solved

Visual Studio Live Share solves a number of these issues:

  • Allows you to share with anyone simply by giving them a link
  • Files that are interacted with from the source projects are temporarily cached on the target machine in real-time (i.e. doesn’t download the entire project at start)
  • Doesn’t require the person sharing with to have the same extensions, developer tools, etc. installed
  • Allows real-time 2-way collaboration and debugging (the latter is a huge deal)
  • Reduces network bandwidth used by only sends minimal data like cursor position and typed characters (i.e. doesn’t push 1080p or 4k monitor worth of pixels across the network)
  • And much more…

Walkthrough

You can watch the videos the Live Share team has put together but I’m also sharing a couple quick screenshots from my testing with my peer Ken Kilty yesterday.  I’ll be showing Visual Studio 2017 but Visual Studio Code is also available.

Note: ensure that you follow the instructions for allowing Live Share to work through the firewall if you have one enabled on your device.

Open a project / folder.  Click the Share button in upper right corner.

VSLiveShare3

After sending the link to the person(s) you want to collaborate with they will see a screen similar to the following.  Clicking the link they can choose which application to launch.

VSLiveShare1

You can share with multiple people and even cross collaborate on different IDEs with one user using Visual Studio 2017 while the other is using Visual Studio Code.

VSLiveShare2

Conclusion

I’m still exploring the capabilities of Visual Studio Live Share such as “follow me”, shared terminal, remote debugging, shared servers, and more.  You can read up on the documentation as well.  Live Share is currently in preview but I already see a number of scenario where this will be extremely useful for working with peers, customers, and beyond.  Give it a try today and let me know in the comments if you have any feedback or questions.

 

-Frog Out

Be Careful Installing .Net 4.6 / Visual Studio 2015 with SharePoint 2013 (July 2015)

<Update 2016/09/13>

Please see the following Microsoft support article for resolving this issue.

SharePoint 2013 or Project Server 2013 Setup error if the .NET Framework 4.6 is installed

https://support.microsoft.com/en-us/kb/3087184

</Update>

<Update 2015/7/28 2:30pm>  I received clarification that the SharePoint product group does support installing .Net 4.6 onto an existing SharePoint 2013 farm server.  It is the installer for SharePoint 2013 that will fail to detect .Net 4.5 if .Net 4.6 is already installed and thus throw an error.  A future update should correct this scenario with the installer.

 

   On a related note I was able to successfully uninstall .Net 4.6 from a server (remove the KB as mentioned at bottom of this post) and then install SharePoint 2013.

</Update>

 

   Quick publish on this item and I’ll update once I have more details.  One of my customers is exploring Visual Studio 2015 / .Net 4.6 which was just released a week or two ago.  During some testing I found out that (as of July 28 2015 when this is published) you cannot install SharePoint 2013 binaries onto a server that has .Net 4.6 (or Visual Studio 2015 which includes .Net 4.6) installed.  I received the below error message.

Net46andSP2013

   Since .Net 4.6 is an in-place upgrade of .Net 4/4.5/4.5.1/4.5.2 SharePoint has an issue with finding .Net 4.5.x after applying 4.6.  I am testing out removing the associated KB for .Net 4.6 to see if this is reversible should you accidentally deploy this to a dev / test farm.  I’m also testing if you can install .Net 4.6 / Visual Studio 2015 onto an existing SharePoint 2013 farm.

 

Removing associated KB…

  • On Windows Vista SP2 / Windows 7 SP1/ Windows Server 2008 SP2 / Windows Server 2008 R2 SP1, you will see the Microsoft .NET Framework 4.6  as an installed product under Programs and Features in Control Panel.
  • On Windows 8 / Windows Server 2012 you can find this as Update for Microsoft Windows (KB3045562) under Installed Updates in Control Panel.
  • On Windows 8.1 / Windows Server 2012 R2 you can find this as Update for Microsoft Windows (KB3045563) under Installed Updates in Control Panel.

Download .Net framework

https://msdn.microsoft.com/en-us/library/5a4x27ek(v=vs.110).aspx

 

    Hopefully this helps someone before they run into issues with their farm.  Feel free to leave a comment if you find out any additional details or workarounds.

 

      -Frog Out

Guest Post: Instantiate SharePoint Workflow On Item Deleted

In this post, guest author Lucas Eduardo Silva will walk you through the steps of instantiating a workflow using an item event receiver from a custom list.  The ItemDeleting event will require approval via the workflow.

Foreword

As you may have read recently, I injured my right hand and have had it in a cast for the past 3 weeks.  Due to this I planned to reduce my blogging while my hand heals.  As luck would have it, I was actually approached by someone who asked if they could be a guest author on my blog.  I’ve never had a guest author, but considering my injury now seemed like as good a time as ever to try it out.

About the Guest Author

Lucas Eduardo Silva (email) works for CPM Braxis, a sibling company to my employer Sogeti in the CapGemini family.  Lucas and I exchanged emails a few times after one of my  recent posts and continued into various topics.  When I posted that I had injured my hand, Lucas mentioned that he had a post idea that he would like to publish and asked if it could be published on my blog.  The below content is the result of that collaboration.

The Problem

Lucas has a big problem.  He has a workflow that he wants to fire every time an item is deleted from a custom list. He has already created the association in the “item deleting event”, but needs to approve the deletion but the workflow is finishing first. Lucas put an onWorkflowItemChanged wait for the change of status approval, but it is not being hit.

The Solution

Note: This solution assumes you have the Visual Studio Extensions for Windows SharePoint Services (VSeWSS) installed to access the SharePoint project templates within VIsual Studio.

1 – Create a workflow that will be activated by ItemEventReceiver.

clip_image002

2 – Create the list by Visual Studio clicking in File -> New -> Project. Select SharePoint, then List Definition.

clip_image004

3 – Select the type of document to be created. List, Document Library, Wiki, Tasks, etc..

clip_image006

4 – Visual Studio creates the file ItemEventReceiver.cs with all possible events in a list.

clip_image008

5 – In the workflow project, open the workflow.xml and copy the ID.

6 – Uncomment the ItemDeleting and insert the following code by replacing the ID that you copied earlier.

//Cancel the Exclusion 

properties.Cancel = true;


//Activating Exclusion Workflow

SPWorkflowManager workflowManager = properties.ListItem.Web.Site.WorkflowManager;


SPWorkflowAssociation wfAssociation =

    properties.ListItem.ParentList.WorkflowAssociations.

    GetAssociationByBaseID(new Guid("37b5aea8-792a-4ded-be25-d283d9fe1f9d"));


workflowManager.StartWorkflow(properties.ListItem, wfAssociation, wfAssociation.AssociationData, true);


properties.Status = SPEventReceiverStatus.CancelNoError;

7 – properties.Cancel cancels the event being activated and executes the code that is inside the event. In the example, it cancels the deletion of the item to start the workflow that will be active as an association list with the workflow ID.

8 – Create and deploy the workflow and the list for SharePoint.
9 – Create a list through the model that was created.
10 – Enable the workflow in the list and Congratulations!

Every time you try to delete the item the workflow is activated.

TIP: If you really want to delete the item after the workflow is done you will have to delete the item by the workflow.

this.workflowProperties.Site.AllowUnsafeUpdates = true;

this.workflowProperties.Item.Delete();

this.workflowProperties.List.Update();

Conclusion

In this guest post Lucas took you through the steps of creating an item deletion approval workflow with an event receiver.  This was also the first time I’ve had a guest author on this blog.  Many thanks to Lucas for putting together this content and offering it.  I haven’t decided how I’d handle future guest authors, mostly because I don’t know if there are others who would want to submit content.  If you do have something that you would like to guest author on my blog feel free to drop me a line and we can discuss.  As a disclaimer, there are no guarantees that it will be published though.  For now enjoy Lucas’ post and look for my return to regular blogging soon.

-Frog Out

<Update 1> If you wish to contact Lucas you can reach him at luesilva1102@gmail.com </Update 1>

Adding Intellisense for SharePoint 2010 Custom Workflow .Actions File

    This post will show you how to add inteliisense support for custom workflow .actions files in SharePoint 2010.  During the course of some research for my writing I found out that the SharePoint 2010 SDK doesn’t include intellisense for the .actions files (at least as of the August 2010 release).  As the schema can be a bit difficult to remember off I searched the interwebs to see if anyone had implemented this already.  As luck would have it I was able to find this blog post that included an XSD file, but no instructions on how to install it.  That’s where I’ll help you fill in the gaps.

Steps

  1. Download schema file
  2. Rename schema file from .xml to .xsd
  3. Copy schema file to Visual Studio directory
  4. Update SharePoint catalog files

    First thing to do is download the wssactions.xml file from this location and rename it to wssactions.xsd.  Copy the file to your Visual Studio 2010 XML templates folder which is typically something like “C:Program Files (x86)Microsoft Visual Studio 10.0XMLSchemas”.  Next open the SharePoint catalog files (WssSchemaCatalog64.xml and WssSchemaCatalog.xml) and insert the below child element into the SchemaCatalog element for both.

<Association extension=”actions” schema=”%InstallRoot%/xml/schemas/wssactions.xsd” />

    Once you have completed this you’re all set to go.  No need to even re-launch Visual Studio 2010.  Create a new .xml file named <some_name>.actions.  You should be able to begin receiving intellisense for your workflow action definition file.

Conclusion

    In just a few short minutes you too can have intellisense for your SharePoint 2010 custom .actions files.  Special thanks to the author of the blog with the schema file download (I wasn’t able to find out the author’s name).  Also thanks to Dave Kehring for a template for what and where to add to the catalog files.  Hopefully this will help you get up and running SharePoint 2010 custom actions quicker and more effectively.  Enjoy!

 

      -Frog Out