{"id":317985,"date":"2021-02-14T03:00:53","date_gmt":"2021-02-14T03:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317985"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317985","title":{"rendered":".NET 5 + Source Generator = Javascript"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e SPA (Vue\/React) \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 C#.<\/p>\n<p>  \u0412 .NET 5 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f source generator. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 source generator \u0438 \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0421\u0430\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f UI \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Visual Studio 2019.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0418\u0442\u0430\u043a, \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<br \/>  1. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 js \/ vue \/ jsx \u0444\u0430\u0439\u043b\u043e\u0432<br \/>  2. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<br \/>  3. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<br \/>  4. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Newtonsoft.Json<br \/>  5. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<br \/>  6. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c\/\u0442\u0438\u043f\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0430\u0445<br \/>  7. \u041e\u0442\u043b\u0430\u0434\u043a\u0430<\/p>\n<h2>\u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e T4<\/h2>\n<p>  \u0412 .NET 4.x \u0435\u0441\u0442\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 T4. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e. \u0411\u044b\u043b \u0440\u044f\u0434 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0430\u043b\u0438\u0441\u044c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u0443\u0441\u043f\u0435\u0445\u043e\u043c. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 .NET 5 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0447\u0443\u0436\u0434\u0443\u044e (\u0434\u043b\u044f .NET 4.x \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430) AspNetCore \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u2014 \u0442\u0443\u0442 \u043c\u043e\u0439 \u043c\u043e\u0437\u0433 \u0437\u0430\u0448\u0435\u043b \u0432 \u0442\u0443\u043f\u0438\u043a. T4 \u043d\u0438 \u0432 \u043a\u0430\u043a\u0443\u044e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u0435\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0438 \u0433\u0440\u0443\u0437\u0438\u0442\u044c.<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  \u0412\u0441\u0435 \u043d\u043e\u0432\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Microsoft \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 Hello World, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u043a\u0440\u0443\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0448\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0442\u043e \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u0441 \u043a\u0443\u0447\u0435\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0440\u0430\u0437 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0412 Hello World \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0430. \u0410 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0445 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e.<\/p>\n<p>  \u041c\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u0447\u0435\u0442\u044b\u0440\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438:<br \/>  1. NetGenerator5.Web \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (net5.0), \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 \u0438 \u0441\u0430\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<br \/>  2. NetGenerator5.Model \u2014 c\u0431\u043e\u0440\u043a\u0430 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 (net5.0)<br \/>  3. NetGenerator5.Generator \u2014 c\u0431\u043e\u0440\u043a\u0430 \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c (netstandard2.0)<br \/>  4. NetGenerator5.Generator.Dependency \u2014 \u0443\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 (netstandard2.0)<\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440<\/h2>\n<p>  \u041a\u043b\u0430\u0441\u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 ISourceGenerator \u0441 \u0434\u0432\u0443\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u2014 Initialize \u0438 Execute. \u041c\u0435\u0442\u043e\u0434 Execute \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<p>  \u0421\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;    &lt;PropertyGroup&gt;     &lt;TargetFramework&gt;netstandard2.0&lt;\/TargetFramework&gt;     &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;     &lt;GeneratePackageOnBuild&gt;false&lt;\/GeneratePackageOnBuild&gt;     &lt;IncludeBuildOutput&gt;false&lt;\/IncludeBuildOutput&gt;   &lt;\/PropertyGroup&gt;    &lt;ItemGroup&gt;     &lt;PackageReference Include=&quot;Microsoft.CodeAnalysis.CSharp&quot; Version=&quot;3.8.0&quot; PrivateAssets=&quot;all&quot; \/&gt;     &lt;PackageReference Include=&quot;Microsoft.CodeAnalysis.Analyzers&quot; Version=&quot;3.3.2&quot; PrivateAssets=&quot;all&quot; \/&gt;   &lt;\/ItemGroup&gt;  &lt;\/Project&gt; <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0435\u0433\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c? \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 (NetGenerator5.Web), \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<pre><code class=\"xml\">&lt;PropertyGroup&gt;   &lt;TargetFramework&gt;net5.0&lt;\/TargetFramework&gt;   &lt;EmitCompilerGeneratedFiles&gt;true&lt;\/EmitCompilerGeneratedFiles&gt;   &lt;CompilerGeneratedFilesOutputPath&gt;$(BaseIntermediateOutputPath)\\GeneratedFiles&lt;\/CompilerGeneratedFilesOutputPath&gt; &lt;\/PropertyGroup&gt;  &lt;ItemGroup&gt;   &lt;ProjectReference Include=&quot;..\\NetGenerator5.Generator\\NetGenerator5.Generator.csproj&quot; OutputItemType=&quot;Analyzer&quot; ReferenceOutputAssembly=&quot;false&quot; \/&gt; &lt;\/ItemGroup&gt; <\/code><\/pre>\n<p>  <\/p>\n<h2>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 js \/ vue \/ jsx \u0444\u0430\u0439\u043b\u043e\u0432<\/h2>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 cs \u0444\u0430\u0439\u043b\u044b \u0441 C# \u043a\u043e\u0434\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Execute \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 GeneratorExecutionContext.AddSource. \u041f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0443 \u043d\u0438\u0445, \u044f \u0442\u0430\u043a \u043f\u043e\u043d\u044f\u043b, \u043d\u0435\u043b\u044c\u0437\u044f \u0438 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0442\u0430\u043a \u0436\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u043a\u043e\u0434 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c. Visual Studio \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f js \/ vue \/ jsx \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434. \u041e\u0431\u044b\u0447\u043d\u044b\u0439 System.IO.File.WriteAllText \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433. \u041d\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b, \u0442.\u0435. \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<h2>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h2>\n<p>  \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  \u041f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c NetGenerator5.Web \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"xml\">&lt;ItemGroup&gt;   &lt;CompilerVisibleProperty Include=&quot;MSBuildProjectDirectory&quot; \/&gt; &lt;\/ItemGroup&gt; <\/code><\/pre>\n<p>  \u042d\u0442\u0438\u043c \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f source generator.<\/p>\n<p>  \u0410 \u0432 \u0441\u0430\u043c\u043e\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043a \u043d\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Execute \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<pre><code class=\"java\">context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(&quot;build_property.MSBuildProjectDirectory&quot;, out var projectDirectory) <\/code><\/pre>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c \u043a\u0443\u0434\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0432\u0435\u0431 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 wwwroot\/js). \u041c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 \u0444\u0430\u0439\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 generatorsettings.json, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0441\u044f \u0431\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043a\u0430\u043a-\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043d\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0443.<\/p>\n<h2>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0430\u0439\u043b\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/h2>\n<p>  \u0412 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 GeneratorExecutionContext.AdditionalFiles \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 Execute. \u0427\u0442\u043e\u0431\u044b \u043c\u043e\u0439 \u0444\u0430\u0439\u043b \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0442\u0430\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0443 \u043d\u0435\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e Build Action=C# analyzer additional file, \u0438\u043b\u0438 \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"xml\">&lt;ItemGroup&gt;   &lt;AdditionalFiles Include=&quot;generatorsettings.json&quot; \/&gt; &lt;\/ItemGroup&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c  <\/p>\n<pre><code class=\"java\">var content = context.AdditionalFiles.First(e =&gt; e.Path.EndsWith(&quot;generatorsettings.json&quot;)).GetText(context.CancellationToken);<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u044d\u0442\u043e \u0436\u0435 json, \u0430 \u043a\u0430\u043a \u043c\u043d\u0435, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c?<\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u044e\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 Newtonsoft.Json. \u0412\u043e\u0442 \u0442\u0443\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a. \u042f \u0435\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u0447\u0435\u0440\u0435\u0437 nuget, \u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043d\u0438 \u0432 \u043a\u0430\u043a\u0443\u044e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<pre><code class=\"java\">Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies.<\/code><\/pre>\n<p>  \u0438 \u0445\u043e\u0442\u044c \u0442\u044b \u0442\u0440\u0435\u0441\u043d\u0438.<\/p>\n<p>  \u0412 <a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.cookbook.md#use-functionality-from-nuget-packages\" rel=\"nofollow noopener noreferrer\">cookbook <\/a> \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0439 \u044d\u0442\u043e\u043c\u0443 <br \/>  \u0422\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u2014 \u043a\u0430\u043a \u0441\u0432\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 nuget \u043f\u0430\u043a\u0435\u0442\u0430. \u041c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443-\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u043b\u043e.<\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0435\u0448\u0438\u043b \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c. \u042f \u0442\u0443\u043f\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u0430\u043c\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u0430\u043a \u0444\u0430\u0439\u043b \u0438 \u0443\u043a\u0430\u0437\u0430\u043b \u0434\u043b\u044f \u043d\u0435\u0435 Copy to Output Directory = Copy always \/ Copy if newer \u0438 \u0432\u0441\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e. \u041d\u043e \u043f\u043e\u0437\u0436\u0435 \u043c\u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u043c\u0443 roslyn. \u0421\u043e\u0432\u0435\u0442 \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;ItemGroup&gt;     &lt;!-- Generator dependencies --&gt;     &lt;PackageReference Include=&quot;Newtonsoft.Json&quot; Version=&quot;12.0.3&quot; GeneratePathProperty=&quot;true&quot; PrivateAssets=&quot;all&quot; \/&gt;   &lt;\/ItemGroup&gt;    &lt;ItemGroup&gt;     &lt;ProjectReference Include=&quot;..\\NetGenerator5.Generator.Dependency\\NetGenerator5.Generator.Dependency.csproj&quot; \/&gt;   &lt;\/ItemGroup&gt;    &lt;PropertyGroup&gt;     &lt;GetTargetPathDependsOn&gt;$(GetTargetPathDependsOn);GetDependencyTargetPaths&lt;\/GetTargetPathDependsOn&gt;   &lt;\/PropertyGroup&gt;    &lt;Target Name=&quot;GetDependencyTargetPaths&quot;&gt;     &lt;ItemGroup&gt;       &lt;TargetPathWithTargetPlatformMoniker Include=&quot;$(PKGNewtonsoft_Json)\\lib\\netstandard2.0\\Newtonsoft.Json.dll&quot; IncludeRuntimeDependency=&quot;false&quot; \/&gt;     &lt;\/ItemGroup&gt;   &lt;\/Target&gt; <\/code><\/pre>\n<p>  \u0418\u043b\u0438, \u043a\u0430\u043a \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 System.Text.Json.<\/p>\n<h2>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0438\u0445 \u0441\u0431\u043e\u0440\u043e\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h2>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u043e\u0438 \u0441\u0431\u043e\u0440\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f Vue \u0438 React \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u0442\u044c \u043f\u043e \u0434\u0432\u0443\u043c \u0440\u0430\u0437\u043d\u044b\u043c \u0441\u0431\u043e\u0440\u043a\u0430\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0438\u0445 \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0443 \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041a\u0430\u043a \u043d\u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0433\u043b\u0430\u0434\u043a\u043e. \u042f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b NetGenerator5.Generator.Dependency \u0447\u0435\u0440\u0435\u0437 Dependencies \u2014 Add Project Reference. \u0425\u043e\u0442\u044f \u0443 <a href=\"https:\/\/github.com\/dotnet\/roslyn\/discussions\/48746\" rel=\"nofollow noopener noreferrer\">\u043a\u043e\u0433\u043e-\u0442\u043e<\/a> \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h2>\u0414\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c\/\u0442\u0438\u043f\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043a\u0430\u0445<\/h2>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443. \u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u2014 \u043c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c\/\u0442\u0438\u043f\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u043c\u043e\u0434\u0435\u043b\u0435\u0439. Microsoft <a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.cookbook.md#augment-user-code\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 <\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SyntaxReceiver <br \/>  \u041d\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u0442.\u0435. \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 NetGenerator5.Web), \u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 NetGenerator5.Model \u0442\u0430\u043c \u043d\u0435\u0442. <\/p>\n<p>  \u0412 \u0442\u043e\u043c \u0436\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439 roslyn \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e <a href=\"https:\/\/github.com\/dotnet\/roslyn\/discussions\/50874\" rel=\"nofollow noopener noreferrer\">\u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 GeneratorExecutionContext \u0435\u0441\u0442\u044c Compilation.GlobalNamespace. \u041f\u043e \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0439\u0442\u0438\u0441\u044c \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u0438 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<h2>\u041e\u0442\u043b\u0430\u0434\u043a\u0430<\/h2>\n<p>  \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 Initialize<\/p>\n<pre><code class=\"java\">#if DEBUG   if (!Debugger.IsAttached)   {     Debugger.Launch();   } #endif <\/code><\/pre>\n<p>  \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0431\u0438\u043b\u0434\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043a\u043d\u043e \u0441 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a. \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u044c OK \u2014 \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 Visual Studio \u0438 \u0432 \u043d\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0436\u0438\u043c \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u044c \u0432\u0441\u0435\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0434\u0430\u0436\u0435 \u0432 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 NetGenerator5.Generator.Dependency<\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 NetGenerator5.Web \/ wwwroot\/js \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b generated.js, \u0430 \u0432 NetGenerator5.Web\\obj\\GeneratedFiles\\NetGenerator5.Generator\\NetGenerator5.Generator.SourceGenerator \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u043f\u0443\u0441\u0442\u044b\u0448\u043a\u0430 generated.cs<\/p>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/onetsmr\/NetGenerator5\" rel=\"nofollow noopener noreferrer\">\u0442\u0443\u0442<\/a><\/p>\n<h2>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438<\/h2>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/amis92\/csharp-source-generators\" rel=\"nofollow noopener noreferrer\">github.com\/amis92\/csharp-source-generators<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.md\" rel=\"nofollow noopener noreferrer\">github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.md<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.cookbook.md\" rel=\"nofollow noopener noreferrer\">github.com\/dotnet\/roslyn\/blob\/master\/docs\/features\/source-generators.cookbook.md<\/a><\/li>\n<li><a href=\"https:\/\/mihailromanov.wordpress.com\/2021\/01\/31\/net-code-generation-part-6-c-source-generators\" rel=\"nofollow noopener noreferrer\">mihailromanov.wordpress.com\/2021\/01\/31\/net-code-generation-part-6-c-source-generators<\/a><\/li>\n<li><a href=\"https:\/\/dominikjeske.github.io\/source-generators\/\" rel=\"nofollow noopener noreferrer\">dominikjeske.github.io\/source-generators<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/roslyn\/discussions\" rel=\"nofollow noopener noreferrer\">github.com\/dotnet\/roslyn\/discussions<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/530454\">habr.com\/ru\/post\/530454<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/533128\">habr.com\/ru\/post\/533128<\/a><\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/542300\/\"> https:\/\/habr.com\/ru\/post\/542300\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0417\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e SPA (Vue\/React) \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 C#.<\/p>\n<p>  \u0412 .NET 5 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f source generator. \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 source generator \u0438 \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0421\u0430\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f UI \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Visual Studio 2019.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-317985","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=317985"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317985\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}