dotnet / NuGet.BuildTasks

The build tasks used to pick up package content from project.lock.json.
MIT License
44 stars 60 forks source link

Fix installation path #140

Closed tmeschter closed 2 years ago

tmeschter commented 2 years ago

In the "main" branch, our setup authoring (in files.swr) installs a couple of our .props and .targets files to "\MSBuild\Microsoft\NuGet\16.0". This is the wrong path, as other MSBuild files try to import those .props and .targets files from "\MSBuild\Microsoft\NuGet\.0". As a result these files won't be imported, and non-SDK-style projects attempting to use PackageReference-style NuGet will be very broken. Specifically, they won't read the project.assets.json file and so most reference information will be missing.

The fix here is to stop hard-coding the VS major version in file.swr and instead compute the value from a single source.

  1. In Versions.props we split VersionPrefix into MajorVersion and MinorVersion properties.
  2. In Microsoft.NuGet.Build.Tasks.Setup.csproj we expose MajorVersion to files.swr by creating a SwrProperty item of the same name.
  3. In files.swr we consume this new MajorVersion property.

Now, when we update the major version in Versions.props the setup authoring will be updated as well.

tmeschter commented 2 years ago

Note that the version of this component currently in VS was built from the dev17.0.x branch, where the version number is hard coded to 17.0 instead of 16.0 in files.swr. Now that we're trying to insert newer builds from the main branch with fixes for 17.2 we're running into failures related to the incorrect file path.