LoginSignup
0
0

More than 1 year has passed since last update.

Unity向けにSource GeneratorをRiderで作成する方法の補足

Last updated at Posted at 2023-03-17

概要

Unity向けにRiderからSource Generatorを作成する際に
「.NET Standard 2.0」を選択する必要があります。

しかし、自分の環境ではその選択ができなかったため、そういった場合の対応方法について備忘録として残しておきます。

次の画像のように「.Net Standard 2.0」は表示されず、net7.0やnet6.0のみ表示されています。
image.png

対応方法

  1. そのまま気にせずプロジェクトを作成する

  2. 「.csproj」を編集する
    .csprojを右クリックし「Edit > Edit 'XXX.csproj'」を押下する
    image.png

  3. .csprojの内容を書き換える

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <ImplicitUsings>disable</ImplicitUsings>
        <Nullable>disable</Nullable>

        <LangVersion>9.0</LangVersion>
        <IsRoslynComponent>true</IsRoslynComponent>
        <AnalyzerLanguage>cs</AnalyzerLanguage>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Microsoft.CodeAnalysis" Version="3.8.0" />
    </ItemGroup>

</Project>

以上で設定は終了です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0