Ejemplo n.º 1
0
 public Workspace(
     FeaturePack features,
     string workspaceKind)
     : this(
         GetWorkspaceServiceProviderFactory(features).CreateWorkspaceServiceProvider(workspaceKind))
 {
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
        internal static IWorkspaceServiceProviderFactory GetWorkspaceServiceProviderFactory(FeaturePack features)
        {
            IWorkspaceServiceProviderFactory factory;
            if (!factories.TryGetValue(features, out factory))
            {
                factory = factories.GetValue(features, CreateWorkspaceServiceProviderFactory);
            }

            return factory;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 7
0
 public CustomWorkspace(FeaturePack features, string workspaceKind = WorkspaceKind.Host)
     : base(features, workspaceKind)
 {
 }