/// <summary> /// Initializes a new instance of the <see cref="AltaxoWorkspaceBase"/> class. /// </summary> /// <param name="roslynHost">The roslyn host.</param> /// <param name="staticReferences">The static references, i.e. project references that are not stated in the code by #r statements.</param> /// <param name="workingDirectory">The working directory. Is used only for script workspaces, otherwise, it can be null.</param> public AltaxoWorkspaceBase(RoslynHost roslynHost, IEnumerable <System.Reflection.Assembly> staticReferences, string workingDirectory) : this( roslynHost, staticReferences?.Select(ass => roslynHost.CreateMetadataReference(ass.Location)), workingDirectory) { }
protected virtual MetadataReference ResolveReference(string name) { if (File.Exists(name)) { return(RoslynHost.CreateMetadataReference(name)); } try { var assemblyName = GlobalAssemblyCache.Instance.ResolvePartialName(name); if (assemblyName == null) { return(null); } var assembly = Assembly.Load(assemblyName.ToString()); return(RoslynHost.CreateMetadataReference(assembly.Location)); } catch (Exception) { return(null); } }