Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update asmdef files when project references are added/removed #2279

Merged
merged 9 commits into from
Feb 14, 2022

Conversation

citizenmatt
Copy link
Member

@citizenmatt citizenmatt commented Feb 14, 2022

This PR will:

  • Automatically update a .asmdef file when a reference to another .asmdef based project is added or removed. Fixes Reference assembly action should update asmdef files #852 (and RIDER-48660)
  • Remove references from .asmdef file if a reference is removed from a .csproj file. This means the .asmdef file will be updated when e.g. the Remove Unused References refactoring is used. Fixes Remove unused references #1994
  • Project references are added as GUID based references, unless existing name based references are being used.
  • Asmdef references are correctly handled when modifying or adding/removing .Player projects. However, the reference change is not automatically propagated to the Player/non-player project until Unity regenerates the project files.

This PR does not currently handle reference modifications other than asmdef based changes. References to custom assemblies, or plugin assemblies (DLLs that are assets) are currently ignored. It might be best to notify the user that changes like this will be lost the next time Unity regenerates the project.

Similarly, it does not update the "autoReferenced" property. This is true by default, and means all predefined assemblies (e.g. Assembly-CSharp) reference all .asmdef projects. If a reference to a .asmdef project is added to a predefined project, it would imply this flag is set to false. We can update this in this circumstance. However, it is unclear what we should do if a .asmdef project is removed from a predefined project. Should we automatically set the flag to false, or prompt first? We would also have to update any other references in predefined projects to be consistent.

@citizenmatt citizenmatt added this to the Rider 2022.1 milestone Feb 14, 2022
@citizenmatt citizenmatt self-assigned this Feb 14, 2022
@citizenmatt citizenmatt merged commit b911b8c into net221 Feb 14, 2022
@citizenmatt citizenmatt deleted the net221-mte-asmdef-module-referencer branch February 14, 2022 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove unused references Reference assembly action should update asmdef files
2 participants