简体   繁体   English

包括在使用Unity时在Travis中以.NET 4.x为目标的依赖项

[英]Including Dependencies That Target .NET 4.x in Travis While Using Unity

I am using the Unity Game Engine for a school project. 我正在将Unity Game Engine用于学校项目。 I use: https://github.com/GlitchEnzo/NuGetForUnity to download Nuget Packages, as Visual Studio's NuGet Package Manager doesn't play well when Unity regenerates the .sln file. 我使用: https : //github.com/GlitchEnzo/NuGetForUnity下载Nuget程序包,因为当Unity重新生成.sln文件时,Visual Studio的NuGet程序包管理器无法正常运行。

One of the packages I use is https://github.com/System-IO-Abstractions/System.IO.Abstractions 我使用的软件包之一是https://github.com/System-IO-Abstractions/System.IO.Abstractions

Locally, this works fine, however, when just having this dll as part of my project causes the Travis build to fail. 在本地,这正常工作,但是,当仅将此dll作为我的项目的一部分导致Travis构建失败时。 I am unsure of the exact cause but I suspect it has to do with the build not being able to target the corect framework, as Unity by default targets .NET 3.5. 我不确定确切的原因,但我怀疑这与构建无法定位corect框架有关,因为Unity默认情况下以.NET 3.5为目标。

Is there a way that I can debug my build to find the target version or manually set the target version to .NET 4.0? 有没有一种方法可以调试我的构建以找到目标版本或手动将目标版本设置为.NET 4.0?

Any help would be greatly appreciated. 任何帮助将不胜感激。

You can switch the Scripting Runtime Version in Unity to .Net 4.6 in the project settings 您可以在项目设置中将Unity中的脚本运行时版本切换到.Net 4.6

Go to the PlayerSettings 转到播放器PlayerSettings

在此处输入图片说明

and there under Other Settings switch Scripting Runtime Version to Experimental (.Net 4.6 Equivalent) 并在“ Other Settings下将Other Settings Scripting Runtime Version Other Settings切换为“ Experimental (.Net 4.6 Equivalent)Experimental (.Net 4.6 Equivalent)

在此处输入图片说明

Source: https://docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html 资料来源: https : //docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM