Aptivi<p><strong>.NET 10 brings “dotnet run app.cs”</strong></p><p>Finally! We are super excited to announce that Microsoft have implemented a long-awaited feature that will transform your experience of C# scripts using just the <code>dotnet run</code> command! This is a feature that is released with the fourth preview of .NET 10.</p><p>It was ages ago since we’ve announced anything exciting, because we’re in an era where the majority of developments are in artifical intelligence (AI).</p><p>You can now get started with C# easier than before. Using just a C# code file and a dotnet command, you can run simple programs! This is to streamline the experience with C#, especially if you’re just getting started. File-based apps feature is inspired by JavaScript (.js), Python (.py), and other scripting languages. File-based apps are also scalable, ensuring that you can make real and complex applications using just the C# files.</p><p>New directives have been introduced to the file-based C# scripts that allow you to declare a small number of important properties, such as NuGet packages (<code>#:package Terminaux@7.0.0</code>), SDK specifications (<code>#:sdk Microsoft.NET.Sdk.Web</code>), and MSBuild properties (<code>#:property LangVersion Preview</code>). This is to achieve maximum flexibility, since you can make very complex applications with lots of dependencies using just a single C# file.</p><p>The most exciting part is that you can now run a C# file as if it were a Bash script (.sh, .bash, and so on) in Unix systems! Using just a shebang at the top of the file (<code>#!/usr/bin/dotnet run</code>), you can finally make executable C# scripts using just the name of the source code file. To do this, set the executable bit using the <code>chmod</code> command.</p> <pre>$ chmod +x app.cs$ ./app.cs</pre> <p>This is a great feature for anyone who are making applications and/or small scripts without making a C# project file. However, you can convert it to the standard project-based application, should the C# scripts file become too complex to handle.</p><p>You can read more about this feature by clicking on the below button.</p> <a class="" href="https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-app/" rel="nofollow noopener noreferrer" target="_blank">Learn more</a> <p><a href="https://www.freepik.com/free-photo/young-asian-student-university-campus-with-computer-laptop_8907894.htm" rel="nofollow noopener noreferrer" target="_blank">Image by diana.grytsku on Freepik</a></p><p><span></span></p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/csharp/" target="_blank">#csharp</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/dotnet/" target="_blank">#dotnet</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/dotnet-run/" target="_blank">#dotnetRun</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/dotnet-run-app/" target="_blank">#dotnetRunApp</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/news/" target="_blank">#news</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/programming/" target="_blank">#Programming</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/tech/" target="_blank">#Tech</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/technology/" target="_blank">#Technology</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://officialaptivi.wordpress.com/tag/update/" target="_blank">#update</a></p>