Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ internal async Task<NewCommandStatus> EnterInstallFlowAsync(InstallCommandArgs a

foreach (string installArg in args.TemplatePackages)
{
string[] split = installArg.Split(["::"], StringSplitOptions.RemoveEmptyEntries).SelectMany(arg => arg.Split('@', StringSplitOptions.RemoveEmptyEntries)).ToArray();
bool isPath = File.Exists(installArg) || Directory.Exists(installArg);
string[] split = isPath ? new[] { installArg } : installArg.Split(["::"], StringSplitOptions.RemoveEmptyEntries).SelectMany(arg => arg.Split('@', StringSplitOptions.RemoveEmptyEntries)).ToArray();
string identifier = split[0];
string? version = split.Length > 1 ? split[1] : null;
foreach (string expandedIdentifier in InstallRequestPathResolution.ExpandMaskedPath(identifier, _engineEnvironmentSettings))
Expand Down
17 changes: 17 additions & 0 deletions test/dotnet-new.Tests/DotnetNewInstallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ public void CanInstallRemoteNuGetPackage_LatestVariations(string separator)
Assert.Equal(command1.StdOut, command3Out);
}

[Fact]
public void CanInstallToPathWithAt()
{
string path = Path.Combine(Path.GetTempPath(), "repro@4");
try
{
Directory.CreateDirectory(path);
new DotnetCommand(_log, "new", "console", "-o", path, "-n", "myconsole").Execute().Should().Pass();
new DotnetCommand(_log, "add", "package", "--project", Path.Combine(path, "myconsole.csproj"), "Microsoft.Azure.Functions.Worker.ProjectTemplates", "-v", "4.0.5086", "--package-directory", path).Execute().Should().Pass();
new DotnetCommand(_log, "new", "install", Path.Combine(path, "microsoft.azure.functions.worker.projecttemplates/4.0.5086/microsoft.azure.functions.worker.projecttemplates.4.0.5086.nupkg")).Execute().Should().Pass();
}
finally
{
Directory.Delete(path, recursive: true);
}
}

[Theory]
[InlineData("-i")]
[InlineData("install")]
Expand Down
Loading