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

NuGetForUnity CLI Package Generates Incorrect/missing .meta files #637

Open
Reag opened this issue Apr 8, 2024 · 1 comment
Open

NuGetForUnity CLI Package Generates Incorrect/missing .meta files #637

Reag opened this issue Apr 8, 2024 · 1 comment

Comments

@Reag
Copy link

Reag commented Apr 8, 2024

Description

The purpose of the NuGetForUnity CLI tool is to act as a pre build step for automated pipelines. However, when it downloads a DLL that includes a Roslyn Analyzer (Especially if said DLL is for code gen), said DLL will not receive a .meta file that includes the correct label. This means that the DLL will never perform its code gen in the automated pipeline.

In the normal editor, this isn't a problem, as part of the startup process includes a NuGet Restore that will build these meta files and tag them. However, in an automated pipeline, this step never seems to actually occur. If you perform

nugetforunity restore <PROJECTPATH> //Nuget Restore
unity-editor -quit        -batchmode -ignoreCompilerErrors ... //Run the project once, ignoring compilation errors. Should CodeGen
unity-editor -runTests -batchmode .... //Run tests!

It will fail to perform the required code gen and the .meta files will not have the correct label. Performing the same set of operations works fine if the editor is not in batch mode.

@JoC0de
Copy link
Collaborator

JoC0de commented Apr 19, 2024

Hi @Reag
Thanks for creating the issue and sorry for the delay.
I created the CLI exactly for the reason that the batch mode didn't perform the restore operation at the correct point in time. But I never tested the .meta manipulation we als do in the restore/import. I think the main causes of the problem is that unity imports the dlls downloaded by the CLI before the NuGeForUnity plugin is imported by the package manager. One possible workaround would be to start unity twice, at least I think it helped to do the restore without the CLI. At least for the issue with Roslyn Analyzers it should be possible to duplicate the feature so the CLI also sets the correct .meta attributes.

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

No branches or pull requests

2 participants