Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single Portable File Configuration #45401

Closed
DWishR opened this issue Dec 10, 2024 · 3 comments
Closed

Single Portable File Configuration #45401

DWishR opened this issue Dec 10, 2024 · 3 comments
Labels
Area-CLI untriaged Request triage from a team member

Comments

@DWishR
Copy link

DWishR commented Dec 10, 2024

I am working in an environment where I can expect certain SDKs (like dotnet) to be installed on the host machine. I have a version control system (Perforce) that can run a specified command on the host machine when certain events happen (triggers). The command can reference files within version control, and the version control system will grab the latest version of that file to run the command. I'd love to write the trigger in C#, but I can't find a portable configuration that works with a single file. My choices seem to be:

  • Publish a portable DLL which requires extra configuration files to run (e.g. trigger.deps.json)
  • Publish a platform-specific single binary ("SelfContained" and "PublishSingleFile")

Describe the solution you'd like

I'd love to either:

  • Run a single csharp script directly as a console app (i.e. dotnet simpleScript.cs) -- mostly this
  • Have a single file portable publish configuration that still requires the runtime installed but works with just one file

Additional context

This is basically a "let me use a dotnet/csharp script instead of python" in situations that expect a single file to be functional. I can imagine extending this to #! style console scripts, which I for one would enjoy writing in csharp instead of other languages. Granted compilation will require some amount of startup time, but plenty of systems are compiling python today anyway. This seems like a natural extension of the Top-Level Statements mindset.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Dec 10, 2024
@DWishR
Copy link
Author

DWishR commented Dec 10, 2024

This might be a dupe of #43086 (if so sorry)

@WeihanLi
Copy link
Contributor

I'm drafting a dotnet tool, maybe you can have a try https://github.com/WeihanLi/dotnet-exec

Install the dotnet-tool

dotnet tool update -g dotnet-execute

then you could try dotnet-exec simpleScript.cs

@marcpopMSFT
Copy link
Member

Let's use 43086 as the tracking issue for this. It is something we are having discussions over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants