Skip to content

Fix expanding template expressions from defaultDestination for CLI install #822

Merged
dbreshears merged 4 commits intoaspnet:mainfrom
jimmylewis:cliDestTemplate
Apr 21, 2026
Merged

Fix expanding template expressions from defaultDestination for CLI install #822
dbreshears merged 4 commits intoaspnet:mainfrom
jimmylewis:cliDestTemplate

Conversation

@jimmylewis
Copy link
Copy Markdown
Contributor

Apply the same expansion when installing libraries whether the manifest is from disk or generated in memory. (CLI updates the manifest on disk after the install succeeds.)

Some extras:

  • turned off preference for var when the type is apparent. Since we don't use var through the majority of the code, this was distracting.
  • Added a workaround for running the CLI integration tests when a workaround is in place for Unable to build the project locally #728. Apparently if a parent directory's nuget.config configures packageSourceMappings, there isn't a way to turn it off in a child directory's nuget.config.

Resolves #821

When originally added, it was only expanded when we were loading the LibraryInstallationState from disk/JSON to memory.  In the CLI install scenario, we want to apply the same expansion when the LibraryInstallationState is generated from parameters (not read from disk).

Note: only the defaultDestination value is allowed to use templated values.

Also cleaned up some confusing or redundant checks for the installation destination in the CLI Install command.  It now has a simpler flow to allow null/empty values if there is a default specified.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Linq;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this can be removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed for net481 (for string.Contains(char))

@dbreshears dbreshears merged commit 2aed015 into aspnet:main Apr 21, 2026
2 checks passed
@jimmylewis jimmylewis deleted the cliDestTemplate branch April 21, 2026 21:02
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.

defaultDestination's [Name] [Version] expansion no longer works for LibMan CLI

2 participants