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

[Vcxproj] Support explicit path to NuGet .targets, and clean up existing packages.config if no longer needed #390

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

StripeRose
Copy link

Context
While attempting to add support for Microsoft.GameInput to my project, I noticed the path to its .targets-file was different to the two paths that were supported by Sharpmake as is. I was unable to find any examples of the same issue being solved previously, or clear ways to alter the path, so I figured adding a way to explicitly define that path could be useful.

Additionally, I noticed the generated packages.config would remain after regenerating the solution having removed all packages from the project.

Description
The change adds a field to supply an explicit .targets-path, which then allows a simplified XML-string to be used to resolve the final .vcxproj line for the import and error. If an explicit path is not defined, the behaviour with the two possible paths is used so previous sharpmake-files still function.

Usage:

conf.ReferencesByNuGetPackage.Add(
	"Microsoft.GameInput",
	"0.2303.22621.3038",
	targetsPath: @"build\native\targets\[packageName].targets"
);

Also changes Vcxproj.GenerateImpl() to run the PackagesConfig generator even if there are no NuGet packages defined, to allow it to clean up existing files that are no longer meant to exist, in case the project is not generated from a clean slate.

Additional info
All regression tests have run fine as far as I can tell, both using the script and via Visual Studio. I couldn't actually locate any specific tests related to vcxproj files though, so I'm uncertain how well covered the changes I've made here are.

StripeRose and others added 9 commits September 14, 2024 15:38
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4.1.7...v4.2.1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ke (ubisoft#384)

Bumps [Basic.Reference.Assemblies.Net60](https://github.com/jaredpar/basic-reference-assemblies) from 1.7.8 to 1.7.9.
- [Release notes](https://github.com/jaredpar/basic-reference-assemblies/releases)
- [Commits](jaredpar/basic-reference-assemblies@v1.7.8...v1.7.9)

---
updated-dependencies:
- dependency-name: Basic.Reference.Assemblies.Net60
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Ensures previously created sharpmake scripts don't suddenly stop compiling, and lets them use the default value instead.
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

Successfully merging this pull request may close these issues.

1 participant