Search Issue Tracker

By Design

Votes

0

Found in

2018.4.0f1

2019.2.0a1

2019.2.0f1

2019.3.0a1

2020.1.0a1

Issue ID

1176865

Regression

No

Asmdef files do not respect API level when set to Include only Editor Platform

Scripting

-

How to reproduce:
1. Open the "EditorAsmdefTargetDlls.zip"
2. Make sure Assets > Editor Scripts > ColorWindowEditor assembly is set to include only Editor platform
3. Observe the console

Expected Behaviour: No errors are present as the .asmdef file has a reference to .NET 2.0 API
Actual Behaviour: Errors are present showing that there is a missing reference

Reproducible with: 2018.4.7f1, 2019.2.2f1, 2019.3.0b1, 2020.1.0a1

Note: If you select "Any Platform" Checkbox and exclude every platform except the Editor - the issue is gone.

  1. Resolution Note (2020.1.X):

    By design. Editor only assemblies are always compiled against .NET Framework 4.x and runtime assemblies are compiled against the API Compatibility Level in Player settings. This is because the editor relies on types only in .NET Framework.

    If you want to reference additional System assemblies such as System.Drawing.dll for editor only assemblies, you can add a csc.rsp containing "-r:System.Drawing.dll" next to the .asmdef that should reference System.Drawing.

    csc.rsp adds additional C# compiler arguments and "-r:" is the argument for adding references.

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/reference-compiler-option

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.