Version Used:
Anthony D. Green edited this page on Sep 19 2015 · 1 revision from this Repo
Steps to Reproduce:
The page refers to VS 2015
The Example as below are marked Obsolete with VS 2017 15.5.2
Dim compilation As Compilation =
VisualBasicCompilation.Create("HelloWorld").
AddReferences(MetadataReference.CreateFromAssembly(
GetType(Object).Assembly)).
AddSyntaxTrees(tree)
Even when you attempt to follow the instructions to fix
Dim comp As Compilation = VisualBasicCompilation.Create("HelloWorld").
AddReferences(MetadataReference.CreateFromFile((New Object).GetType().Assembly.Location.ToString)).
AddSyntaxTrees(tree)
You get an error
System.BadImageFormatException: 'Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)'
Expected Behavior:
Examples work
Actual Behavior:
Error pointing out CreateFromAssembly is deprecated and instructions to fix are less than obvious
Version Used: Anthony D. Green edited this page on Sep 19 2015 · 1 revision from this Repo Steps to Reproduce:
Even when you attempt to follow the instructions to fix
You get an error
Expected Behavior: Examples work Actual Behavior: Error pointing out CreateFromAssembly is deprecated and instructions to fix are less than obvious