dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.07k stars 4.04k forks source link

Usability of CSC command. #33386

Open migueldeicaza opened 5 years ago

migueldeicaza commented 5 years ago

Nowadays the csc command is mostly useful as a backend tool to MSBuild and is rarely used from the command line as we have made things a tiny bit complicated for our users to just type.

This is a request to add two capabilities to csc that would allow csc to be used by normal people that might want to easily use the compiler without having to rely on producing MSBuild projects to compile code that conforms to certain scenarios.

Extending -target:

The -target: option should allow users to specify a profile that they want to target when creating libraries, and it would support flags like netstandard1.0, netstandard2.0, netstandard2.1 and so on.

This would merely be an alias for -target:library and -r:EveryAssemblyThatIsPartOfThatProfile.

This would allow the creation of .NET Standard libraries with little effort.

Simple NuGet support: -package: flag.

We would add support for referencing simple NuGet packages.

The flag -package:NAME would use the reference assembly for the specified package name on one of the predetermined locations where the NuGet packages are stored, or a path specified by the -packagepath:DIR argument.

The -packagepadd:DIR argument would prepend the specified PATH to the lookup that would be performed for finding the specified package.

If the package is a complicated NuGet (for example, of the bait-and-switch nature or other packages that require post processing), we would print out an error explaining that this scenario is not supported.

tmat commented 5 years ago

Why not just use dotnet CLI? dotnet new, dotnet build, etc.