.NET 问题
This section provides information on typical .NET related issues.本节提供有关典型.NET 相关问题的信息。
.NET 5 SDK version.NET 5 SDK版本#
To develop a project using C# Component System, a developer (artist, designer, and any other person working with the project) should have .NET 5 SDK installed on their computer.要使用 C#组件系统开发项目,开发人员(艺术家,设计师和任何其他从事该项目的人员)应在计算机上安装.NET 5 SDK。
It is required to install the SDK, not the runtime, because SDK contains both the compiler, which compiles .cs-components in UnigineEditor, and the runtime, which runs an already compiled application from UnigineEditor at the development stage.需要安装 SDK ,而不是运行时,因为SDK既包含在UnigineEditor中编译.cs-components的编译器,又包含运行已从UnigineEditor中编译的应用程序的运行时。在开发阶段。
Do I Need to Install .NET 5 on All PCs to Run the Final Build?我是否需要在所有PC上安装.NET 5才能运行最终版本?#
Running a final application built by UnigineEditor via the Build Tool does not require .NET 5 SDK or .NET 5 runtime. The output applications are self-contained and can be run flawlessly on almost any computer.通过Build Tool运行UnigineEditor构建的最终应用程序不需要.NET 5 SDK 或 .NET 5 运行时。输出应用程序是独立的,可以在几乎任何计算机上完美运行。
Typical Errors典型错误#
If you don't have .NET 5 SDK installed, you can come across various errors while working with the project in both SDK Browser and UnigineEditor. For example, when running the application (clicking the RUN button) after creating it in SDK Browser, you may receive the error stating that File Not Found — File *_x64.dll doesn't exist:如果未安装.NET 5 SDK,则在SDK Browser和UnigineEditor中使用该项目时会遇到各种错误。例如,在SDK浏览器中创建应用程序后运行该应用程序(单击RUN按钮),您可能会收到错误,指出该File Not Found — File *_x64.dll doesn't exist:
Errors also can occur when clicking the Play button in UnigineEditor (Required .NET SDK 5.0 not found):单击UnigineEditor中的Play按钮时,也会发生错误(Required .NET SDK 5.0 not found):
Fixing Errors with Missing SDK使用缺少的SDK修复错误#
To fix any possible errors with missing .NET 5 SDK, you need to download and install .NET 5 SDK using the following link: https://dotnet.microsoft.com/download/dotnet/5.0. 要修复缺少.NET 5 SDK的任何可能的错误,您需要使用以下链接下载并安装.NET 5 SDK: https://dotnet.microsoft.com/download/dotnet/5.0.
Installing .NET 5 SDK on Windows在Windows上安装.NET 5 SDK#
Install a version 5.0.x: https://dotnet.microsoft.com/download/dotnet/5.0.安装5.0.x版本: https://dotnet.microsoft.com/download/dotnet/5.0。
Download the required installer and run it following all installation steps.下载所需的安装程序并按照所有安装步骤运行。
Optional: After installing the SDK you might find it useful to disable .NET SDK telemetry. 可选:安装SDK后,您可能会发现禁用.NET SDK遥测很有用。
Installing .NET 5 SDK on Linux在Linux上安装.NET 5 SDK#
Install a .NET SDK version 5.0.x: https://docs.microsoft.com/en-us/dotnet/core/install/linux.我们建议安装.NET SDK版本5.0.x:https://docs.microsoft.com/en-us/dotnet/core/install/linux。
Linux operating systems supported by .NET 5.0 include at least the following: .NET 5.0支持的Linux操作系统至少包括以下内容:
- Red Hat Enterprise Linux 7, 8
- CentOS 7, 8
- Fedora 32, 33
- Debian 9, 10
- Ubuntu 16.04, 18.04, 19.10, 20.04, 20.10
- openSUSE 15+
- SUSE Enterprise Linux (SLES) 12 SP2+, 15
- Alpine Linux 3.11+
Checking .NET SDK Version检查.NET SDK版本#
You can check which .NET SDK Version (or versions) is installed on your PC.您可以检查PC上安装了哪个.NET SDK版本。
On Windows在Windows上#
- Open the Command Prompt (Click the Start button and type cmd).打开命令提示符(单击Start按钮并键入 cmd )。
- In the window that opens, type the following:
在打开的窗口中,键入以下内容:
dotnet --list-sdks
dotnet --list-sdks
The following information should appear:应该出现以下信息:
On Linux在Linux上#
- Open the terminal.打开终端。
- In the window that opens, type the following:
在打开的窗口中,键入以下内容:
dotnet --list-sdks
dotnet --list-sdks
The following information should appear:应该出现以下信息:
In the output, all installed .NET SDK versions are listed. If you installed .NET 5 SDK and it is not listed, address Microsoft support.在输出中,列出了所有已安装的.NET SDK版本。 如果您安装了.NET 5 SDK,但未列出,请寻求Microsoft支持。
Checking SDK Compatibility检查SDK兼容性#
When loading a C# Component System based project, UnigineEditor lists all found .NET versions in its log:加载基于C#组件系统的项目时,UnigineEditor会在其日志中列出所有找到的.NET版本:
找不到.NET SDK。 | |
找到了不合适的.NET SDK版本。 | |
找到.NET Core SDK 5.0.x并成功初始化了C#组件系统。 |
Visual Studio Code IssuesVisual Studio Code问题#
OmniSharp extension Error: spawn cmd ENOENTOmniSharp extension Error: spawn cmd ENOENT#
In case IntelliSense cannot be started due to the spawn cmd ENOENT error in the OmniSharp extension, it is recommended to add %WINDIR%\System32 to the PATH variable.如果由于OmniSharp扩展中的spawn cmd ENOENT错误而导致无法启动IntelliSense,建议将%WINDIR%\System32添加到PATH变量中。
On Linux, you may require adding ~/.vscode/extensions to the path, for example in the .bashrc file:
export PATH=$HOME/.vscode/extensions:$PATH在Linux上,您可能需要在路径中添加~/.vscode/extensions,例如在.bashrc文件中:
export PATH=$HOME/.vscode/extensions:$PATH
For more details see https://github.com/OmniSharp/omnisharp-vscode/issues/32.有关更多详细信息,请参见https://github.com/OmniSharp/omnisharp-vscode/issues/32。
Project Opening Issues项目开题#
In case a single source file of a C# component is opened in VS Code when double-clicking it in UnigineEditor, it is recommended to make sure the path to the VS Code bin (%VSCODE_INSTALLATION_FOLDER%\bin) folder is added to the %PATH% environment variable, for example, as follows: C:\Program Files\Microsoft VS Code\bin.如果在UnigineEditor中双击VS Code中的C#组件的单个源文件时,建议确保将VS Code bin(%VSCODE_INSTALLATION_FOLDER%\bin)文件夹的路径添加到%PATH%环境变量中例如,如下:C:\Program Files\Microsoft VS Code\bin。
For Windows, it is also recommended to restart the PC to have the %PATH% variable updated.对于Windows,还建议重新启动PC以更新%PATH%变量。