Is your feature request related to a problem?
I used to write lots of small standalone tools in scripting languages like bash and python. Since file based apps, though, I am trying to start using .NET for the tools.
I created one called ~/bin/collect-npm-packages.cs (~/bin is in my $PATH, meaning I can run this file directly by name). It look like any other script on Linux:
#!/usr/bin/env -S dotnet --
if (args.Length > 0)
...
And I run it as:
$ mkdir ~/test-directory
$ cd ~/test-directory
$ collect-npm-packages.cs .
And it works fine in the brand new directory called test-directory.
Then I tried to run this tool in a checkout of https://github.com/dotnet/aspnetcore/ (branch release/9.0):
$ collect-npm-packages.cs .
The command could not be loaded, possibly because:
* You intended to execute a .NET application:
The application '--' does not exist or is not a managed .dll or .exe.
* You intended to execute a .NET SDK command:
A compatible .NET SDK was not found.
Requested SDK version: 9.0.118
global.json file: aspnetcore/global.json
Installed SDKs:
11.0.100-preview.4.26230.115 [/usr/lib64/dotnet/sdk]
Install the [9.0.118] .NET SDK or update [aspnetcore/global.json] to match an installed SDK.
Learn about SDK resolution:
https://aka.ms/dotnet/sdk-not-found
In other words, even though the file based app works fine when invoked directly in another directory, when it sees a global.json, it starts behaving differently. This makes it difficult to use lots of small file-based apps as generic tools.
This is similar to dotnet run should ignore Directory.Build.props and Directory.Build.targets #52804
Describe the solution you'd like
Is there some way to say "opt out of reading global.json"?
Alternatives you've considered
No response
Additional context
No response
Is your feature request related to a problem?
I used to write lots of small standalone tools in scripting languages like bash and python. Since file based apps, though, I am trying to start using .NET for the tools.
I created one called
~/bin/collect-npm-packages.cs(~/binis in my$PATH, meaning I can run this file directly by name). It look like any other script on Linux:And I run it as:
And it works fine in the brand new directory called
test-directory.Then I tried to run this tool in a checkout of https://github.com/dotnet/aspnetcore/ (branch
release/9.0):In other words, even though the file based app works fine when invoked directly in another directory, when it sees a
global.json, it starts behaving differently. This makes it difficult to use lots of small file-based apps as generic tools.This is similar to dotnet run should ignore Directory.Build.props and Directory.Build.targets #52804
Describe the solution you'd like
Is there some way to say "opt out of reading global.json"?
Alternatives you've considered
No response
Additional context
No response