Visual Studio – Pro Tip – Track Active Item in Solution Explorer

Visual Studio Pro Tip

Every time I’m on a new installation of Visual Studio or a new VM (I often quickly ‘generate’ a new VM in order to test things in a clean environment) the first thing I run into is that I just don’t know what’s the file I’m working on and do be more specific, where the file lives in the folder structure of the solution.

Visual Studio has a solution for this, ever since Visual Studio 2005, and it is called Track Active Item in Solution Explorer.

You can find the option in Visual Studio 2017 by going into Tools->Options and search for Solution Explorer. This will give you a couple of entries, now select General under Projects and Solutions and there you have it:

VSTrackActiveItem

You also can go to it directly by going into Tools->Options->Projects and Solutions->General.

If you think this s*cks, just turn it off by unchecking the checkbox before “Track Active Item in Solution Explorer”.

I prefer to check the option to enable it so each time I select a file in one of the tabs, Visual Studio will jump to the location where it is kept in the Solution Explorer!

Office Development – Word Add-in in Visual Studio ‘in action’

Yesterday in my blogpost I showed you the instructions to perform to create your first Word Add-in not by command line tools like I showed earlier, but by using Visual Studio 2017. So here it is:

Boot up your Visual Studio IDE and select File, new Project. In the New Project Dialog select on the left hand of the dialog the tree item Add-ins under the Office/SharePoint node. On the right hand you get options to build Add-ins for Excel, Word, Outlook, PowerPoint and SharePoint.

 FirstVSAddin01

They still call it Web Add-in, if you ask me this name is a bit outdated. I believe the Add-ins are called just Office Add-ins (with the capital A). There was a time these things were called “Apps for Office”. The name used today on the http://dev.office.com website is:

Apps for Office

Where were we? …. Oh, yes … Creating a new project. Name your new project any name you would like to give it, I opted for MyFirstWordAddin. Change the folder if you want to store it somewhere else other than the default project output path and click OK to start creating your project. If all goes well you’ll see the following ‘progress’ bar appearing on your screen.

FirstVSAddin02

It takes a couple of minutes to finish, but when it does it will open a code window like this:

FirstVSAddin03

And another tab was created to show you some helpful links to continue:

FirstVSAddin04

Now it is time to hit F5, the “Visual Studio Compile-Run-Debug Experience”. As we have seen ancient times ago the Office Dev team really tried to hide all the difficult stuff for you and it will create for you the security context to be able to actually run the Word Add-in without going through the hassle I described in other posts creating the Add-in using the command line tools like Yeomen.

The only dialog might get to see in between is this one:

Cert1

A one time only trust entry for your self-signed Localhost certificate. You’ll notice if you create a second project this dialog won’t show again as you already trusted it for your first project. Click Yes otherwise your Add-in won’t be trusted to run. It will create the security context and an instance of Word is created and installed the just created Add-in.

On the top right hand in the Ribbon in the Home Tab a button appears in the Commands Group with some easy instructions. You’ve seen as similar button and instructions on the command line Add-in we created a while ago.

FirstVSAddin05

Click the button to have the Task pane appearing on the right hand. The sample Task pane wants you to select a couple of words in the document and if you press the Highlight button it will calculate the word with the most characters and highlights the word.

FirstVSAddin06

That is all there is to it … no fancy pansy difficult stuff to get around creating certificates and trusting the certificates. It is all done for you by the Visual Studio tooling. Impressive!

Beware however, you are not ready for production – just like the command line Add-in tools, the certificate is self signed, you are not running the ‘ web app’ in a shared (public) location to be able to access from anywhere and anytime. It is still ‘demo-ware’. Hopefully over time we will reach the golden moment of creating ‘production-ware’ Smile

To be continued …

 

 

 

Office Development – Word Add-in – Using Visual Studio

Office Development - Visual Studio

A while ago, not too long, I showed you how to start developing your Word Add-in from scratch using nothing but command line tools. Check my blog archives for the last couple of weeks if you missed that. Today we are looking at the same process but now using Visual Studio.

Where to begin? According to the page: https://dev.office.com/getting-started/addins going through the process of steps you select Word as Add-in host, and Visual Studio as tools to build your Add-in will finally show you the following screen:

image

It is already hopelessly outdated, mentioning to install the Office Developer Tools for Visual Studio 2013 or 2015 while Visual Studio 2017 has been around for quite some time.

The process however is still unchanged for the most part, I will show it in practice in a later blog, but if you follow the three steps you are basically already there, where without Visual Studio and just using the command line tools we had to go through a large series of requirements and certificate fixes to make that work.

Apparently Visual Studio takes a lot of this out of your hands and is doing all that for you. Not completely fair, because with Visual Studio you also need to go through the installation process. I want to find out what this all is and put that in a blog post as well

To be continued …

.NET Core 2.0 Released!

dotnetcore20released

Usually I share the news of the week after our weekly Dutch SDN Cast but I really didn’t want to wait for this as it is just great news that you should hear immediately (if you haven’t already heard from in the social web).

Well, let’s have it:

Announcing .NET Core 2.0
https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-core-2-0/

Announcing .NET Standard 2.0
https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-standard-2-0/

Announcing Entity Framework Core 2.0
https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-entity-framework-core-2-0

Visual Studio 2017 Version 15.3 Released
https://blogs.msdn.microsoft.com/visualstudio/2017/08/14/visual-studio-2017-version-15-3-released/

A whole lot of releases, all more or less related to each other but still, great news!

With .NET Core you get:

  • Fasted version of .NET
  • More (a lot more!) APIs
  • More project templates
  • More distros
  • Simplified packaging
  • New and improved Visual Studio tooling
  • Visual Studio for Mac support

It is way too much to put in one blog post so start with watching the video by Scott Hunter and his team:

[youtube https://www.youtube.com/watch?v=Q2mMbjw6cLA] Have fun and enjoy the new bits!

Office Development–The Bad

clip_image002

Visual Studio Tools for Office (VSTO) is a set of development tools available in the form of a Visual Studio add-in (project templates) and a runtime that allows Microsoft Office 2003 and later versions of Office applications to host the .NET Framework Common Language Runtime (CLR) to expose their functionality via .NET.

Quote: https://en.wikipedia.org/wiki/Visual_Studio_Tools_for_Office

As we have seen in my previous blog post Office Development – The Ugly the first option to build your Office extensions using Visual Basic for Applications (VBA) did not win the beauty contest. A very powerful toolset to create beautiful and especially productive customizations. I’m sure that VBA, the tools to set Office to your hand, allowing you to tailor Office in a way that it perfectly fits the needs of your company, is one of the main reasons that made Office such a popular box of applications.

It was however risky – a potential security risk and code management is a pain. In the real world it happened that a ‘new’ version was rolled into production where all the sudden existing features ‘disappeared’ as a result of the developer picking the ‘wrong file’ containing an older version of the solution and continued developing features using the incomplete version.

This needed to change … in the meantime managed code -.NET- appeared at the horizon and the next option at least had to be a) secure and b) needed an improved source control option.

The solution Microsoft put on the table were the:

Microsoft Visual Studio Tools for the Microsoft Office System.

The product name was most likely the longest name available at that time. The Visual Studio Tools for the Microsoft Office System (VSTO) was architected as a bridge between Visual Studio and The Microsoft Office System. On one side the languages team with Visual Studio, on the other side the Office team and in the middle the VSTO team – code named Trinity …

clip_image004

So how is VSTO different compared to VBA?

Applications, add-ins or document customizations, are built using Visual Studio. Initially in a separate Visual Studio .NET 2003 VSTO SKU and after a few version inserted in the Visual Studio 2008 box. The code no longer lived in the documents or other Office files, but from now on lived in an external assembly that would be triggered by the Office host application if the right properties were available in the document.

Loading the assembly was done in a relative complex manner and it was made sure that security wise the pain seen with VBA would not exist with VSTO add-ins.

Here is a schematic overview of the load pattern:

clip_image005

As you can see the Office Application is looking at the Registry to see what add-ins are installed, if found any the Deployment manifest (pointed to by the Registry) is read and following that the Application manifest is read and the assembly loaded.

A real extension to the Office Application … to make this all secure the security is enforced at installation time. There was a whole slew of prereqs that must be covered before the add-in would be installed:

clip_image006

This part made VSTO the “Bad” in The Good, The Bad and The Ugly … it appeared to be a real pain for the IT Pros at the time. By default, VSTO used Click-Once to install the extension on the machine and a lot went wrong … certificates expired, not added to the Trusted Publisher lists, etc. etc. There was another option, to install an add-in using an .msi installer but the average VBA developer had a hard time getting around all of this, jumping all the hoops to make it work.

Was it all Bad?

Not at all! By using managed code, C# or VB.NET – whatever your preference was, your world of Office completely opened. Whatever you could do with .NET (and that is basically everything) you could add to your solution. Calling third party libraries, UI components, later even XAML UI interfaces, sky is the limit.

For me personally this is still my fav option to build Office customizations. I wasn’t awarded nine-year Visual Studio Tools for the Microsoft Office System MVP – I guess the longest MVP title as well, without reason. VSTO controlled my life for the large part of these years (hopefully my wife is not reading this ) did a lot of forum support in this area and built VSTO applications for large enterprise companies. At the time, we still had on Microsoft campus Software Design Review meetings to share feedback and we gave the team a hard time to make sure they released the features that we really needed.

Where to go next

But … the world changed, Windows is no longer the only platform that needs to be supported. Because of that a new mechanism was proposed. By using the common web standards and JavaScript a platform independent system was developed by providing OfficeJS APIs to access the Office object model from web based add-ins.

And this is where we will dive in soon. It’s a relative new world, although development already started years ago, so there is a lot to learn there. Let’s see if we can do the same with OfficeJS as we can do with VSTO – but now on multiple platforms and several clients.

Maybe I will return to VBA and VSTO in separate blog posts just for fun. There is just a ton of information to share on all off these areas.

Book

Oh, and if you really want to know the ins and outs of VSTO I really recommend you reading the VSTO bibles by Eric Carter and Eric Lippert: Visual Studio Tools for Office 2007: VSTO for Excel, Word and Outlook. It is a huge and heavy piece of reference with over a thousand pages of inside information.

Week 7 SDN Cast News and Party Time!

SDNCast 40

It’s party time! There was even more than one party, a lot to celebrate this week! Obviously, starting with our own fortieth SDN Cast and that’s a number worth mentioning.

But there is more. In 1997, twenty years ago now, Visual Studio was released and this week there was announced that the upcoming version “Visual Studio 2017” will be released starting March 7th in an online event by Microsoft and local events will be organized at various locations around the world between March 7 and April 30th. Look for it in the links below to see if there are any events in your area to go to. We will obviously spend some attention as well on our next SDN Event – March 17, with some sessions in this area.

And we’re not there yet, five years after the first release of Visual Studio Microsoft changed direction by releasing Visual Studio .NET and as the name reveals, birth of .NET. The new way of programming with the new .NET framework. Until that time everyone was working with MFC -Microsoft Foundation Classes- libraries or other technologies. There was a big change in the way we were going to develop and brought many new features, think of the Roslyn language services. This allowed all sorts of new benefits where we haven’t seen the end of it.

A lot of attention for the past, but there is a lot of interesting new stuff to come in the near future. We are looking forward to the release of Visual Studio 2017.

Where can you find SDN Cast 40?
https://youtu.be/zL3CIJTK2sk

Subscribe to our YouTube channel so you won’t miss a single episode. Usually we are broadcasting live on Thursday evening 8PM GMT+1 in the winter but it might change depending on how things go that week. If you want to be sure you better subscribe to our channel on YouTube or go to http://www.sdncast.nl to discover when our next show will be planned. It will show you when the next show is starting.

News of the week

Visual Studio 2017 is coming on March 7
https://launch.visualstudio.com/
https://launch.visualstudio.com/local-events/

TFS 2017 Update 1 RC2
https://blogs.msdn.microsoft.com/bharry/2017/02/13/tfs-2017-update-1-rc2/

Join Us: Visual Studio 2017 Launch Event and 20th Anniversary
https://blogs.msdn.microsoft.com/visualstudio/2017/02/09/visual-studio-2017-launch-event-and-20th-anniversary/

E3 Now open to public, anyone can register 
https://www.e3expo.com/show-info/3197/access-has-been-granted/

Microsoft shares open source system for training drones, other gadgets to move safely on their own

https://blogs.microsoft.com/next/2017/02/15/microsoft-shares-open-source-system-training-drones-gadgets-move-safely

Microsoft cloud services will be compliant with new General Data Protection Regulation for EU when it takes effect in 2018

https://blogs.microsoft.com/on-the-issues/2017/02/15/get-gdpr-compliant-with-the-microsoft-cloud

Announcing UWP Community Toolkit 1.3

https://blogs.windows.com/buildingapps/2017/02/10/announcing-uwp-community-toolkit-1-3

Rider Early Access Program
https://www.jetbrains.com/rider/download/

Building Single Page Applications on ASP.NET Core with JavaScriptServices
https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/

Welcoming Jon Galloway as the new Executive Director of the .NET Foundation
https://dotnetfoundation.org/blog/welcoming-jon-galloway-as-the-new-executive-director-of-the-net-foundation

Happy 15th Birthday .NET!
https://blogs.msdn.microsoft.com/dotnet/2017/02/13/happy-15th-birthday-net/

Events

Upcoming events

Visual Studio 2017 Launch, March 7-8 – Online
https://launch.visualstudio.com/

Visual Studio 2017 Local Events, March 7 – April 30th
https://launch.visualstudio.com/local-events/

SDN Event 1 – Zeist – March 17, 2017
https://www.sdn.nl/EVENTS/17-maart-2017
You can already register, so put it in your scheduler and register!

Microsoft Tech Summit – Amsterdam, March 23-24, 2017
https://www.microsoft.com/en-us/techsummit
https://www.microsoft.com/nl-nl/techsummit/amsterdam.aspx

Build – May 10-12, 2017 – Seattle
http://build.microsoft.com

Techorama – May 22-24, 2017 – Antwerpen, Belgium
http://techorama.be/

NDC Oslo – June 12-16 2017 – Oslo
http://ndcoslo.com

SDN Event 2 – Zeist – June 23, 2017
www.sdn.nl

Ignite 2017 – September 25-29 – Orlando
https://ignite.microsoft.com

SDN Event 3 – Zeist – October 6
www.sdn.nl

We hope you like to watch our SDN Casts. We try to keep up with the news in about an hour a week. You hear what is new and get fun demos on technology and Software Development that you can use in your daily job.

Don’t forget to Subscribe to our channel as we can get a better URL to remember our channel if we reach the number of subscribers needed to add this and make your and our lives a bit easier! And if you haven’t heard if you are the number 100 Subscriber you get something in return! Subscribe: https://www.youtube.com/channel/UC3oE_YPB4AJVQSInC-yy3pw?sub_confirmation=1

Go to the website and check when our next broadcast will be!
http://www.sdncast.nl.

Under Review: Change Icon for Visual Studio 2015

Just after the release of Visual Studio 2015 I ran into the issue where I had a couple of previous Visual Studio versions installed (due to the fact that I had to support software products built on these Visual Studio versions using features that only were available in these specific versions) and apparently Microsoft decided -not- to change the icon for this version.

Now I had on my taskbar four versions (2010, 2012, 2013 and 2015) and the latest two versions displayed an identical icon making it hard to identify the right version and caused me to click the wrong version on several occasions.

So I filed a uservoice request to change this ‘feature’ and make it more obvious to start the right version (for that moment in time).

Obviously many responses were entered on how easy it is to change it yourself… Yes, I was already aware of this but the writers of this comments are forgetting that I am not the only one, so many, many, many users all had to go through the same little steps. Also reinstalling, or just installing on other machines required you to do the same time-wasting little thing to get something that should be there in the first place: a recognizable icon pointing to the right application.

Currently the status of the request (1191 votes to get this changed) has been edited by the team and is now changed into “Under Review”. Hopefully this will mean that they will put in the minor effort to change the icon for the next ‘service release’/sprint/version making your developer life just a little bit better.

The voting is still open, so if you ran into this issue like I did, throw in a couple of votes! :
Change Icon for Visual Studio 2015

VSTO Runtime Update (10.0.50325)

The Visual Studio Developer Division just announced a new version of the VSTO (Visual Studio Tools for the Office System) Runtime (10.0.50325).

One of the issues, the one when using WPF controls caused a massive delay in closing Office applications, I worked close with the team to test and get this solved. The issue also reported on Connect was a hard one to fix as it depended on many factors such as Touch Screen interfaces and appeared on previous versions of the Runtime.

The second issue addressed by this update covers the publisher’s name and verification status to show properly when using SHA256 code-signing certificates where the Trust Prompt at first displayed “Unknown Publisher” even when the publisher was fully trusted.

Read more about the Runtime Update at the blog from the VSTOTeam located at:
VSTO Runtime Update to Address Slow Shutdown and “Unknown Publisher” for SHA256 Certificates 

You can download the latest version of the VSTO Runtime at http://go.microsoft.com/fwlink/?LinkId=140384 and will be distributed as part of Windows Update.

I for one am very happy to see this solved and released to the public. Our enterprise firm encountered the WPF issue on a large scale just after deploying our top of the bill new laptops to all of our users and would like to thank the VSTO Team for working with us to get this out of the way! We really spent a huge amount of hours in this to cover all the scenarios we could think of in both new and older (existing) add-ins.

Showtime: The Book Thief

The Book Thief


The “Showtime” section on my blog is a reminder, mostly for my own reference but maybe helpful for other film enthusiasts as well, to remember what movies I’ve seen lately, what it was about and how I rated it in general.


The Book Thief is about a little girl, unable to read and write at her early years to be abandoned by her mother in times of war in the 1930’s. While living at her foster parents home she learns to read and write and especially gets the affection to read books. To be able to read books she steals (or borrows) the books and was called “The Book Thief” by one of her neighbor boys.

the perspective of a German family in war time isn’t used in many films. Especially a family giving shelter to a Jewish refugee in a city of Germany is a less common thing to project.

The movie is highly (maybe over-)dramatized, displaying some intense situations people had to go through when the world was at war. Although the level of dramatization could be a bit less overall it is a touching story. The girl playing Liesel Meminger (Sophie Nélisse) is a rising star and I think we haven’t seen the last of her yet.

I expected the movie, given the amount of nominations, to be somewhat better and rate it a high six out of ten.

%d bloggers like this: