Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of .NET Core Development Runtime IDentifier

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

The editor today takes you to learn about the sample analysis of .NET Core development Runtime IDentifier. The knowledge points in this article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's go deep into the knowledge of "sample Analysis of .NET Core Development Runtime IDentifier" with the editor.

The .NET Core is a new platform that is both familiar and unfamiliar to traditional .NET developers, so sometimes it's normal to encounter unexpected things. At this time, just need a little patience, check more information, and try to find the reason, which is also a meaningful experience.

For example, when you build the simplest console application:

Dotnet new console-o helloRID

And after completing the compilation:

Dotnet build

In the bin directory, you will find that the generated assembly is a dll file, not an exe file from previous experience.

Check the project file again, and the output type is indeed Exe.

Are you surprised?

Of course, we can also use dotnet run to get the results of the program, but this file format is by no means what users want, and they have no way to run the file directly.

The cause of the problem is easy to find by search engines-you need to specify an additional Runtime IDentifier (runtime identity) at compile time.

The role of Runtime IDentifier is to specify the target platform on which the application runs. This is easy to understand, because the .NET Core supports cross-platform, so the compiler does not know the platform on which the executable you want to generate needs to run by default at compile time, and only if you tell it actively can you get the results you want.

So run dotnet build-r osx-x64 (suppose you run the program on a macOS system like I did), and the executable file appears as expected in the osx-64 folder in the bin directory.

If it is a Windows 10 system, run dotnet build-r win10-x64. The familiar exe file appears again.

More Runtime IDentifier can be found on Microsoft's official website, where you need to praise Microsoft, and the improved official documentation is becoming more and more useful.

Thank you for your reading. The above is the whole content of "sample Analysis of .NET Core Development Runtime IDentifier". Let's get started. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report