예제 #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
 public SolutionAttributes(SolutionId id, VersionStamp version, string?filePath)
 {
     Id       = id;
     Version  = version;
     FilePath = filePath;
 }
예제 #3
0
 /// <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
 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));
 }