CptWesley / T4.SourceGenerator

Roslyn Source Generator for T4 templates.
MIT License
2 stars 0 forks source link

support dotnet cli tool #3

Open naratteu opened 2 weeks ago

naratteu commented 2 weeks ago

Running through Visual Studio worked fine, but when trying to build from the command line, the following error occurs.

Example>dotnet --version
8.0.300

Example>dotnet run
C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\Templates\Foo.tt(1,1): error TF0003: Exce
ption thrown while generating code for T4 template 'C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerato
rs.Example\Templates\Foo.tt': System.AggregateException: One or more errors occurred. (Could not load file or assembly
'System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 지정된 파일을 찾을 수 없습니다.) [C:\Users\user
\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\T4.SourceGenerators.Example.csproj]
C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\Program.cs(1,26): error CS0234: 'T4.Sourc
eGenerator' 네임스페이스에 'Example' 형식 또는 네임스페이스 이름이 없습니다. 어셈블리 참조가 있는지 확인하세요. [C:\Users\user\source\repos\T4.SourceGenerator
\src\T4.SourceGenerators.Example\T4.SourceGenerators.Example.csproj]

빌드하지 못했습니다. 빌드 오류를 수정하고 다시 실행하세요.

Example>dotnet msbuild
msbuild 버전 17.10.4+10fbfbf2e(.NET용)
C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\Templates\Foo.tt(1,1): error TF0003: Exce
ption thrown while generating code for T4 template 'C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerato
rs.Example\Templates\Foo.tt': System.AggregateException: One or more errors occurred. (Could not load file or assembly
'System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 지정된 파일을 찾을 수 없습니다.) [C:\Users\user
\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\T4.SourceGenerators.Example.csproj]
C:\Users\user\source\repos\T4.SourceGenerator\src\T4.SourceGenerators.Example\Program.cs(1,26): error CS0234: 'T4.Sourc
eGenerator' 네임스페이스에 'Example' 형식 또는 네임스페이스 이름이 없습니다. 어셈블리 참조가 있는지 확인하세요. [C:\Users\user\source\repos\T4.SourceGenerator
\src\T4.SourceGenerators.Example\T4.SourceGenerators.Example.csproj]
---> System.IO.FileNotFoundException: Could not load file or assembly 'System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 지정된 파일을 찾을 수 없습니다.(작업 ID:108)
File name: 'System.CodeDom, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'(작업ID:108)
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)(작업 ID:108)
at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|25_0()(작업 ID:108)
at System.Reflection.MethodBaseInvoker..ctor(RuntimeMethodInfo method)(작업 ID:108)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder,Object[] parameters, CultureInfo culture)(작업 ID:108)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)(작업 ID:108)
at Mono.TextTemplating.CompiledTemplate.TemplateProcessor.CreateAndProcess(ITextTemplatingEngineHost host, CompiledAssemblyData templateAssemblyData, String templateAssemblyFile, String fullName,CultureInfo culture, String[] referencedAssemblyFiles) in /_/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.TemplateExecutor.cs:line 58(작업 ID:108)
at Mono.TextTemplating.CompiledTemplate.Process() in /_/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs:line 109(작업 ID:108)
at Mono.TextTemplating.TemplatingEngine.ProcessTemplateAsync(ParsedTemplate pt, String content, TemplateSettings settings, ITextTemplatingEngineHost host, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 90(작업 ID:108)
at Mono.TextTemplating.TemplateGenerator.ProcessTemplateAsync(ParsedTemplate pt, String inputFileName, String inputContent, String outputFileName, TemplateSettings settings, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplateGenerator.cs:line 269(작업 ID:108)
--- End of inner exception stack trace ---(작업 ID:108)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)(작업 ID:108)
at T4.SourceGenerator.T4Generator.Generate(SourceProductionContext& ctx, AdditionalText file)(작업 ID:108)
at T4.SourceGenerator.T4Generator.TryGenerate(SourceProductionContext& ctx, AdditionalText file)(작업 ID:108)
tanuj06 commented 1 week ago

Ensure that .NET Framework 4.x targeting pack is selected and installed For .NET Core and .NET 5+ projects, you might need to explicitly add the System.CodeDom package to your project.

Edit the .csproj file of the project where the T4 template is used. Add the System.CodeDom package reference:

Restore the packages before build dotnet restore

naratteu commented 4 days ago

I ran the command in codespace and got the following error:

cd ./src/T4.SourceGenerators.Example
dotnet --version
8.0.301
dotnet add package System.CodeDom --version 6.0.0
dotnet restore
dotnet build
👋 Welcome to Codespaces! You are on our default image. 
   - It includes runtimes and tools for Python, Node.js, Docker, and more. See the full list here: https://aka.ms/ghcs-default-image
   - Want to use a custom image instead? Learn more here: https://aka.ms/configure-codespace

🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).

📝 Edit away, run your app as usual, and we'll automatically make it available for you to access.

@naratteu ➜ /workspaces/T4.SourceGenerator (master) $ cd ./src/T4.SourceGenerators.Example
@naratteu ➜ /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example (master) $ dotnet --version
8.0.301
@naratteu ➜ /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example (master) $ dotnet add package System.CodeDom --version 6.0.0

Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.301

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
  Determining projects to restore...
  Writing /tmp/tmpPgA8q7.tmp
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.301/trustedroots/codesignctl.pem'.
info : X.509 certificate chain validation will use the fallback certificate bundle at '/usr/share/dotnet/sdk/8.0.301/trustedroots/timestampctl.pem'.
info : Adding PackageReference for package 'System.CodeDom' into project '/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj'.
info : Restoring packages for /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj...
info :   GET https://api.nuget.org/v3-flatcontainer/asyncfixer/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.analyzers/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/system.codedom/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.netanalyzers/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/polysharp/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/qowaiv.analyzers.csharp/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/sonaranalyzer.csharp/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/t4.sourcegenerator/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/dotnetprojectfile.analyzers/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/t4.sourcegenerator/index.json 862ms
info :   OK https://api.nuget.org/v3-flatcontainer/asyncfixer/index.json 876ms
info :   GET https://api.nuget.org/v3-flatcontainer/t4.sourcegenerator/1.2.0/t4.sourcegenerator.1.2.0.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/asyncfixer/1.6.0/asyncfixer.1.6.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/qowaiv.analyzers.csharp/index.json 882ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.netanalyzers/index.json 883ms
info :   GET https://api.nuget.org/v3-flatcontainer/qowaiv.analyzers.csharp/0.0.8/qowaiv.analyzers.csharp.0.0.8.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.netanalyzers/8.0.0-preview1.23165.1/microsoft.codeanalysis.netanalyzers.8.0.0-preview1.23165.1.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/asyncfixer/1.6.0/asyncfixer.1.6.0.nupkg 7ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.analyzers/index.json 890ms
info :   OK https://api.nuget.org/v3-flatcontainer/system.codedom/index.json 890ms
info :   OK https://api.nuget.org/v3-flatcontainer/dotnetprojectfile.analyzers/index.json 885ms
info :   GET https://api.nuget.org/v3-flatcontainer/dotnetprojectfile.analyzers/1.1.0/dotnetprojectfile.analyzers.1.1.0.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.analyzers/3.11.0-beta1.23420.2/microsoft.codeanalysis.analyzers.3.11.0-beta1.23420.2.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/system.codedom/6.0.0/system.codedom.6.0.0.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/polysharp/index.json 891ms
info :   GET https://api.nuget.org/v3-flatcontainer/polysharp/1.13.2/polysharp.1.13.2.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/system.codedom/6.0.0/system.codedom.6.0.0.nupkg 3ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.analyzers/3.11.0-beta1.23420.2/microsoft.codeanalysis.analyzers.3.11.0-beta1.23420.2.nupkg 10ms
info :   OK https://api.nuget.org/v3-flatcontainer/polysharp/1.13.2/polysharp.1.13.2.nupkg 7ms
info :   OK https://api.nuget.org/v3-flatcontainer/sonaranalyzer.csharp/index.json 911ms
info :   GET https://api.nuget.org/v3-flatcontainer/sonaranalyzer.csharp/9.12.0.78982/sonaranalyzer.csharp.9.12.0.78982.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/sonaranalyzer.csharp/9.12.0.78982/sonaranalyzer.csharp.9.12.0.78982.nupkg 8ms
info :   OK https://api.nuget.org/v3-flatcontainer/t4.sourcegenerator/1.2.0/t4.sourcegenerator.1.2.0.nupkg 223ms
info :   OK https://api.nuget.org/v3-flatcontainer/qowaiv.analyzers.csharp/0.0.8/qowaiv.analyzers.csharp.0.0.8.nupkg 842ms
info :   OK https://api.nuget.org/v3-flatcontainer/dotnetprojectfile.analyzers/1.1.0/dotnetprojectfile.analyzers.1.1.0.nupkg 874ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.codeanalysis.netanalyzers/8.0.0-preview1.23165.1/microsoft.codeanalysis.netanalyzers.8.0.0-preview1.23165.1.nupkg 897ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.app.ref/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.host.linux-x64/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.ref/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.host.linux-x64/index.json 217ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.app.ref/index.json 220ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.ref/index.json 854ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.ref/7.0.20/microsoft.netcore.app.ref.7.0.20.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.ref/7.0.20/microsoft.netcore.app.ref.7.0.20.nupkg 3ms
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.host.linux-x64/7.0.20/microsoft.netcore.app.host.linux-x64.7.0.20.nupkg
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.app.ref/7.0.20/microsoft.aspnetcore.app.ref.7.0.20.nupkg
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app.host.linux-x64/7.0.20/microsoft.netcore.app.host.linux-x64.7.0.20.nupkg 5ms
info :   OK https://api.nuget.org/v3-flatcontainer/microsoft.aspnetcore.app.ref/7.0.20/microsoft.aspnetcore.app.ref.7.0.20.nupkg 101ms
info : Installed Microsoft.NETCore.App.Host.linux-x64 7.0.20 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/microsoft.netcore.app.host.linux-x64/7.0.20 with content hash N4JRZmBDCpO2UYSOR6CtrtBeOjSvx0cqYmYYDRVjPlu/FIVyCpN3VWMbdzjMfMmKrrMwt1sCEDn0cAuU6/MuVg==.
info : Installed Microsoft.AspNetCore.App.Ref 7.0.20 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/microsoft.aspnetcore.app.ref/7.0.20 with content hash dF49BcC6naWUSlIN+WGwhTxLIxlvQzDa8m7iWg5mHc4IIrtnR4oO+2Se808pA4w80yjEVA2/2c/oN3BTVFp4Ew==.
info : Installed SonarAnalyzer.CSharp 9.12.0.78982 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/sonaranalyzer.csharp/9.12.0.78982 with content hash QxhfMFCNeZWP3gP/R8QM3MuDWm+Esj8Lt3oD61tid5TPuqsaKJtwMZNZWE2FOqqGuKlu3805o8MlkTWBL75skA==.
info : Installed Microsoft.NETCore.App.Ref 7.0.20 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/microsoft.netcore.app.ref/7.0.20 with content hash Ek577ILlxN7dJToJhvoO+u0jPG9iPHyUgHcGTDdMut8hzSxahbZBxE8gYK4Xq7/466ujXVXtv0iMvH7IGuIucQ==.
info : Installed System.CodeDom 6.0.0 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/system.codedom/6.0.0 with content hash CPc6tWO1LAer3IzfZufDBRL+UZQcj5uS207NHALQzP84Vp/z6wF0Aa0YZImOQY8iStY0A2zI/e3ihKNPfUm8XA==.
info : Installed T4.SourceGenerator 1.2.0 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/t4.sourcegenerator/1.2.0 with content hash k4mU0x6rfqdS6v3UU/zokB/yaD6n6aQp4o6VRvLq+1LHCQ77fQXSGh8RPMXNJNNchHYgioc99lv05E3gZVzcuQ==.
info : Installed Qowaiv.Analyzers.CSharp 0.0.8 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/qowaiv.analyzers.csharp/0.0.8 with content hash tjFfl6jKReGoByqA0xahjuQ2+5vA4UPTvngerbuDESuFSO0rshk9RbPaJZFAMWq+ejl/ZgjhwgUmrg+oDghkAw==.
info : Installed AsyncFixer 1.6.0 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/asyncfixer/1.6.0 with content hash /Xfs9H3UMfEv64cwT+C/JrTRp4w08BmPuFbj0ageadCHpx6rxYJxAU2C6sEqRFG22xmGk5cX9ewzoiiehWVHOw==.
info : Installed PolySharp 1.13.2+0596138b111ff552137684c6f7c3373805d2e3d2 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/polysharp/1.13.2 with content hash XwNhfkr7IeUiH8AE4pzob8YioxfL6nxgAx+fHEeWCObY/NZuBMfWLh39FznXbneKvagiqeeI7quIvZ6P1eVaEA==.
info : Installed DotNetProjectFile.Analyzers 1.1.0 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/dotnetprojectfile.analyzers/1.1.0 with content hash RSyxlmgaaIbITfs9XHb9hGttziFhS9heOBSibf+lKSrdOhYpSJEuLipWz1HQ+GAZpojOfiBS8ao7tQuhVCuZuw==.
info : Installed Microsoft.CodeAnalysis.Analyzers 3.11.0-beta1.23420.2 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/microsoft.codeanalysis.analyzers/3.11.0-beta1.23420.2 with content hash TXazD+ljZOOOwnDTl4+TmkbvI01iGq1/vfX42F7D8SvjmtgHPIDCTyEn/epIq9q9boNbPIKD1LhD0usQ6yoRAg==.
info : Installed Microsoft.CodeAnalysis.NetAnalyzers 8.0.0-preview1.23165.1 from https://api.nuget.org/v3/index.json to /home/codespace/.nuget/packages/microsoft.codeanalysis.netanalyzers/8.0.0-preview1.23165.1 with content hash 0OwNin5K0hEXpV3WU8AwtZ48Dt5jLTu4wGjHsMfnstJ1HJj/qL/rZSCtLiZPqOgR2MyAfp28uNw5AEuJpLMggA==.
info :   GET https://api.nuget.org/v3/vulnerabilities/index.json
info :   OK https://api.nuget.org/v3/vulnerabilities/index.json 4ms
info :   GET https://api.nuget.org/v3-vulnerabilities/2024.06.28.05.31.02/vulnerability.base.json
info :   GET https://api.nuget.org/v3-vulnerabilities/2024.06.28.05.31.02/2024.06.28.23.31.03/vulnerability.update.json
info :   OK https://api.nuget.org/v3-vulnerabilities/2024.06.28.05.31.02/vulnerability.base.json 3ms
info :   OK https://api.nuget.org/v3-vulnerabilities/2024.06.28.05.31.02/2024.06.28.23.31.03/vulnerability.update.json 2ms
info : Package 'System.CodeDom' is compatible with all the specified frameworks in project '/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj'.
info : PackageReference for package 'System.CodeDom' version '6.0.0' added to file '/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj'.
info : Generating MSBuild file /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/obj/T4.SourceGenerators.Example.csproj.nuget.g.props.
info : Generating MSBuild file /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/obj/T4.SourceGenerators.Example.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/obj/project.assets.json
log  : Restored /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj (in 6.58 sec).
@naratteu ➜ /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example (master) $ dotnet restore
  Determining projects to restore...
  All projects are up-to-date for restore.
@naratteu ➜ /workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example (master) $ dotnet build
  Determining projects to restore...
  All projects are up-to-date for restore.
/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Templates/Foo.tt(1,1): error TF0003: Exception thrown while generating code for T4 template '/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Templates/Foo.tt': System.AggregateException: One or more errors occurred. (The value cannot be an empty string. (Parameter 'assemblyName')) [/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj]
/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Program.cs(1,26): error CS0234: The type or namespace name 'Example' does not exist in the namespace 'T4.SourceGenerator' (are you missing an assembly reference?) [/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj]

Build FAILED.

/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Templates/Foo.tt(1,1): error TF0003: Exception thrown while generating code for T4 template '/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Templates/Foo.tt': System.AggregateException: One or more errors occurred. (The value cannot be an empty string. (Parameter 'assemblyName')) [/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj]
/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/Program.cs(1,26): error CS0234: The type or namespace name 'Example' does not exist in the namespace 'T4.SourceGenerator' (are you missing an assembly reference?) [/workspaces/T4.SourceGenerator/src/T4.SourceGenerators.Example/T4.SourceGenerators.Example.csproj]
    0 Warning(s)
    2 Error(s)

Time Elapsed 00:00:03.93
tanuj06 commented 1 day ago

can you check and share your foo.tt file I think it is missing the 'AssemblyName' parameter. it should be something like <#@ assembly name="System.Core" #>

Make sure that all necessary project references are added in the T4.SourceGenerator project file check program.cs has the line

using T4.SourceGenerator.Example;

then try

dotnet clean dotnet restore dotnet build

it will be better if you can help make me understand your codebase structure.