[[Property:modification_date|Mon, 02 Oct 2023 12:50:47 GMT]] [[Property:publication_date|Mon, 02 Oct 2023 10:00:56 GMT]] [[Property:uuid|1838ECEC-F411-46C7-926B-204ED0ACD0C6]] [[Property:weight|20]] [[Property:title|Eiffel .NETCore execution]] [[Property:link_title|NETCore execution]] This document provide a quick overview on how to execute Eiffel.NetCore applications. It covers various aspects including the wrapper project, execution, publishing, debugging in VisualStudio, and known limitations At the moment, the EiffelStudio '''debugger has no support''' Eiffel .NET Core. It is, however, possible to execute most of the Eiffel .NET Core application from the IDE using the `Run` command. The execution will be outside EiffelStudio. The generated executable can not be executed by itself and requires to be launched using the `dotnet` tool from the command line. {{note|Use the command: `dotnet ` or `dotnet run `.}} == Wrapper project == To help the user, the EiffelStudio compiler also generates a C# wrapper project (located in W_code or F_code directories). See the `wrapper_*.cs` and `wrapper_*.csproj` files. This simple C# '''wrapper''' project is simply a way to include and instantiate the Eiffel .NETCore code. This "wrapper" project is useful for: * [[#Executing]] using profile * [[#Publishing|publishing]] the executable * [[#Debugging_in_VisualStudio|debugging]] using VisualStudio. * Working with any specific tool that requires a C# project See the next sections for more information. For an application named "app_netcore": * the C# code is quite simple: ... public class wrap_app_netcore { public static void Main() { MAIN.Main(); } } Note: the `MAIN.Main()` is the main entry point of the Eiffel .NETCore application. * the `wrap_app_netcore.csproj` file looks like: exe net6.0 enable disable true true None app_netcore.exe Eiffelsoftware.Runtime.dll ==Execution== It is possible that an application requires additional setting (for example web APIs application), in this case the `dotnet run` tool can use a specific '''profile''' using the syntax `--launch-profile `. Read more about the `dotnet` tool, and especially the `run` command at [https://learn.microsoft.com/fr-fr/dotnet/core/tools/dotnet-run] . ==Publishing== The '''wrapper''' project is helpful to '''publish''' the executable to the current or other platforms, and have an executable that does not require the `dotnet` command. It is also possible to include all dependencies (i.e: self contained) to ease deployment on machine without any dotnet runtime installed. {{note| use the `dotnet publish` tool on the generated wrapper project. See the documentation about `dotnet publish` at [https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish] .}} ==Debugging in VisualStudio== Even if EiffelStudio does not provide any support for debugging Eiffel .NETCore directly from the IDE. It is possible to use, for instance, '''VisualStudio''' to debug the generated Eiffel .NETcore application thanks to the wrapper C# project. A solution is to use the C# wrapper project generated by the Eiffel compiler (in W_code or F_code directory) within VisualStudio. * Open the C# `.csproj` file with VisualStudio (it includes the associated Eiffel output dll or exe) * Configure the Debugging profile * Launch the execution with VisualStudio, and debug. ==Limitations== In the current version, the EiffelStudio compiler will always generate a Microsoft.NET.Sdk C# wrapper project. But this is not always the expected type SDKs. For instance when using ASP.NETCore, it is expected to use `Microsoft.NET.Sdk.Web`. In such case, the generated `.csproj` file needs to be manually modified to set the expected SDK, and also the various package dependencies. For instance: * replace the first line of the `.csproj` file by * and in the `` section, list the package references such as This allows the application to be run and, if necessary, debugged using VisualStudio. {{info|To learn more, check the Eiffel .NETCore examples at [[Eiffel .NET samples]].}}