If your Unity project uses a part of the .NET class library API that Unity doesn’t compile by default, you can provide the C# compiler with a list of additional assemblies to reference during compilation. The behavior depends on which .NET profile the project uses. For more information, see .NET Profile support.
If your project uses the .NET Standard profile, all parts of the .NET class library API are referenced by default. You can’t reference additional assemblies. If part of the API seems to be missing, it might not be included with .NET Standard. Try using the .NET Framework profile instead. To avoid compilation problems when you change profiles, see Switching between profiles.
By default, Unity references the following assemblies when you use the .NET Framework profile:
To reference any other class library assemblies, use a csc.rsp file: a response file that contains a list of command line arguments that you can pass to the C# compiler. To use a csc.rsp file, follow the below instructions:
Assetsfolder of your Unity project.
Assetsfolder of your project, if they aren’t already in this folder.
For example, if your project uses the
HttpClient class, which is defined in the
System.Net.Http.dll assembly, the C# compiler might produce this initial error message if the assembly isn’t present:
The type `HttpClient` is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Http, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. (タイプ `HttpClient` は参照されていないアセンブリで定義されています。アセンブリに参照を加える必要があります。'System.Net.Http, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' )
To resolve this error, add a csc.rsp file that contains the following command line argument to the project:
Add a new line with the appropriate command line argument for each assembly you want to reference.
When you use a csc.rsp file to reference class library assemblies and you change the .NET profile, you might experience compilation problems.
If you change the .NET profile from .NET Framework to .NET Standard and your csc.rsp file references an assembly that doesn’t exist in the .NET Standard profile, then compilation fails. To solve the issue, edit the csc.rsp file to remove any references to assemblies that are exclusive to the .NET Framework profile before you change the .NET profile to .NET Standard.