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

Issues with .NET Standard reference on Linux starting with 2020.9.1 #34

Closed
Kaliumhexacyanoferrat opened this issue Oct 6, 2020 · 7 comments

Comments

@Kaliumhexacyanoferrat
Copy link

After updating to version 2020.9.1, I get the following exception when rendering templates:

RazorEngineCore.RazorEngineCompilationException: Unable to compile template: (28,29): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
at RazorEngineCore.RazorEngine.CreateAndCompileToStream(String templateSource, RazorEngineCompilationOptions options)
at RazorEngineCore.RazorEngine.Compile[T](String content, Action`1 builderAction)

This happens on Linux only (see this build), the same logic works on Windows as expected (with identical SDK versions etc.).

Do you have an idea how to overcome this issue? I tried to tweak the assembly references, but I suspect the compilation process of the template is missing some .NET Standard reference.

@adoconnection
Copy link
Owner

Hi, thats probably due to I missed something with references on init. Will recheck it again.

@adoconnection
Copy link
Owner

adoconnection commented Oct 12, 2020

did it work on 2020.6.1?
there was a pull request to remove netstadrard reference if under linux and it never changed from that time (as I can see)
7975beb#diff-da023b3e46c83993108046dee9e55032

However I have the same error as you do. If I return netstandard reference back, the error dissapears. Im confused.

@daghb does 2020.9.1 work for your linux environment?

@Kaliumhexacyanoferrat
Copy link
Author

@adoconnection: It did work on 2020.6.1. As dependabot creates a PR for the new version, I can rule out changes in the environment (such as the SDK version).

@adoconnection
Copy link
Owner

I have no idea how is this possible :)
here are all the changes, 2020.6.1 - is July version
https://github.com/adoconnection/RazorEngineCore/commits/master/RazorEngineCore/RazorEngineCompilationOptions.cs

@Kaliumhexacyanoferrat
Copy link
Author

I can have a look later on - what does RuntimeInformation.FrameworkDescription evaluate to in you Linux environment? 🤔

@adoconnection
Copy link
Owner

adoconnection commented Oct 12, 2020

ok, the mystery revealed. 2020.6.1 release had "wrong code"

image

adoconnection added a commit that referenced this issue Oct 12, 2020
@Kaliumhexacyanoferrat
Copy link
Author

Build with 2020.10.1 works on Windows and Linux. Thank you very much!

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