Это похоже на известную проблему в Unity 2018 с тем, как он генерирует файлы проекта Visual Studio.Я только что заметил ту же проблему с Unity 2018.1.2f1 и Visual Studio 2015 Update 3 (14.0.25431.01).
Кто-то опубликовал сообщение о такой же проблеме на форуме Unity .Себастьен Лебретон из Microsoft ответил обходным путем, пока Unity не исправит проблему.Добавьте приведенный ниже скрипт в папку с именем «Editor» в вашем проекте.
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
[InitializeOnLoad]
public class ProjectFileHook
{
// necessary for XLinq to save the xml project file in utf8
class Utf8StringWriter : StringWriter
{
public override Encoding Encoding
{
get { return Encoding.UTF8; }
}
}
static ProjectFileHook()
{
ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
{
// parse the document and make some changes
var document = XDocument.Parse(content);
var ns = document.Root.Name.Namespace;
document.Root
.Descendants()
.First(x => x.Name.LocalName == "PropertyGroup")
.Add(new XElement(ns + "ImplicitlyExpandNETStandardFacades", "false"),
new XElement(ns + "ImplicitlyExpandDesignTimeFacades", "false"));
// save the changes using the Utf8StringWriter
var str = new Utf8StringWriter();
document.Save(str);
return str.ToString();
};
}
}
#endif