Skip to content

Properties provided to dotnet run are also tunneled through to the application regardless of double dash (--) with .NET 5 #22133

@ThomasMader

Description

@ThomasMader

The problem can be easily reproduced by running:

dotnet run --project <pathToCsprojFile> -p:Version=1.0.0 -- Parameter1

The project which is started by the dotnet run command should contain the following file:

using System;

namespace Test
{
	internal class ListProgramArguments
	{
		internal static void Main(string[] args)
		{
			Console.WriteLine($"Args provided: {string.Join(", ", args)}");
		}
	}
}

If the dotnet run command is executed via .NET sdk 5.0.402 the output is wrong:

Args provided: Version=1.0.0, Parameter1

If it is run with .NET 6.0.100-rc.2.21505.57 it's correct:

Args provided: Parameter1

To me it looks like this behavior should be ported to .NET 5. The documentation https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-run describes that this should work and since it works in .NET 6 I wondered if that was caused by a forgotten backport or if it was a conscious decision because of some breaking change concerns or something like that.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions