Update asmdef files when project references are added/removed #2279
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will:
.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).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.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 istrue
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 tofalse
. 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 tofalse
, or prompt first? We would also have to update any other references in predefined projects to be consistent.