コード例 #1
0
 protected void Init()
 {
     try
     {
         Workspace = new AdhocWorkspace();
         Workspace.AddSolution(SolutionInfo.Create(MSSolutionID.CreateNewId(), VersionStamp.Default));
         References = new List <string>(DefaultReferences);
     }
     catch (ReflectionTypeLoadException ex)
     {
         StringBuilder sb = new StringBuilder();
         foreach (Exception exSub in ex.LoaderExceptions)
         {
             sb.AppendLine(exSub.Message);
             if (exSub is FileNotFoundException exFileNotFound)
             {
                 if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                 {
                     sb.AppendLine("Fusion Log:");
                     sb.AppendLine(exFileNotFound.FusionLog);
                 }
             }
             sb.AppendLine();
         }
         string errorMessage = sb.ToString();
         //Display or log the error based on your application.
         throw;
     }
 }
コード例 #2
0
ファイル: SolutionInfo.cs プロジェクト: bwilsonCricut/roslyn
 public SolutionAttributes(SolutionId id, VersionStamp version, string?filePath)
 {
     Id       = id;
     Version  = version;
     FilePath = filePath;
 }
コード例 #3
0
ファイル: Workspace.cs プロジェクト: Paradox-Cascade/roslyn
 /// <summary>
 /// Create a new empty solution instance associated with this workspace.
 /// </summary>
 protected internal Solution CreateSolution(SolutionId id)
 {
     return(CreateSolution(SolutionInfo.Create(id, VersionStamp.Create())));
 }
コード例 #4
0
ファイル: SolutionInfo.cs プロジェクト: znatz/roslyn
 public SolutionAttributes(SolutionId id, VersionStamp version, string filePath)
 {
     Id       = id ?? throw new ArgumentNullException(nameof(id));
     Version  = version;
     FilePath = filePath;
 }
コード例 #5
0
 public CustomWorkspace(SolutionId solutionId)
     : this(WorkspaceKind.Host)
 {
     this.SetCurrentSolution(this.CreateSolution(solutionId));
 }