RazorEngineCore: RazorEngineCore.RazorEngine.Compile not work when publish to single file
target framework is .net5
when i publish exe to single file ,compile a templeate ,get this error:
System.ArgumentException: Empty path name is not legal. (Parameter ‘path’)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Roslyn.Utilities.FileUtilities.OpenFileStream(String path)
at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation)
at RazorEngineCore.RazorEngine.<>c.<CreateAndCompileToStream>b__4_1(Assembly ass)
at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() at System.Collections.Generic.List
1.InsertRange(Int32 index, IEnumerable1 collection) at System.Collections.Generic.List
1.AddRange(IEnumerable1 collection) at System.Linq.Enumerable.ConcatIterator
1.ToList()
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at RazorEngineCore.RazorEngine.CreateAndCompileToStream(String templateSource, RazorEngineCompilationOptions options) at RazorEngineCore.RazorEngine.Compile(String content, Action
1 builderAction)
if not single file , it ok
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (7 by maintainers)
Closing issue then 😃
got the exception. apparently its a NET5 breaking change…
@jddj007-hydra @afucher @kobruleht package 2021.3.1 published! https://www.nuget.org/packages/RazorEngineCore/2021.3.1
https://github.com/dotnet/runtime/issues/36590#issuecomment-689883856 referance this modify CreateAndCompileToStream
it’s worked