Back to General discussions forum
Hi, Is there a way to upgrade to more recent .NET 10 or 11-preview runtime/SDK? For my taste version 7.0 looks quite old
https://mcr.microsoft.com/en-us/artifact/mar/dotnet/sdk/tags
P.S. Somehow C# became C in the title of this topic
Oleksi, Hi!
And thanks for highlighting this. Regretfully I never was close to C# ecosystem so obviously missed that it should be
updated.
I'll have a look at it. Our sandbox uses docker and linux so it is going to be Mono-based version but probably it
also has some new versions.
Somehow C# became C
Ah, yes, sorry for that. Titles are stripped of most punctuation characters due to some old logic in the forum-service code. Probably this should be reviewed/amended also :) For now I modified the title for clarification.
UPD well, I see now why it stuck on that old version - the mentioned Mono project haven't evolved further.
Meanwhile it seems Microsoft provides .NET for linux so I need to dive deeper and try that and see how it could/should
be installed. I'll be back...
Probably it works now, I rely on your help to test it.
It should be recent "preview" version.
Regretfully build is notably slow - or perhaps I don't know how to do it right. I'll outline it here in case you or other colleagues may give some advice.
dotnet which is used in the following commandsdotnet build program.cs to build a single-file as a temporary project (as I understand it)dotnet run --no-build program.cs to run it thenBuild phase takes quite several seconds. Moreover when it is done for the first time it does restore as I understand,
i.e. initial setup of directories for project and whole dotnet installation, and downloads some dependencies (?) - so I
tried to pre-run this once with dummy file when creating image for the container, in hope that second build (when user
sends the real code) will be faster.
This all is amended by some heap of environment variables and settings to allow it to run properly in docker and with non-privileged user.
Well, anyway, it looks like working at last :)
P.S. it would be good to switch it to stable version when it is ready - so notify me please if I miss it!
I tested c-sharp code it now works fine. Thanks. Still have not tested with another file-based project approach, maybe will do it sometime. https://learn.microsoft.com/en-us/dotnet/core/sdk/file-based-apps
I know that when you use: dotnet ./<somethingAlreadyCompiled.dll>
to run an app it is usually faster than using dotnet run.
There is a "--no-restore" option if you need that. Can't give you an advice on that topic.
One other thing that I have noticed. Right now build uses default Debug configuration instead of Release.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build
If you add "--configuration Release" it should enable optimizations and maybe reduce artifacts size.
Additional debugging information files can be stopped from being generated if next option is used:
/p:DebugType=None /p:DebugSymbols=false
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation
Oleksi, Hi and thanks for the note! I obviously somehow missed your previous response - very sorry.
I'll have a look at the C# installation and try to follow your guidance. Shall be back with news in a day or two hopefully.
Dear Oleksi, thanks so much for guidance and sorry for delay!
Though I initially did something wrong and was to rollback the attempt, now I retried and when tested the result, I see
that DEBUG macro is not defined anymore, while RELEASE is set instead of it.
UPD: sorry for confusion, TestUser is my account which I use after changes are done to try the result, forgot to switch back before writing this comment.