public sealed class CodeGeneratorRequest : IMessage<CodeGeneratorRequest>, IEquatable<CodeGeneratorRequest>, IDeepCloneable<CodeGeneratorRequest>, IBufferMessage, IMessage
An encoded CodeGeneratorRequest is written to the plugin's stdin.
public RepeatedField<string> FileToGenerate { get; }
The .proto files that were explicitly listed on the command-line. The
code generator should generate code only for these files. Each file's
descriptor will be included in proto_file, below.
public RepeatedField<FileDescriptorProto> ProtoFile { get; }
FileDescriptorProtos for all files in files_to_generate and everything
they import. The files will appear in topological order, so each file
appears before any file that imports it.
Note: the files listed in files_to_generate will include runtime-retention
options only, but all other files will include source-retention options.
The source_file_descriptors field below is available in case you need
source-retention options for files_to_generate.
protoc guarantees that all proto_files will be written after
the fields above, even though this is not technically guaranteed by the
protobuf wire format. This theoretically could allow a plugin to stream
in the FileDescriptorProtos and handle them one by one rather than read
the entire set into memory at once. However, as of this writing, this
is not similarly optimized on protoc's end -- it will store all fields in
memory at once before sending them to the plugin.
Type names of fields and extensions in the FileDescriptorProto are always
fully qualified.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eCodeGeneratorRequest\u003c/code\u003e class is used to receive data, as an encoded request, from a plugin's standard input stream.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements several interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and inherits from the \u003ccode\u003eobject\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eIt contains several fields, such as \u003ccode\u003eCompilerVersionFieldNumber\u003c/code\u003e, \u003ccode\u003eFileToGenerateFieldNumber\u003c/code\u003e, \u003ccode\u003eParameterFieldNumber\u003c/code\u003e, \u003ccode\u003eProtoFileFieldNumber\u003c/code\u003e, and \u003ccode\u003eSourceFileDescriptorsFieldNumber\u003c/code\u003e, each representing a different aspect of the code generation process.\u003c/p\u003e\n"],["\u003cp\u003eKey properties include \u003ccode\u003eCompilerVersion\u003c/code\u003e, \u003ccode\u003eFileToGenerate\u003c/code\u003e, \u003ccode\u003eHasParameter\u003c/code\u003e, \u003ccode\u003eParameter\u003c/code\u003e, \u003ccode\u003eProtoFile\u003c/code\u003e, and \u003ccode\u003eSourceFileDescriptors\u003c/code\u003e, offering details on the protocol compiler's version, files to be generated, command-line parameters, and file descriptors.\u003c/p\u003e\n"],["\u003cp\u003eThe class provides various methods for handling data, such as \u003ccode\u003eCalculateSize()\u003c/code\u003e, \u003ccode\u003eClearParameter()\u003c/code\u003e, \u003ccode\u003eClone()\u003c/code\u003e, \u003ccode\u003eEquals()\u003c/code\u003e, \u003ccode\u003eGetHashCode()\u003c/code\u003e, \u003ccode\u003eMergeFrom()\u003c/code\u003e, \u003ccode\u003eToString()\u003c/code\u003e, and \u003ccode\u003eWriteTo()\u003c/code\u003e, as well as a variety of extension methods.\u003c/p\u003e\n"]]],[],null,["# Class CodeGeneratorRequest (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Compiler.CodeGeneratorRequest)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Compiler.CodeGeneratorRequest)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Compiler.CodeGeneratorRequest) \n\n public sealed class CodeGeneratorRequest : IMessage\u003cCodeGeneratorRequest\u003e, IEquatable\u003cCodeGeneratorRequest\u003e, IDeepCloneable\u003cCodeGeneratorRequest\u003e, IBufferMessage, IMessage\n\nAn encoded CodeGeneratorRequest is written to the plugin's stdin. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e CodeGeneratorRequest \n\nImplements\n----------\n\n[IMessage](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1)[CodeGeneratorRequest](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Compiler.CodeGeneratorRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[CodeGeneratorRequest](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Compiler.CodeGeneratorRequest), [IDeepCloneable](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1)[CodeGeneratorRequest](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Compiler.CodeGeneratorRequest), [IBufferMessage](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage), [IMessage](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage) \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Protobuf.Compiler](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Compiler)\n\nAssembly\n--------\n\nGoogle.Protobuf.dll\n\nConstructors\n------------\n\n### CodeGeneratorRequest()\n\n public CodeGeneratorRequest()\n\n### CodeGeneratorRequest(CodeGeneratorRequest)\n\n public CodeGeneratorRequest(CodeGeneratorRequest other)\n\nFields\n------\n\n### CompilerVersionFieldNumber\n\n public const int CompilerVersionFieldNumber = 3\n\nField number for the \"compiler_version\" field.\n\n### FileToGenerateFieldNumber\n\n public const int FileToGenerateFieldNumber = 1\n\nField number for the \"file_to_generate\" field.\n\n### ParameterFieldNumber\n\n public const int ParameterFieldNumber = 2\n\nField number for the \"parameter\" field.\n\n### ProtoFileFieldNumber\n\n public const int ProtoFileFieldNumber = 15\n\nField number for the \"proto_file\" field.\n\n### SourceFileDescriptorsFieldNumber\n\n public const int SourceFileDescriptorsFieldNumber = 17\n\nField number for the \"source_file_descriptors\" field.\n\nProperties\n----------\n\n### CompilerVersion\n\n public Version CompilerVersion { get; set; }\n\nThe version number of protocol compiler.\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### FileToGenerate\n\n public RepeatedField\u003cstring\u003e FileToGenerate { get; }\n\nThe .proto files that were explicitly listed on the command-line. The\ncode generator should generate code only for these files. Each file's\ndescriptor will be included in proto_file, below.\n\n### HasParameter\n\n public bool HasParameter { get; }\n\nGets whether the \"parameter\" field is set\n\n### Parameter\n\n public string Parameter { get; set; }\n\nThe generator parameter passed on the command-line.\n\n### Parser\n\n public static MessageParser\u003cCodeGeneratorRequest\u003e Parser { get; }\n\n### ProtoFile\n\n public RepeatedField\u003cFileDescriptorProto\u003e ProtoFile { get; }\n\nFileDescriptorProtos for all files in files_to_generate and everything\nthey import. The files will appear in topological order, so each file\nappears before any file that imports it.\n\nNote: the files listed in files_to_generate will include runtime-retention\noptions only, but all other files will include source-retention options.\nThe source_file_descriptors field below is available in case you need\nsource-retention options for files_to_generate.\n\nprotoc guarantees that all proto_files will be written after\nthe fields above, even though this is not technically guaranteed by the\nprotobuf wire format. This theoretically could allow a plugin to stream\nin the FileDescriptorProtos and handle them one by one rather than read\nthe entire set into memory at once. However, as of this writing, this\nis not similarly optimized on protoc's end -- it will store all fields in\nmemory at once before sending them to the plugin.\n\nType names of fields and extensions in the FileDescriptorProto are always\nfully qualified.\n\n### SourceFileDescriptors\n\n public RepeatedField\u003cFileDescriptorProto\u003e SourceFileDescriptors { get; }\n\nFile descriptors with all options, including source-retention options.\nThese descriptors are only provided for the files listed in\nfiles_to_generate.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\nCalculates the size of this message in Protocol Buffer wire format, in bytes.\n\n### ClearParameter()\n\n public void ClearParameter()\n\nClears the value of the \"parameter\" field\n\n### Clone()\n\n public CodeGeneratorRequest Clone()\n\nCreates a deep clone of this object.\n\n### Equals(CodeGeneratorRequest)\n\n public bool Equals(CodeGeneratorRequest other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\nMerges the data from the specified coded input stream with the current message.\n\n**Remarks** \nSee the user guide for precise merge semantics.\n\n### MergeFrom(CodeGeneratorRequest)\n\n public void MergeFrom(CodeGeneratorRequest other)\n\nMerges the given message into this one.\n\n**Remarks** \nSee the user guide for precise merge semantics.\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)\n\nWrites the data to the given coded output stream.\n\nExtension Methods\n-----------------\n\n[MessageExtensions.IsInitialized(IMessage)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_IsInitialized_Google_Protobuf_IMessage_) \n[MessageExtensions.MergeDelimitedFrom(IMessage, Stream)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeDelimitedFrom_Google_Protobuf_IMessage_System_IO_Stream_) \n[MessageExtensions.MergeFrom(IMessage, ByteString)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_Google_Protobuf_ByteString_) \n[MessageExtensions.MergeFrom(IMessage, ReadOnlySequence\\\u003cbyte\\\u003e)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Buffers_ReadOnlySequence_System_Byte__) \n[MessageExtensions.MergeFrom(IMessage, byte\\[\\])](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Byte___) \n[MessageExtensions.MergeFrom(IMessage, byte\\[\\], int, int)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_Byte___System_Int32_System_Int32_) \n[MessageExtensions.MergeFrom(IMessage, Stream)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_IO_Stream_) \n[MessageExtensions.MergeFrom(IMessage, ReadOnlySpan\\\u003cbyte\\\u003e)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_MergeFrom_Google_Protobuf_IMessage_System_ReadOnlySpan_System_Byte__) \n[MessageExtensions.ToByteArray(IMessage)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_ToByteArray_Google_Protobuf_IMessage_) \n[MessageExtensions.ToByteString(IMessage)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_ToByteString_Google_Protobuf_IMessage_) \n[MessageExtensions.WriteDelimitedTo(IMessage, Stream)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteDelimitedTo_Google_Protobuf_IMessage_System_IO_Stream_) \n[MessageExtensions.WriteTo(IMessage, IBufferWriter\\\u003cbyte\\\u003e)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_Buffers_IBufferWriter_System_Byte__) \n[MessageExtensions.WriteTo(IMessage, Stream)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_IO_Stream_) \n[MessageExtensions.WriteTo(IMessage, Span\\\u003cbyte\\\u003e)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.MessageExtensions#Google_Protobuf_MessageExtensions_WriteTo_Google_Protobuf_IMessage_System_Span_System_Byte__)"]]