jberezanski / ChocolateyPackages

Chocolatey packages maintained by me
MIT License
86 stars 52 forks source link

create visualstudiobuildtoolspreview package #57

Closed bgshrimp closed 5 years ago

bgshrimp commented 5 years ago

Given the new release cadence from microsoft, it would be good to have a visual studio build tools package that picks up the latest preview release. For open source app developers, this provides a way to automate testing their applications with the latest VS headers/libs to get a jump on issues before the next RTM release.

jberezanski commented 5 years ago

There is already a way to install the latest preview releases using the regular packages; all that is needed are appropriate values of channelId, channelUri and productId:

cinst -y visualstudio2017buildtools --package-parameters "--productId Microsoft.VisualStudio.Product.BuildTools --channelId VisualStudio.15.Preview --channelUri https://aka.ms/vs/15/pre/channel"

The drawback currently is that the packages will probably not install cleanly side-by-side with the official, non-preview VS products (the packages may try to update an existing, non-preview VS instance, for example), so I recommend doing it on a separate machine. In order to handle this correctly, I will need to do some research on how the native VS installer distinguishes between product "families" (in order to, for example, pick a different default install path for preview releases).

jberezanski commented 5 years ago

Now, on the topic of designing the preview packages:

  1. The preview products install side by side with the non-preview ones, so package ids should certainly be different.
  2. So, what the new package ids should be?
    • The preview products install by default to a directory which does not have the Visual Studio year in its path ($Env:ProgramFiles(x86)\Microsoft Visual Studio\Preview\\), so the package id should probably not contain the year, even though channelId and channelUri contain the VS major version number (currently 15).
    • visualstudiobuildtoolspreview looks fine, but the chocolatey.org moderators might object due to its length and lack of hyphens (I had a hard time convincing them to agree to the current ids). visualstudiobuildtools-preview could be used as an alternative.
  3. What should the versioning scheme be?
    • "normal" versions, e.g. "15.9.0.0"?
    • how to distinguish between subsequent previews of 15.9.0? perhaps by package fix version notation - "15.9.0.20181126"?
    • prerelease versions, e.g. "15.9.0.0-preview6", requiring an explicit --pre argument to choco install? this would align more with the internal Microsoft naming of the releases (vswhere.exe returns catalog_productSemanticVersion = "15.9.0-pre.6.0+28307.53", catalog_productDisplayVersion = "15.9.0 Preview 6.0") - in that case, how to version the package fixes? (15.9.0.20181126-pre5 would be treated as newer than 15.9.0.20181111-pre6, but conceptually it should not be, as it would represent a bugfix to the package for preview 5 - an older preview than preview 6)

Need to think about it some more ;-)

jberezanski commented 5 years ago

Example vswhere.exe output, for comparison:

vs_BuildTools_preview_example.txt vs_FeedbackClient_release_example.txt

bgshrimp commented 5 years ago

Hi. We don't necessarily have a requirement for side-by-side installation support so I will try your suggestion to install latest preview.

If you didn't already know, VS2017 15.9 is the last minor update for vs2017. VS2019 preview releases are expected to be available next month. Having preview release support for vs2019, once available, would definitely be beneficial. I'm hoping simply providing an updated channelId and Uri would allow us to continue to use this solution.

jberezanski commented 5 years ago

There are now experimental prerelease packages available for VS 2017 Preview and VS 2019 Preview for Build Tools and Enterprise: https://chocolatey.org/packages/visualstudio2017buildtools-preview https://chocolatey.org/packages/visualstudio2017enterprise-preview https://chocolatey.org/packages/visualstudio2019buildtools-preview https://chocolatey.org/packages/visualstudio2019enterprise-preview

The packages themselves are marked as prerelease, because supporting preview releases required several nontrivial modifications to the installation logic (chocolatey-visualstudio.extension) and I haven't been able to test it as thoroughly as I would like yet.

There is also an issue with the default install path of Build Tools 2019 being set (by Microsoft) to be the same as for Enterprise 2019, so installing both packages on a single machine requires selecting a custom path for one of these packages.

So, here are choco commands:

cinst -y dotnetfx --version 4.7.2 # installing it first will help to ensure reliable VS installation
Restart-Computer # if needed
cinst -y visualstudio2017buildtools-preview --pre
cinst -y visualstudio2017enterprise-preview --pre
cinst -y visualstudio2019buildtools-preview --pre --params "--installPath C:\VS2019PreBT"
cinst -y visualstudio2019enterprise-preview --pre

I haven't found time to prepare the workload packages yet. (By design, the existing workload packages work on the official/non-preview products only.)

jberezanski commented 5 years ago

Preview packages are available for all VS 2019 products now.