mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 06:42:03 +01:00
uired
Updated wikipage Eiffel for .NET Integration. (Signed-off-by:jocelyn). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2418 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[[Property:modification_date|Mon, 02 Oct 2023 08:50:04 GMT]]
|
||||
[[Property:modification_date|Mon, 02 Oct 2023 09:59:58 GMT]]
|
||||
[[Property:publication_date|Wed, 27 Sep 2023 19:33:07 GMT]]
|
||||
[[Property:title|Eiffel for .NET Integration]]
|
||||
[[Property:weight|3]]
|
||||
@@ -115,7 +115,8 @@ Open the Eiffel configuration file (.ecf) of your project and add the following
|
||||
|
||||
|
||||
====Conclusion====
|
||||
By creating a Facade for a `List<string>` in C#, we can effectively consume C# generic features in Eiffel. This approach can be extended to other generic types as well.
|
||||
By creating a Facade for a `List<string>` in C#, we can effectively consume C# generic features in Eiffel.
|
||||
This approach can be extended to other generic types as well.
|
||||
|
||||
===Enum types===
|
||||
Eiffel for .NET supports .NET enum types implicitly. From the point of view of Eiffel, they are just considered as expanded classes. The only difference is in the code generation. Eiffel for .NET cannot declare new enum types yet.
|
||||
@@ -126,30 +127,45 @@ Eiffel does not have the notion of `byref` argument passing. At the moment, Eiff
|
||||
|
||||
==Eiffel compatibility with .NETCore 6.0 and above ==
|
||||
|
||||
===Limitations with "init" only setters===
|
||||
=== Type with "init" only setters===
|
||||
Eiffel currently does not support the special `init` property that is only initialized in a block of code as part of the object initialization. More details can be found in the [https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/init C# 9.0 proposal]
|
||||
|
||||
====Workaround====
|
||||
A potential workaround is to create a C# library that uses a Factory pattern to build the required instance.
|
||||
|
||||
===Executing .NET applications from EiffelStudio===
|
||||
Currently, some types of applications cannot be executed directly from the EiffelStudio IDE. For example Web APIs.
|
||||
===Executing Eiffel .NET Core applications ===
|
||||
At the moment, the EiffelStudio '''debugger has no support''' Eiffel .NET Core.
|
||||
|
||||
====Workaround====
|
||||
You can execute the application from the command line. Use the `dotnet` tool with the following syntax: `dotnet <app_name>`.
|
||||
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.
|
||||
|
||||
===Debugging .NET applications from EiffelStudio===
|
||||
At the moment, EiffelStudio does not provide any support for debugging Eiffel .NETCore directly from the IDE.
|
||||
{{note|The generated executable can not be executed by itself and requires to be launched using the `dotnet` tool from the command line. Using the the syntax: `dotnet <app_name>` or `dotnet run <app_name>`.}}
|
||||
|
||||
====Workaround====
|
||||
A potential solution is to use the C# wrapper project generated by the Eiffel compiler (in W_code or F_code directory). VisualStudio can open this C# wrapper (via the associated `.csproj` file), and thus the associated Eiffel output (dll or exe), and after configuring Debugging profile within VisualStudio , it is possible to debug the code.
|
||||
{{tip|In addition, 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 <NAME>`.}}
|
||||
|
||||
===Eiffel .NETCore types of SDKs===
|
||||
In the current version, Eiffel .NETCore does not support directly different types of SDKs such as `Microsoft.NET.Sdk.Web`. The generated C# wrapper only target `Microsoft.NET.Sdk`.
|
||||
{{info|Read more about the `dotnet` tool, and especially the `run` command at [https://learn.microsoft.com/fr-fr/dotnet/core/tools/dotnet-run] .}}
|
||||
|
||||
To help the user, the EiffelStudio compiler also generates (in W_code or F_code directories) a C# wrapper project. See the `wrapper_*.cs` and `wrapper_*.csproj` files.
|
||||
This "wrapper" project will be useful for specific execution, but also [[#Publishing|publishing]] the executable, or even '''debugging''' using VisualStudio. See the next sections for more information.
|
||||
|
||||
====Publishing====
|
||||
This '''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 C# 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 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.
|
||||
This allows the application to be run and, if necessary, debugged using VisualStudio.
|
||||
|
||||
====Workaround====
|
||||
For other types of applications like Web APIs, you need to manually provide a `.csproj` file with the required SDKs and package dependencies. This allows the application to run and, if necessary, use VisualStudio to debug.
|
||||
|
||||
==Publishing the Eiffel solution: using the generated C# wrapper==
|
||||
To publish the Eiffel solution on current platform or targeting other platform, use the `dotnet` tool on the generated C# wrapper project.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user