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

Error in azure app service with net 5 #118

Open
jarandal opened this issue Nov 23, 2021 · 1 comment
Open

Error in azure app service with net 5 #118

jarandal opened this issue Nov 23, 2021 · 1 comment

Comments

@jarandal
Copy link

I having this error when running my app in azure app service in windows with net 5.

Could not find a part of the path 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref'

I think is beacuse that directory do not exist on net 5,

Locally my code runs.

¿any ideas?

Could not find a part of the path 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref'.\r\n ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref'.\r\n at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)\r\n at System.IO.Enumeration.FileSystemEnumerator1.Init()\r\n at System.IO.Enumeration.FileSystemEnumerator1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)\r\n at System.IO.Enumeration.FileSystemEnumerable1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)\r\n at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories(String directory, String expression, EnumerationOptions options)\r\n at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)\r\n at System.IO.Directory.EnumerateDirectories(String path)\r\n at Mono.TextTemplating.CodeCompilation.RuntimeInfo.FindHighestVersionedDirectory(String parentFolder, Func2 validate, SemVersion& bestVersion)\r\n at Mono.TextTemplating.CodeCompilation.RuntimeInfo.GetDotNetCoreSdk()\r\n at Mono.TextTemplating.CodeCompilation.RuntimeInfo.GetRuntime()\r\n at Mono.TextTemplating.TemplatingEngine.GetOrCreateCompiler()\r\n at Mono.TextTemplating.TemplatingEngine.CompileCode(IEnumerable1 references, TemplateSettings settings, CodeCompileUnit ccu)\r\n at Mono.TextTemplating.TemplatingEngine.CompileTemplateInternal(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings)\r\n at Mono.TextTemplating.TemplatingEngine.CompileTemplate(ParsedTemplate pt, String content, ITextTemplatingEngineHost host, TemplateSettings settings)\r\n at Sonda.Core.Tools.T4.ToolTemplateGenerator.ProcessTemplate(ParsedTemplate pt, String inputFile, String inputContent, String& outputFile, TemplateSettings settings) in /home/administrador/agente/_work/1/s/Backend/Repositorio/Sonda.Core.Tools/T4/ToolTemplateGenerator.cs:line 43\r\n at Sonda.Core.Tools.Business.DagWizardBO.Generate(Dictionary2 properties, String template, String outputFolder, ILogger _logger, ToolTemplateGenerator& generator) in /home/administrador/agente/_work/1/s/Backend/Repositorio/Sonda.Core.Tools/Business/DagWizardBO.cs:line 501\r\n at Sonda.Core.Tools.Business.DagGeneratorBO.Generate(GenerateInput input, Boolean permisosOn) in /home/administrador/agente/_work/1/s/Backend/Repositorio/Sonda.Core.Tools/Business/DagGenerator.cs:line 229\r\n --- End of inner exception stack trace ---\r\n at Sonda.Core.Tools.Business.DagGeneratorBO.Generate(GenerateInput input, Boolean permisosOn) in /home/administrador/agente/_work/1/s/Backend/Repositorio/Sonda.Core.Tools/Business/DagGenerator.cs:line 233\r\n at Sonda.Core.Tools.Api.Controllers.DagGeneratorController.<>c__DisplayClass7_0.<<Generate>b__0>d.MoveNext() in /home/administrador/agente/_work/1/s/Backend/Repositorio/Sonda.Core.Tools.Api/Controllers/DagGeneratorController.cs:line 46\r\n--- End of stack trace from previous location ---\r\n at Sonda.Core.DbConn.UnitOfWork.UnitOfWork.Execute[T](Func1 function)",

@jarandal
Copy link
Author

I make it work checking if directory exists.

https://github.com/mono/t4/blob/main/Mono.TextTemplating/Mono.TextTemplating.CodeCompilation/RuntimeInfo.cs

			// it's ok if this is null, we may be running on an older SDK that didn't support packs
			//in which case we fall back to resolving from the runtime dir
			String refAssembliesDir = null;
			var dotNetRefsDir = Path.Combine (dotnetRoot, "packs", "Microsoft.NETCore.App.Ref");
			if (System.IO.Directory.Exists(dotNetRefsDir)) {
				refAssembliesDir = FindHighestVersionedDirectory (
					Path.Combine (dotnetRoot, "packs", "Microsoft.NETCore.App.Ref"),
					d => File.Exists (Path.Combine (d, $"net{hostVersion.Major}.{hostVersion.Minor}", "System.Runtime.dll")),
					out _
				);
			}

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

1 participant