Created
March 15, 2016 01:43
-
-
Save svick/3258268ac8c34c7e92ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Imports Microsoft.CodeAnalysis | |
| Imports Microsoft.CodeAnalysis.VisualBasic | |
| Module Module1 | |
| Sub Main() | |
| Dim code = "Module Module1 | |
| Sub Main() | |
| Console.WriteLine(My.Application.Info.AssemblyName) | |
| End Sub | |
| End Module" | |
| Dim tree = VisualBasicSyntaxTree.ParseText(code) | |
| Dim compilation = VisualBasicCompilation.Create("test"). | |
| AddSyntaxTrees(tree). | |
| AddReferences(MetadataReference.CreateFromFile("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll")). | |
| AddReferences(MetadataReference.CreateFromFile("C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.VisualBasic.dll")) | |
| Dim semantics = compilation.GetSemanticModel(tree) | |
| Dim errors = semantics.GetSyntaxDiagnostics() | |
| End Sub | |
| End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment