toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.52k stars 259 forks source link

Mono.Posix required? #437

Closed jgmdavies closed 3 years ago

jgmdavies commented 3 years ago

Installed in VS 2019 using the recommended: Install-Package RazorLight -Version 2.0.0-rc.3 WinForms, .NET Framework 4.8.2.

I get:

System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified.

Is Mono required for RazorLight?

Thanks, Jim

jzabroski commented 3 years ago

Can you please provide more details

jzabroski commented 3 years ago

E.g. full stack trace

jgmdavies commented 3 years ago

System.IO.FileNotFoundException: Could not load file or assembly 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or one of its dependencies. The system cannot find the file specified. File name: 'Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756' at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at RazorLight.Compilation.DefaultMetadataReferenceManager.d13.MoveNext() at RazorLight.Compilation.DefaultMetadataReferenceManager.d13.MoveNext() at RazorLight.Compilation.DefaultMetadataReferenceManager.d13.MoveNext() at RazorLight.Compilation.DefaultMetadataReferenceManager.d13.MoveNext() at System.Linq.Enumerable.d__671.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(Assembly assembly, DependencyContext dependencyContext) at RazorLight.Compilation.DefaultMetadataReferenceManager.Resolve(Assembly assembly) at RazorLight.Compilation.RoslynCompilationService.EnsureOptions() at RazorLight.Compilation.RoslynCompilationService.get_ParseOptions() at RazorLight.Compilation.RoslynCompilationService.CreateSyntaxTree(SourceText sourceText) at RazorLight.Compilation.RoslynCompilationService.CreateCompilation(String compilationContent, String assemblyName) at RazorLight.Compilation.RoslynCompilationService.CompileAndEmit(IGeneratedRazorTemplate razorTemplate) at RazorLight.Compilation.RazorTemplateCompiler.CompileAndEmit(RazorLightProjectItem projectItem) at RazorLight.Compilation.RazorTemplateCompiler.OnCacheMissAsync(String templateKey) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.EngineHandler.d16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at RazorLight.EngineHandler.d201.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at xxx.HtmlGenerator.d__3.MoveNext() in D:\xxx\HtmlGenerator.cs:line 45

=== Pre-bind state information === LOG: DisplayName = Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 (Fully-specified) LOG: Appbase = file:///D:/xxx/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : RazorLight, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: D:\xxx\bin\Debug\xxx.exe.Config LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756 LOG: Attempting download of new URL file:///D:/xxx/bin/Debug/Mono.Posix.DLL. LOG: Attempting download of new URL file:///D:/xxx/bin/Debug/Mono.Posix/Mono.Posix.DLL. LOG: Attempting download of new URL file:///D:/xxx/bin/Debug/Mono.Posix.EXE. LOG: Attempting download of new URL file:///D:/xxxbin/Debug/Mono.Posix/Mono.Posix.EXE.

jzabroski commented 3 years ago

This doesn't make a lot of sense. Are you using another package like Topshelf.Unix to deploy your app?

jzabroski commented 3 years ago

If you can copy-paste your csproj with your packages.config, that would be helpfu. Don't believe WinForms supports modern csproj file format.

toddams commented 3 years ago

Mono is not required for the project to run