haacked / Encourage

A bit of encouragment added to Visual Studio
75 stars 32 forks source link

Add Visual Studio 2017 Support #41

Closed rprouse closed 7 years ago

rprouse commented 7 years ago

The RC and RTM releases of Visual Studio require v3 VSIX format, so the previous changes to enable support no longer work. The following is the screenshot from the marketplace,

image

Converting the VSIX to v3 format is easy, add Prerequisites,

<Prerequisites>
  <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25904.2,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>

This allows Visual Studio to install missing components if required. This extension likely doesn't need much more than the shell/core editor, so the code above is fine.

haacked commented 7 years ago

If I do this, will it still be back compatible with previous versions of VS? I'm hoping to avoid multiple VSIX packages.

jcansdale commented 7 years ago

It looks like VSIX v3 works with VS 2012 and later: https://docs.microsoft.com/en-us/visualstudio/extensibility/faq-2017#what-is-the-backwards-compatibility-story-for-extensions

You can actually use VSIX v2 in 2015 / 2017 if you install with a MSI (that's what TestDriven.Net does). I certainly wouldn't recommend that though! It still runs as an old school add-in in VS 2008. ;-)

rprouse commented 7 years ago

@Haacked that was our worry upgrading the NUnit VS adapter, but it isn't a problem. The v3 format is additive. The extra XML is ignored by older versions.

Sorry, I would submit a PR, but I am struggling with porting various NUnit projects to .NET Core at the moment 🤷‍♂️

rprouse commented 7 years ago

One thing I missed in the instructions, you need to add the NuGet package Microsoft.VSSDK.BuildTools to the VSIX project to pull in required build targets.

Hope we can get this, I really miss the pithy comments whenever I save, https://gist.github.com/rprouse/a44d687030bc741435f0

haacked commented 7 years ago

Thanks for the tips!

haacked commented 7 years ago

So I get the following in VS 2015.

The "GetExtensionsPath" task failed unexpectedly. 1>C:\dev\play\encourage\packages\Microsoft.VSSDK.BuildTools.15.0.26201\tools\VSSDK\Microsoft.VsSDK.targets(621,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Settings.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. 1>C:\dev\play\encourage\packages\Microsoft.VSSDK.BuildTools.15.0.26201\tools\VSSDK\Microsoft.VsSDK.targets(621,5): error MSB4018: File name: 'Microsoft.VisualStudio.Settings.15.0, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 1>C:\dev\play\encourage\packages\Microsoft.VSSDK.BuildTools.15.0.26201\tools\VSSDK\Microsoft.VsSDK.targets(621,5): error MSB4018: at Microsoft.VsSDK.Build.Tasks.GetExtensionsPath.Execute() 1>C:\dev\play\encourage\packages\Microsoft.VSSDK.BuildTools.15.0.26201\tools\VSSDK\Microsoft.VsSDK.targets(621,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\dev\play\encourage\packages\Microsoft.VSSDK.BuildTools.15.0.26201\tools\VSSDK\Microsoft.VsSDK.targets(621,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

rprouse commented 7 years ago

@Haacked best guess, you need to install the Visual Studio extension development components. It is near the bottom if you Update your Visual Studio 2017 install,

image

rprouse commented 7 years ago

Sorry, missed the 2015. Pretty sure you need to build in 2017 or at least have it installed.

jcansdale commented 7 years ago

https://github.com/github/VisualStudio/pull/918/files

jcansdale commented 7 years ago

Have a look at the conditional .Props and .Targets we're doing in the .Csproj. Also the package name is different on VS 2017, which initially threw me. This allows the solution to be developed in both VS 2015 and 2017.