Skip to content

Instantly share code, notes, and snippets.

@chaojian-zhang
Last active July 20, 2022 21:20
Show Gist options
  • Save chaojian-zhang/60bde77f8dbc8659b77f3f49923a052a to your computer and use it in GitHub Desktop.
Save chaojian-zhang/60bde77f8dbc8659b77f3f49923a052a to your computer and use it in GitHub Desktop.
Roslyn

Troubleshooting

  • Type or namespace could not be found even after AddReference: There are a few potential causes - 1) Dynamic assembly won't work e.g. Single Executable option in publish; 2) Be careful you are actually passing the assembly reference to AddReferences() not as the third "global" object to CSharpScript.RunAsync(); 3) During publishing, might want to "Delete existing files" because old assemblies can mess up with assembly references.
    • By the way the differences between "Add" and "With" is the latter replaces everything, while the former adds to the list; And "Imports" is equivalent to "using" in code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment