Resharper-unity: Add support for .asmref files

Created on 13 Nov 2019  路  5Comments  路  Source: JetBrains/resharper-unity

Unity 2019.2 added .asmref files - Assembly Definition References Files.

From the release notes to 2019.2.0a6:

Scripting: Added support for Assembly Definition Reference Files (asmref). These allow for adding additional source code directories to an existing Assembly Definition File (asmdef).

There doesn't seem to be much documentation:

You can use Assembly Definition Reference Assets to add additional folders to an existing Assembly Definition asset.

Add support, e.g. syntax highlighting, JSON schema, and whatever else is needed. Also look at how this affects showing the project name in the Unity Explorer tree view (#1398)

Most helpful comment

As requested in https://github.com/JetBrains/resharper-unity/issues/1398#issuecomment-553491504, this is a sample asmref file. For now, they are incredibly simple:
Here's the editor
image

There file content is the following

  1. When not using GUID
{
    "reference": "Vendor"
}
  1. When using GUID
{
    "reference": "GUID:679b1ad5ea99ee144828e78799109596"
}

All 5 comments

As requested in https://github.com/JetBrains/resharper-unity/issues/1398#issuecomment-553491504, this is a sample asmref file. For now, they are incredibly simple:
Here's the editor
image

There file content is the following

  1. When not using GUID
{
    "reference": "Vendor"
}
  1. When using GUID
{
    "reference": "GUID:679b1ad5ea99ee144828e78799109596"
}

I would really love to see .asmref support happening in Rider.

Unity.Mathematics library is full of partial classes that makes it really easy to be extensible just by putting an Assembly Definition Reference inside an external folder. Seems like Unity is happy with that approach but Rider goes crazy with asmref being around and does not even see the symbols in original asmdef for some reason.

For starters, at least just a basic support to prevent these errors would be great.

Here is a simple example project:

https://gitlab.com/canbaycay/RiderAsmrefSupportExample

Oh? I thought it worked fine with asmrefs, just didn't have proper support to create them, but it seems it's not working properly when being used with packages?

I use them extensively on my current project, and never noticed anything strange in Rider. But, I only use them for "Editor" folders. Never used them to extend a package. That's super neat and I hadn't thought about it at all. (thanks!)

Or maybe Rider breaks when used with partial classes in particular?
I mean, the actual projects should have no knowledge of the "asmref" itself. They'll behave as if the files were included in them normally, from what I know.

Did you have trouble with using an asmref but not using a partial class? Just doing something with something "internal" on a package, for example.

I'll see if I can make time to do a quick test on this.

@CanBaycay Sorry for delay. I have just downloaded your example, open with Unity 2019.3.0f5 with Rider package 1.2.1 and Rider 2019.3.3 and it is all green, except slow SWEA (https://youtrack.jetbrains.com/issue/RIDER-22945). You may try to build your solution in Rider, and if it builds, but Rider is still showing errors - then try the last resort File->Invalidate caches and Restart.

Was this page helpful?
0 / 5 - 0 ratings