Search Unity

Feature Request Persist compile flags (or at least 'Nullable') into the generated csproj

Discussion in 'Code Editors & IDEs' started by Aristonaut, Aug 3, 2022.

  1. Aristonaut

    Aristonaut

    Joined:
    May 4, 2019
    Posts:
    15
    I have been trying (unsuccessfully) for hours to enable the 'Nullable' reference types for c#. Unity allows adding compiler flags in Project Settings > Player > Additional Compiler Arguments, but those settings are not persisted to the csproj generated by the editor. This means that visual studio and vscode won't see this change. Before, you could add a Directory.Beuild.props file to handle this, but that doesn't seem to work in VS2022 anymore (see https://forum.unity.com/threads/how-to-enable-nullable-reference-types-in-vs-2022.1311023/ )

    It would be nice if features like Nullable could be set in the editor and persisted into the csproj so all this hackery and googling could be avoided.
     
  2. Aristonaut

    Aristonaut

    Joined:
    May 4, 2019
    Posts:
    15