.NET Core问题
This section provides information on typical .NET Core related issues.本节提供有关典型.NET Core相关问题的信息。
.NET Core SDK version.NET Core SDK版本#
To develop a project using C# Component System, a developer (artist, designer, and any other person working with the project) should have .NET Core SDK installed on their computer.要使用 C#组件系统开发项目,开发人员(艺术家,设计师和任何其他从事该项目的人员)应在计算机上安装.NET Core 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 Core on All PCs to Run the Final Build?我是否需要在所有PC上安装.NET Core才能运行最终版本?#
Running a final application built by UnigineEditor via the Build Tool does not require .NET Core SDK or .NET Core runtime. The output applications are self-contained and can be run flawlessly on almost any computer.通过Build Tool运行UnigineEditor构建的最终应用程序不需要。NETCore SDK或.NET Core运行时。输出应用程序是独立的,可以在几乎任何计算机上完美运行。
Typical Errors典型错误#
If you don't have .NET Core 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 Core 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 Core SDK 3.1 not found):单击UnigineEditor中的Play按钮时,也会发生错误(Required .NET Core SDK 3.1 not found):
Fixing Errors with Missing SDK使用缺少的SDK修复错误#
To fix any possible errors with missing .NET Core 3.1.x SDK, you need to download and install .NET Core SDK 3.1.300 using the following link: https://dotnet.microsoft.com/download/dotnet-core/3.1. 要修复缺少.NET Core 3.1.x SDK的任何可能的错误,您需要使用以下链接下载并安装.NET Core SDK 3.1.300: https://dotnet.microsoft.com/download/dotnet-core/3.1.
Installing .NET Core 3.1.x SDK on Windows在Windows上安装.NET Core 3.1.x SDK#
We recommend installing the version 3.1.300: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.300-windows-x64-installer.我们建议安装3.1.300版本: https://dotnet.microsoft.com/download/dotnet-core/thank-you/sdk-3.1.300-windows-x64-installer。
Download the required installer and run it following all installation steps.下载所需的安装程序并按照所有安装步骤运行。
Optional: After installing the SDK you might find it useful to disable .NET Core SDK telemetry. 可选:安装SDK后,您可能会发现禁用.NET Core SDK遥测很有用。
Installing .NET Core 3.1.x SDK on Linux在Linux上安装.NET Core 3.1.x SDK#
We recommend installing .NET Core SDK version 3.1.300: https://docs.microsoft.com/en-us/dotnet/core/install/linux.我们建议安装.NET Core SDK版本3.1.300:https://docs.microsoft.com/en-us/dotnet/core/install/linux。
Linux operating systems supported by .NET Core include at least the following: .NET Core支持的Linux操作系统至少包括以下内容:
- Red Hat Enterprise Linux 7, 8
- CentOS 7, 8
- Fedora 31, 32
- Debian 9, 10
- Ubuntu 16.04, 18.04, 19.10, 20.04
- openSUSE 15+
- SUSE Enterprise Linux (SLES) 12 SP2+, 15
- Alpine Linux 3.9+
.NET Core SDK can be installed on Linux in a number of ways. We describe manual installation, as it is more flexible (the process was described by Michael Heydt). Using the command line terminal, do the following: .NET Core SDK可以通过多种方式安装在Linux上。我们描述了手动安装,因为它更加灵活(该过程由Michael Heydt描述)。使用命令行终端,执行以下操作:
- Download the installer:
For RedHat Enterprise Linux 6 users the following line should be used:
wget https://download.visualstudio.microsoft.com/download/pr/0c795076-b679-457e-8267-f9dd20a8ca28/02446ea777b6f5a5478cd3244d8ed65b/dotnet-sdk-3.1.300-linux-x64.tar.gz
下载安装程序:wget https://download.visualstudio.microsoft.com/download/pr/cdb98822-bf8f-4f11-a5a4-baa8d8ad66d0/b696896552ca7768a7189f775e220d2e/dotnet-sdk-3.1.300-rhel.6-x64.tar.gz -O dotnet-sdk-3.1.300-linux-x64.tar.gz
对于RedHat Enterprise Linux 6用户,应使用以下行:wget https://download.visualstudio.microsoft.com/download/pr/0c795076-b679-457e-8267-f9dd20a8ca28/02446ea777b6f5a5478cd3244d8ed65b/dotnet-sdk-3.1.300-linux-x64.tar.gz
wget https://download.visualstudio.microsoft.com/download/pr/cdb98822-bf8f-4f11-a5a4-baa8d8ad66d0/b696896552ca7768a7189f775e220d2e/dotnet-sdk-3.1.300-rhel.6-x64.tar.gz -O dotnet-sdk-3.1.300-linux-x64.tar.gz
- Create the directory and uncompress the file there:
创建目录并在那里解压缩文件:
mkdir ~/dotnet-3.1.300 && tar -xvf dotnet-sdk-3.1.300-linux-x64.tar.gz -C ~/dotnet-3.1.300
mkdir ~/dotnet-3.1.300 && tar -xvf dotnet-sdk-3.1.300-linux-x64.tar.gz -C ~/dotnet-3.1.300
- Create a symlink to the executable file in that directory:
You can do without a symlink and root access — just edit the ~/.profile file (or its equivalents: ~/.bashrc, ~/.kshrc, ~/.zshrc) in any text editor by adding the following line:
sudo ln -s ~/dotnet-3.1.300/dotnet /usr/bin/dotnet
It will look this way:export PATH="$PATH;$HOME/dotnet-3.1.300"
Then re-login. If UnigineEditor still doesn't detect .NET Core SDK, restart the system. 在该目录中创建一个指向可执行文件的符号链接:您可以在没有符号链接和root访问权限的情况下完成 —只需在任何文本编辑器中编辑~/.profile文件(或其等效项:~/.bashrc,~/.kshrc,~/.zshrc),添加以下行:sudo ln -s ~/dotnet-3.1.300/dotnet /usr/bin/dotnet
这样的样子:export PATH="$PATH;$HOME/dotnet-3.1.300"
然后重新登录。如果UnigineEditor仍未检测到.NET Core SDK,请重新启动系统。 - Optional: After the file has been unpacked successfully, you can delete the archive:
可选:成功解压缩文件后,您可以删除存档:
rm dotnet-sdk-3.1.300-linux-x64.tar.gz
rm dotnet-sdk-3.1.300-linux-x64.tar.gz
- Optional: After installing the SDK, you might find it useful to disable .NET Core SDK telemetry. 可选:安装SDK后,您可能会发现禁用.NET Core SDK遥测很有用。
Checking .NET Core SDK Version检查.NET Core SDK版本#
You can check which .NET Core SDK Version (or versions) is installed on your PC.您可以检查PC上安装了哪个.NET Core 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 Core SDK versions are listed. If you installed SDK 3.1.x and it is not listed, address Microsoft support.在输出中,列出了所有已安装的.NET Core SDK版本。如果您安装了SDK 3.1.x,但未列出,请寻求Microsoft支持。
Checking SDK Compatibility检查SDK兼容性#
When loading a C# Component System based project, UnigineEditor lists all found .NET Core versions in its log:加载基于C#组件系统的项目时,UnigineEditor会在其日志中列出所有找到的.NET Core版本:
找不到.NET Core SDK。 | |
找到了不合适的.NET Core SDK版本。 | |
找到.NET Core SDK 3.1.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%变量。