示例#1
0
 public Workspace(
     FeaturePack features,
     string workspaceKind)
     : this(
         GetWorkspaceServiceProviderFactory(features).CreateWorkspaceServiceProvider(workspaceKind))
 {
 }
示例#2
0
 private MSBuildWorkspace(
     FeaturePack features,
     ImmutableDictionary<string, string> properties)
     : base(features, "MSBuildWorkspace")
 {
     // always make a copy of these build properties (no mutation please!)
     this.properties = properties ?? ImmutableDictionary<string, string>.Empty;
     this.SetSolutionProperties(solutionFilePath: null);
 }
示例#3
0
        internal static IWorkspaceServiceProviderFactory GetWorkspaceServiceProviderFactory(FeaturePack features)
        {
            IWorkspaceServiceProviderFactory factory;
            if (!factories.TryGetValue(features, out factory))
            {
                factory = factories.GetValue(features, CreateWorkspaceServiceProviderFactory);
            }

            return factory;
        }
示例#4
0
        private static IWorkspaceServiceProviderFactory CreateWorkspaceServiceProviderFactory(FeaturePack features)
        {
            var exports = features.ComposeExports();
            var factory = exports.GetExports<IWorkspaceServiceProviderFactory>().Single().Value;

#if MEF
            // need to tell factory about export source since it is constructed via MEF and the export source is not part of the MEF composition.
            ((WorkspaceServiceProviderFactory)factory).SetExports(exports);
#endif

            return factory;
        }
示例#5
0
        /// <summary>
        /// Create a new instance of a workspace that can be populated by opening solution and project files.
        /// </summary>
        /// <param name="properties">The MSBuild properties used when interpretting project files.
        /// These are the same properties that are passed to msbuild via the /property:&lt;n&gt;=&lt;v&gt; command line argument.</param>
        /// <param name="features">The feature pack used to configure this workspace.</param>
        public static MSBuildWorkspace Create(ImmutableDictionary<string, string> properties, FeaturePack features)
        {
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }

            if (features == null)
            {
                throw new ArgumentNullException("features");
            }

            return new MSBuildWorkspace(features, properties);
        }
示例#6
0
        private static FeaturePack GetTestWorkspaceFeatures()
        {
            if (testWorkspaceFeatures == null)
            {
                AssemblyCatalog assemblyCatalog = new AssemblyCatalog(typeof(SolutionTests).Assembly);
                MefExportPack mefExportPack = new MefExportPack(assemblyCatalog);
                testWorkspaceFeatures = WellKnownFeatures.Features.Combine(mefExportPack);
            }

            return testWorkspaceFeatures;
        }
示例#7
0
 public CustomWorkspace(FeaturePack features, string workspaceKind = WorkspaceKind.Host)
     : base(features, workspaceKind)
 {
 }