Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T4 doesn't work on mac #185

Open
trampster opened this issue May 22, 2024 · 1 comment
Open

T4 doesn't work on mac #185

trampster opened this issue May 22, 2024 · 1 comment

Comments

@trampster
Copy link

trampster commented May 22, 2024

After installing it fail to run with the following error:

System.AggregateException: One or more errors occurred. (Could not find a part of the path '/usr/local/share/dotnet/x64/sdk'.)
---> System.IO.DirectoryNotFoundException: Could not find a part of the path '/usr/local/share/dotnet/x64/sdk'.
at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path, Boolean ignoreNotFound) at System.IO.Enumeration.FileSystemEnumerator1.Init()
at System.IO.Enumeration.FileSystemEnumerable1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized) at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options) at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options) at Mono.TextTemplating.CodeCompilation.RuntimeInfo.FindHighestVersionedDirectory(String parentFolder, Func2 validate, SemVersion& bestVersion) in //Mono.TextTemplating/Mono.TextTemplating.CodeCompilation/RuntimeInfo.cs:line 158
at Mono.TextTemplating.CodeCompilation.RuntimeInfo.GetDotNetCoreSdk() in /
/Mono.TextTemplating/Mono.TextTemplating.CodeCompilation/RuntimeInfo.cs:line 137
at Mono.TextTemplating.CodeCompilation.RuntimeInfo.GetRuntime() in //Mono.TextTemplating/Mono.TextTemplating.CodeCompilation/RuntimeInfo.cs:line 71
at Mono.TextTemplating.TemplatingEngine.GetOrCreateCompiler() in /
/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 65
at Mono.TextTemplating.TemplatingEngine.CompileCode(IEnumerable1 references, TemplateSettings settings, CodeCompileUnit ccu, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 303 at Mono.TextTemplating.TemplatingEngine.CompileTemplateInternal(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 277 at Mono.TextTemplating.TemplatingEngine.ProcessTemplateAsync(ParsedTemplate pt, String content, TemplateSettings settings, ITextTemplatingEngineHost host, CancellationToken token) in /_/Mono.TextTemplating/Mono.TextTemplating/TemplatingEngine.cs:line 88 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 --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Mono.TextTemplating.TextTransform.MainInternal(String[] args) in //dotnet-t4/TextTransform.cs:line 226
at Mono.TextTemplating.TextTransform.Main(String[] args) in /
/dotnet-t4/TextTransform.cs:line 42

The folder it is complaining about being missing /usr/local/share/dotnet/x64/sdk is indeed missing, it is there all upto the x64 but the sdk subfolder is not there I have the dotnet sdk 8.0.5 installed from here: https://dotnet.microsoft.com/en-us/download/dotnet/8.0

I do have a sdk folder in /usr/local/share/dotnet/sdk.

I have a M2 mac which is arm based so it makes sense I don't have stuff under 'x64'

@mhutch
Copy link
Member

mhutch commented May 23, 2024

It's possible to install the x64 and ARM versions of .NET on an ARM based Mac. It looks like you have the x64 runtime installed but not the x64 SDK. For some reason dotnet is deciding to run the t4 tool on the x64 runtime instead of the ARM runtime, and it is looking for the matching SDK. I have only the ARM runtime and SDK installed on my M2 Mac (no /usr/local/share/dotnet/x64 folder at all) and it works fine.

While it might be possible to work around this by falling back to checking for the ARM SDK even when running on x64, I'd prefer to figure out why it's running on the x64 runtime in the first place.

Could you paste the output of the following commands?

  • which dotnet
  • dotnet --list-runtimes
  • dotnet tool list -g dotnet-t4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants