Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On VS2019, NuGet is eager to update my packages and ends up corrupting my versions #429

Open
astrohart opened this issue May 7, 2023 · 0 comments

Comments

@astrohart
Copy link

astrohart commented May 7, 2023

When I create a new VSIX Community package on VS2019, versions of the extensibility NuGet packages Community.VisualStudio.Toolkit.16 and friends are installed that are compatible with Visual Studio 2019.

However, Microsoft.VSSDK.BuildTools is also installed, and its versions go into 17+. Along the way of creating a recent package project generated by this extension, I got build errors basically because I am trying to use version 17+ of Microsoft.VSSDK.BuildTools with VS2019 when I speculate that v17+ of Microsoft.VSSDK.BuildTools is only compatible with VS2022.

The NuGet infrastructure in VS2019 is very conscientious about making sure I have the correct and updated NuGet packages at all times. And then the project won't build for the reason cited above and it produces really cryptic build errors that took several hours and lots of Googling to hunt down.

To fix this, modify the PackageReference lines in the project file to be thus:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- *** -->
  <ItemGroup>
    <PackageReference Include="Community.VisualStudio.Toolkit.16" Version="16.0.492" ExcludeAssets="Runtime">
      <IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Community.VisualStudio.VSCT" Version="[16.0.29.6, 16.0.29.6]" PrivateAssets="all" />
    <PackageReference Include="Microsoft.VSSDK.BuildTools" Version="[16.10.1055, 16.11.69]" />
  </ItemGroup>
  <!-- *** -->
</Project>

@madskristensen I highly suggest you modify the code of the extension so that it generates the proper package refs. This way I do not have to make this fix each and every time I generate a new extension package project.

I'll be glad to submit a PR.

SCRATCH THAT

I can't submit a PR because I have no clue how this extension actually generates the projects with Visual Studio, as I cloned the forked repo (forked it to my GitHub account first, then cloned it locally) and I could not see a .vstemplate file anywhere.

@madskristensen would you mind terribly updating the code so I get the PackageReferences shown for new projects? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant