I am using the UnityEditor.iOS.Xcode correct when there is no asmdef file. When I add a asmdef file and I met a problem. The namespace of UnityEditor.iOS can not be found.
How can I add it to the asmdef? I don’t know where to lookup the correct name of UnityEditor.iOS in references.
I add some test, the editor will not report any error, but the visual studio can not attach because the visual studio report error.
I compare the different between my own asmdef project and the Assembly-CSharp-Editor.
I find the Assembly-CSharp-Editor has reference to the UnityEditor.iOS.Extensions.Common and UnityEditor.iOS.Extensions.Xcode.
But my own asmdef has only reference to UnityEditor.iOS.Extensions.
I add the missing reference to my asmdef reference, but it seems not work:
{
"name": "MyDLL.Editor",
"references": [
"UnityEditor.iOS.Extensions.Common",
"UnityEditor.iOS.Extensions.Xcode",
"MyDLL"
],
"optionalUnityReferences": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false
}
I build the DLL and the editor load the DLL correctly.
But my visual studio can not attach to debug because it always report can not find UnityEditor.iOS.Xcode
It seems the vs project generate is not correct when using asmdef
Did you get this figured out? I’m experiencing this problem, whether or not I use .asmdef files.
Is there anyone know how to resolve this, the error in visual studio is really annoying~
@watsonsong I think I figured it out. Let me know if this helps–reinstall Unity. Specifically install the Visual Studio Community part, even if you’re not using Visual Studio. That seems to have fixed it for me.
Something is broken in your computer’s config (almost certainly broken by Unity’s installer). I spoke with someone on the Unity QA team, and they can’t reproduce even with a test project. So the problem is in the system configuration/setup, not the project.
I check the .csproject file and it has no reference to UnityEditor.iOS.Extensions.Common and UnityEditor.iOS.Extensions.XCode.
I am using the .Net 4.x and net standard 2.0, is it the environment error?
If your error is the same as mine, none of that matters. There is nothing you can do in your project settings to fix the problem. Install Unity and Visual Studio Community using the Unity 2017 installer. (You can still use MonoDevelop.) If that doesn’t work, then it will be time to brainstorm other solutions.
You could write some code to automatically add references to those two DLLs to your csproj files, but it’s a lousy workaround. If you do that, you’ll constantly need to reload the project, and because Unity frequently regenerates the project files, you’ll also sometimes end up without the references anyway.
@piojox11 I change a computer and reinstall the visual studio 2017, the result is the same:
1>------ 已启动生成: 项目: NirvanaEditor, 配置: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(84,5): warning MSB3052: 编译器的参数无效,“/define:0”将被忽略。
1>F:\Repositories\Nirvana\Assets\Nirvana\Editor\Build\ProductNameI18N.cs(14,27,14,32): error CS0234: 命名空间“UnityEditor.iOS”中不存在类型或命名空间名“Xcode”(是否缺少程序集引用?)
1>F:\Repositories\Nirvana\Assets\Nirvana\Editor\Build\XCodePostProcess.cs(14,27,14,32): error CS0234: 命名空间“UnityEditor.iOS”中不存在类型或命名空间名“Xcode”(是否缺少程序集引用?)
2>------ 已启动生成: 项目: Assembly-CSharp-firstpass, 配置: Debug Any CPU ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(84,5): warning MSB3052: 编译器的参数无效,“/define:0”将被忽略。
2>CSC : error CS0006: 未能找到元数据文件“F:\Repositories\Nirvana\Temp\bin\Debug\NirvanaEditor.dll”
3>------ 已启动生成: 项目: Assembly-CSharp, 配置: Debug Any CPU ------
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Roslyn\Microsoft.CSharp.Core.targets(84,5): warning MSB3052: 编译器的参数无效,“/define:0”将被忽略。
3>CSC : error CS0006: 未能找到元数据文件“F:\Repositories\Nirvana\Temp\bin\Debug\Assembly-CSharp-firstpass.dll”
3>CSC : error CS0006: 未能找到元数据文件“F:\Repositories\Nirvana\Temp\bin\Debug\NirvanaEditor.dll”
========== 生成: 成功 0 个,失败 3 个,最新 2 个,跳过 0 个 ==========
You meant you used the Unity installer to install VS, right? If so, I have no more ideas. Sorry.
I just found this can’t be fixed in Unity 2018, but it works in Unity 2017.
@piojox11 have you resolve this problem?
I still have the same error by using the Unity2018.2b10
@watsonsong Sorry I can’t help more. Since this discussion started, I encountered this problem again, but solved it the same way. The only things I’ve done (and one of them was the solution) were uninstalling and reinstalling Unity and Visual Studio, but only reinstalling VS using the Unity installer, not the official installer.
@watsonsong , @piojox11
Hi, I’m experiencing the same problem at the moment with 2018.2.8f1.
I have no doubt that it is something to do with asmdef.
-
If I remove asmdef, then it doesn’t give the errors with missing UnityEditor.iOS.xxx.
-
Unity Cloud Build has exactly the same problem. If it’s such a system configuration problem particularly on my dev environment, then Unity Cloud Build is supposed to be working. However, Unity Cloud Build also failed to come out a build due to the same error: missing UnityEditor.iOS.xxx reference.
So frustrated.
I dare not uninstall/reinstall applications unless there’s a confirm and 100% guarantee to fix the problem by doing that.
At the moment, I gotta forget about using asmdef.
@JeremyROH , I am tring the 2018.3b9 and this problem is the same. If I using the asmdef, this error happen. No matter whether how many time I reinstall unity, reinstall visual studio 2017, reinstall windows 10, even change another windows computer this error is the same.
Is there any more body met this problem, I hope the unity can fix it.
This issue is blocking iOS unity cloud build with xcode post processing for us.
I cannot find a way to reference UnityEditor.iOS.Extensions.Xcode.dll in asmdef.
In my csproj, this is easy. But as Unity generates the csproj from the .asmdef, I don’t see a feasible way to do this.
If anyone is looking at this, you have to put the script in an Editor folder
@andrewow_1 , I am put my script in the Editor folder. What cause this is I am using the asmdef file.
Asmdefs do not support the Editor folder naming system. You need to place a editor asmdef inside any Editor folders you have under the main asmdef.
Alternatively, separate your editor code and runtime code.