Incorporate breaking changes from CPS

This commit is contained in:
Ryan Nowak 2018-10-08 10:55:59 -07:00
parent 7177a7311f
commit 4d44639a51
8 changed files with 1179 additions and 899 deletions

View File

@ -29,9 +29,9 @@
<MicrosoftVisualStudioLanguageIntellisensePackageVersion>16.0.142-g25b7188c54</MicrosoftVisualStudioLanguageIntellisensePackageVersion> <MicrosoftVisualStudioLanguageIntellisensePackageVersion>16.0.142-g25b7188c54</MicrosoftVisualStudioLanguageIntellisensePackageVersion>
<MicrosoftVisualStudioLanguagePackageVersion>16.0.142-g25b7188c54</MicrosoftVisualStudioLanguagePackageVersion> <MicrosoftVisualStudioLanguagePackageVersion>16.0.142-g25b7188c54</MicrosoftVisualStudioLanguagePackageVersion>
<MicrosoftVisualStudioOLEInteropPackageVersion>7.10.6071</MicrosoftVisualStudioOLEInteropPackageVersion> <MicrosoftVisualStudioOLEInteropPackageVersion>7.10.6071</MicrosoftVisualStudioOLEInteropPackageVersion>
<MicrosoftVisualStudioProjectSystemAnalyzersPackageVersion>15.8.243</MicrosoftVisualStudioProjectSystemAnalyzersPackageVersion> <MicrosoftVisualStudioProjectSystemAnalyzersPackageVersion>16.0.201-pre-g7d366164d0</MicrosoftVisualStudioProjectSystemAnalyzersPackageVersion>
<MicrosoftVisualStudioProjectSystemManagedVSPackageVersion>2.0.6142705</MicrosoftVisualStudioProjectSystemManagedVSPackageVersion> <MicrosoftVisualStudioProjectSystemManagedVSPackageVersion>2.0.6142705</MicrosoftVisualStudioProjectSystemManagedVSPackageVersion>
<MicrosoftVisualStudioProjectSystemSDKPackageVersion>15.8.243</MicrosoftVisualStudioProjectSystemSDKPackageVersion> <MicrosoftVisualStudioProjectSystemSDKPackageVersion>16.0.201-pre-g7d366164d0</MicrosoftVisualStudioProjectSystemSDKPackageVersion>
<MicrosoftVisualStudioShell150PackageVersion>15.8.28010</MicrosoftVisualStudioShell150PackageVersion> <MicrosoftVisualStudioShell150PackageVersion>15.8.28010</MicrosoftVisualStudioShell150PackageVersion>
<MicrosoftVisualStudioShellInterop100PackageVersion>10.0.30320</MicrosoftVisualStudioShellInterop100PackageVersion> <MicrosoftVisualStudioShellInterop100PackageVersion>10.0.30320</MicrosoftVisualStudioShellInterop100PackageVersion>
<MicrosoftVisualStudioShellInterop110PackageVersion>11.0.61031</MicrosoftVisualStudioShellInterop110PackageVersion> <MicrosoftVisualStudioShellInterop110PackageVersion>11.0.61031</MicrosoftVisualStudioShellInterop110PackageVersion>

View File

@ -11,7 +11,8 @@
https://dotnet.myget.org/F/msbuild/api/v3/index.json; https://dotnet.myget.org/F/msbuild/api/v3/index.json;
https://dotnet.myget.org/F/roslyn/api/v3/index.json; https://dotnet.myget.org/F/roslyn/api/v3/index.json;
https://vside.myget.org/F/vssdk/api/v3/index.json; https://vside.myget.org/F/vssdk/api/v3/index.json;
https://vside.myget.org/F/vsmac/api/v3/index.json https://vside.myget.org/F/vsmac/api/v3/index.json;
https://vside.myget.org/F/devcore/api/v3/index.json;
</RestoreSources> </RestoreSources>
<RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'"> <RestoreSources Condition="'$(DotNetBuildOffline)' != 'true'">
$(RestoreSources); $(RestoreSources);

View File

@ -13,7 +13,6 @@
<DefineConstants>$(DefineConstants);RAZOR_EXTENSION_DEVELOPER_MODE</DefineConstants> <DefineConstants>$(DefineConstants);RAZOR_EXTENSION_DEVELOPER_MODE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" /> <PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" /> <PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" />
@ -24,6 +23,7 @@
<PackageReference Include="Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient" Version="$(VSIX_MicrosoftVisualStudioLanguageServicesRazorRemoteClientPackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient" Version="$(VSIX_MicrosoftVisualStudioLanguageServicesRazorRemoteClientPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="$(VSIX_MicrosoftVisualStudioLanguageServicesPackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.LanguageServices" Version="$(VSIX_MicrosoftVisualStudioLanguageServicesPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="$(MicrosoftVisualStudioOLEInteropPackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.OLE.Interop" Version="$(MicrosoftVisualStudioOLEInteropPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.Analyzers" Version="$(MicrosoftVisualStudioProjectSystemAnalyzersPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.Managed.VS" Version="$(MicrosoftVisualStudioProjectSystemManagedVSPackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.ProjectSystem.Managed.VS" Version="$(MicrosoftVisualStudioProjectSystemManagedVSPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="$(MicrosoftVisualStudioProjectSystemSDKPackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.ProjectSystem.SDK" Version="$(MicrosoftVisualStudioProjectSystemSDKPackageVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150PackageVersion)" /> <PackageReference Include="Microsoft.VisualStudio.Shell.15.0" Version="$(MicrosoftVisualStudioShell150PackageVersion)" />

View File

@ -8,205 +8,268 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules
{
internal partial class RazorConfiguration {
internal partial class RazorConfiguration
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary> {
private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary>
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary> private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
internal const string SchemaName = "RazorConfiguration";
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary>
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string SchemaName = "RazorConfiguration";
internal const string PrimaryDataSourceItemType = "RazorConfiguration";
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string PrimaryDataSourceItemType = "RazorConfiguration";
internal const string PrimaryDataSourceLabel = "";
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>Razor Extensions (The "Extensions" property).</summary> internal const string PrimaryDataSourceLabel = "";
internal const string ExtensionsProperty = "Extensions";
/// <summary>Razor Extensions (The "Extensions" property).</summary>
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary> internal const string ExtensionsProperty = "Extensions";
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary>
/// <summary>Backing field for the file name of the rule property.</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
private string file;
/// <summary>Backing field for the file name of the rule property.</summary>
/// <summary>Backing field for the ItemType property.</summary> private string file;
private string itemType;
/// <summary>Backing field for the ItemType property.</summary>
/// <summary>Backing field for the ItemName property.</summary> private string itemType;
private string itemName;
/// <summary>Backing field for the ItemName property.</summary>
/// <summary>Configured Project</summary> private string itemName;
private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
/// <summary>Configured Project</summary>
/// <summary>The dictionary of named catalogs.</summary> private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
/// <summary>The dictionary of named catalogs.</summary>
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary> private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary>
/// <summary>Thread locking object</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
private object locker = new object();
/// <summary>Thread locking object</summary>
/// <summary>Initializes a new instance of the RazorConfiguration class.</summary> private object locker = new object();
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) {
this.rule = rule; /// <summary>Initializes a new instance of the RazorConfiguration class.</summary>
} internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule)
{
/// <summary>Initializes a new instance of the RazorConfiguration class.</summary> this.rule = rule;
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) : }
this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) {
if ((configuredProject == null)) { /// <summary>Initializes a new instance of the RazorConfiguration class.</summary>
throw new System.ArgumentNullException("configuredProject"); internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
} this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName))
this.configuredProject = configuredProject; {
this.catalogs = catalogs; if ((configuredProject == null))
this.file = file; {
this.itemType = itemType; throw new System.ArgumentNullException("configuredProject");
this.itemName = itemName; }
} this.configuredProject = configuredProject;
this.catalogs = catalogs;
/// <summary>Initializes a new instance of the RazorConfiguration class.</summary> this.file = file;
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : this.itemType = itemType;
this(rule) { this.itemName = itemName;
if ((rule == null)) { }
throw new System.ArgumentNullException("rule");
} /// <summary>Initializes a new instance of the RazorConfiguration class.</summary>
if ((configuredProject == null)) { internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
throw new System.ArgumentNullException("configuredProject"); this(rule)
} {
this.configuredProject = configuredProject; if ((rule == null))
this.rule = rule; {
this.file = this.rule.File; throw new System.ArgumentNullException("rule");
this.itemType = this.rule.ItemType; }
this.itemName = this.rule.ItemName; if ((configuredProject == null))
} {
throw new System.ArgumentNullException("configuredProject");
/// <summary>Initializes a new instance of the RazorConfiguration class.</summary> }
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : this.configuredProject = configuredProject;
this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { this.rule = rule;
} this.file = this.rule.File;
this.itemType = this.rule.ItemType;
/// <summary>Initializes a new instance of the RazorConfiguration class that assumes a project context (neither property sheet nor items).</summary> this.itemName = this.rule.ItemName;
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) : }
this(configuredProject, catalogs, "Project", null, null, null) {
} /// <summary>Initializes a new instance of the RazorConfiguration class.</summary>
internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
/// <summary>Gets the IRule used to get and set properties.</summary> this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName)
public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { {
get { }
return this.rule;
} /// <summary>Initializes a new instance of the RazorConfiguration class that assumes a project context (neither property sheet nor items).</summary>
} internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
this(configuredProject, catalogs, "Project", null, null, null)
/// <summary>Razor Extensions</summary> {
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty Extensions { }
get {
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; /// <summary>Gets the IRule used to get and set properties.</summary>
if ((localRule == null)) { public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule
localRule = this.GeneratedFallbackRule; {
} get
if ((localRule == null)) { {
return null; return this.rule;
} }
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty))); }
if (((property == null)
&& (this.GeneratedFallbackRule != null))) { /// <summary>Razor Extensions</summary>
localRule = this.GeneratedFallbackRule; internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty Extensions
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty))); {
} get
return property; {
} Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
} if ((localRule == null))
{
/// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary> localRule = this.GeneratedFallbackRule;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { }
get { if ((localRule == null))
if (((this.fallbackRule == null) {
&& (this.configuredProject != null))) { return null;
System.Threading.Monitor.Enter(this.locker); }
try { Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty)));
if ((this.fallbackRule == null)) { if (((property == null)
this.InitializeFallbackRule(); && (this.GeneratedFallbackRule != null)))
} {
} localRule = this.GeneratedFallbackRule;
finally { property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty)));
System.Threading.Monitor.Exit(this.locker); }
} return property;
} }
return this.fallbackRule; }
}
} /// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary>
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { {
if ((catalog == null)) { get
return null; {
} if (((this.fallbackRule == null)
return catalog.BindToContext(SchemaName, file, itemType, itemName); && (this.configuredProject != null)))
} {
System.Threading.Monitor.Enter(this.locker);
private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { try
if ((propertiesContext.IsProjectFile == true)) { {
return null; if ((this.fallbackRule == null))
} {
else { this.InitializeFallbackRule();
return propertiesContext.File; }
} }
} finally
{
private void InitializeFallbackRule() { System.Threading.Monitor.Exit(this.locker);
if ((this.configuredProject == null)) { }
return; }
} return this.fallbackRule;
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorConfiguration.deserializedFallbackRule; }
if ((unboundRule == null)) { }
System.IO.Stream xamlStream = null;
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName)
try { {
xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorConfiguration.xaml"); if ((catalog == null))
Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); {
System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); return null;
for ( }
; ((unboundRule == null) return catalog.BindToContext(SchemaName, file, itemType, itemName);
&& ruleEnumerator.MoveNext()); }
) {
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext)
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { {
unboundRule = t; if ((propertiesContext.IsProjectFile == true))
unboundRule.Name = "30e71838-2cb8-4c67-ab28-7670763124af"; {
RazorConfiguration.deserializedFallbackRule = unboundRule; return null;
} }
} else
} {
finally { return propertiesContext.File;
if ((xamlStream != null)) { }
((System.IDisposable)(xamlStream)).Dispose(); }
}
} private void InitializeFallbackRule()
} {
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); if ((this.configuredProject == null))
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); {
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); return;
} }
} Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorConfiguration.deserializedFallbackRule;
if ((unboundRule == null))
internal partial class RazorProjectProperties { {
System.IO.Stream xamlStream = null;
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorConfiguration> CreateRazorConfigurationPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorConfiguration>(CreateRazorConfigurationProperties); System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
try
private static RazorConfiguration CreateRazorConfigurationProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state) { {
RazorProjectProperties that = ((RazorProjectProperties)(state)); xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorConfiguration.xaml");
return new RazorConfiguration(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream)));
} System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
for (
/// <summary>Gets the strongly-typed property accessor used to get and set Configuration Properties properties.</summary> ; ((unboundRule == null)
internal System.Threading.Tasks.Task<RazorConfiguration> GetRazorConfigurationPropertiesAsync() { && ruleEnumerator.MoveNext());
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync(); )
return namedCatalogsTask.ContinueWith(CreateRazorConfigurationPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); {
} Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current));
} if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName))
{
unboundRule = t;
unboundRule.Name = "f269edfbdecc0079d5f539c22552711e194f39b2367903515ae5440a64b20a0f";
RazorConfiguration.deserializedFallbackRule = unboundRule;
}
}
}
finally
{
if ((xamlStream != null))
{
((System.IDisposable)(xamlStream)).Dispose();
}
}
}
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext");
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext");
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
}
}
internal partial class RazorProjectProperties
{
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorConfiguration> CreateRazorConfigurationPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorConfiguration>(CreateRazorConfigurationProperties);
private static RazorConfiguration CreateRazorConfigurationProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state)
{
RazorProjectProperties that = ((RazorProjectProperties)(state));
return new RazorConfiguration(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
}
/// <summary>Gets the strongly-typed property accessor used to get and set Configuration Properties properties.</summary>
internal System.Threading.Tasks.Task<RazorConfiguration> GetRazorConfigurationPropertiesAsync()
{
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
return namedCatalogsTask.ContinueWith(CreateRazorConfigurationPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
}
/// <summary>Gets the strongly-typed property accessor used to get value from the current project snapshot Configuration Properties properties.</summary>
internal bool TryGetCurrentRazorConfigurationPropertiesSnapshot(out RazorConfiguration snapshot, [System.Runtime.InteropServices.OptionalAttribute()] [System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] bool requiredToMatchProjectVersion)
{
snapshot = null;
Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.Properties.IProjectCatalogSnapshot> catalogSnapshot;
if (this.TryGetCurrentCatalogSnapshot(out catalogSnapshot))
{
if (requiredToMatchProjectVersion)
{
if ((this.ConfiguredProject.ProjectVersion.CompareTo(catalogSnapshot.DataSourceVersions[Microsoft.VisualStudio.ProjectSystem.ProjectDataSources.ConfiguredProjectVersion]) != 0))
{
return false;
}
}
Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule = this.GetSnapshotRule(catalogSnapshot.Value, "Project", RazorConfiguration.SchemaName);
if ((rule != null))
{
snapshot = new RazorConfiguration(rule, this.ConfiguredProject);
return true;
}
}
return false;
}
}
} }

View File

@ -8,228 +8,296 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules
{
internal partial class RazorExtension {
internal partial class RazorExtension
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary> {
private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary>
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary> private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
internal const string SchemaName = "RazorExtension";
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary>
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string SchemaName = "RazorExtension";
internal const string PrimaryDataSourceItemType = "RazorExtension";
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string PrimaryDataSourceItemType = "RazorExtension";
internal const string PrimaryDataSourceLabel = "";
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>Razor Extension Assembly Name (The "AssemblyName" property).</summary> internal const string PrimaryDataSourceLabel = "";
internal const string AssemblyNameProperty = "AssemblyName";
/// <summary>Razor Extension Assembly Name (The "AssemblyName" property).</summary>
/// <summary>Razor Extension Assembly File Path (The "AssemblyFilePath" property).</summary> internal const string AssemblyNameProperty = "AssemblyName";
internal const string AssemblyFilePathProperty = "AssemblyFilePath";
/// <summary>Razor Extension Assembly File Path (The "AssemblyFilePath" property).</summary>
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary> internal const string AssemblyFilePathProperty = "AssemblyFilePath";
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary>
/// <summary>Backing field for the file name of the rule property.</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
private string file;
/// <summary>Backing field for the file name of the rule property.</summary>
/// <summary>Backing field for the ItemType property.</summary> private string file;
private string itemType;
/// <summary>Backing field for the ItemType property.</summary>
/// <summary>Backing field for the ItemName property.</summary> private string itemType;
private string itemName;
/// <summary>Backing field for the ItemName property.</summary>
/// <summary>Configured Project</summary> private string itemName;
private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
/// <summary>Configured Project</summary>
/// <summary>The dictionary of named catalogs.</summary> private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
/// <summary>The dictionary of named catalogs.</summary>
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary> private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary>
/// <summary>Thread locking object</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
private object locker = new object();
/// <summary>Thread locking object</summary>
/// <summary>Initializes a new instance of the RazorExtension class.</summary> private object locker = new object();
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) {
this.rule = rule; /// <summary>Initializes a new instance of the RazorExtension class.</summary>
} internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule)
{
/// <summary>Initializes a new instance of the RazorExtension class.</summary> this.rule = rule;
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) : }
this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) {
if ((configuredProject == null)) { /// <summary>Initializes a new instance of the RazorExtension class.</summary>
throw new System.ArgumentNullException("configuredProject"); internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
} this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName))
this.configuredProject = configuredProject; {
this.catalogs = catalogs; if ((configuredProject == null))
this.file = file; {
this.itemType = itemType; throw new System.ArgumentNullException("configuredProject");
this.itemName = itemName; }
} this.configuredProject = configuredProject;
this.catalogs = catalogs;
/// <summary>Initializes a new instance of the RazorExtension class.</summary> this.file = file;
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : this.itemType = itemType;
this(rule) { this.itemName = itemName;
if ((rule == null)) { }
throw new System.ArgumentNullException("rule");
} /// <summary>Initializes a new instance of the RazorExtension class.</summary>
if ((configuredProject == null)) { internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
throw new System.ArgumentNullException("configuredProject"); this(rule)
} {
this.configuredProject = configuredProject; if ((rule == null))
this.rule = rule; {
this.file = this.rule.File; throw new System.ArgumentNullException("rule");
this.itemType = this.rule.ItemType; }
this.itemName = this.rule.ItemName; if ((configuredProject == null))
} {
throw new System.ArgumentNullException("configuredProject");
/// <summary>Initializes a new instance of the RazorExtension class.</summary> }
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : this.configuredProject = configuredProject;
this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { this.rule = rule;
} this.file = this.rule.File;
this.itemType = this.rule.ItemType;
/// <summary>Initializes a new instance of the RazorExtension class that assumes a project context (neither property sheet nor items).</summary> this.itemName = this.rule.ItemName;
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) : }
this(configuredProject, catalogs, "Project", null, null, null) {
} /// <summary>Initializes a new instance of the RazorExtension class.</summary>
internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
/// <summary>Gets the IRule used to get and set properties.</summary> this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName)
public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { {
get { }
return this.rule;
} /// <summary>Initializes a new instance of the RazorExtension class that assumes a project context (neither property sheet nor items).</summary>
} internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
this(configuredProject, catalogs, "Project", null, null, null)
/// <summary>Razor Extension Assembly Name</summary> {
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyName { }
get {
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; /// <summary>Gets the IRule used to get and set properties.</summary>
if ((localRule == null)) { public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule
localRule = this.GeneratedFallbackRule; {
} get
if ((localRule == null)) { {
return null; return this.rule;
} }
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty))); }
if (((property == null)
&& (this.GeneratedFallbackRule != null))) { /// <summary>Razor Extension Assembly Name</summary>
localRule = this.GeneratedFallbackRule; internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyName
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty))); {
} get
return property; {
} Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
} if ((localRule == null))
{
/// <summary>Razor Extension Assembly File Path</summary> localRule = this.GeneratedFallbackRule;
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyFilePath { }
get { if ((localRule == null))
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; {
if ((localRule == null)) { return null;
localRule = this.GeneratedFallbackRule; }
} Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty)));
if ((localRule == null)) { if (((property == null)
return null; && (this.GeneratedFallbackRule != null)))
} {
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty))); localRule = this.GeneratedFallbackRule;
if (((property == null) property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty)));
&& (this.GeneratedFallbackRule != null))) { }
localRule = this.GeneratedFallbackRule; return property;
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty))); }
} }
return property;
} /// <summary>Razor Extension Assembly File Path</summary>
} internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyFilePath
{
/// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary> get
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { {
get { Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
if (((this.fallbackRule == null) if ((localRule == null))
&& (this.configuredProject != null))) { {
System.Threading.Monitor.Enter(this.locker); localRule = this.GeneratedFallbackRule;
try { }
if ((this.fallbackRule == null)) { if ((localRule == null))
this.InitializeFallbackRule(); {
} return null;
} }
finally { Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty)));
System.Threading.Monitor.Exit(this.locker); if (((property == null)
} && (this.GeneratedFallbackRule != null)))
} {
return this.fallbackRule; localRule = this.GeneratedFallbackRule;
} property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty)));
} }
return property;
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { }
if ((catalog == null)) { }
return null;
} /// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary>
return catalog.BindToContext(SchemaName, file, itemType, itemName); private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule
} {
get
private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { {
if ((propertiesContext.IsProjectFile == true)) { if (((this.fallbackRule == null)
return null; && (this.configuredProject != null)))
} {
else { System.Threading.Monitor.Enter(this.locker);
return propertiesContext.File; try
} {
} if ((this.fallbackRule == null))
{
private void InitializeFallbackRule() { this.InitializeFallbackRule();
if ((this.configuredProject == null)) { }
return; }
} finally
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorExtension.deserializedFallbackRule; {
if ((unboundRule == null)) { System.Threading.Monitor.Exit(this.locker);
System.IO.Stream xamlStream = null; }
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); }
try { return this.fallbackRule;
xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorExtension.xaml"); }
Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); }
System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
for ( private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName)
; ((unboundRule == null) {
&& ruleEnumerator.MoveNext()); if ((catalog == null))
) { {
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); return null;
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { }
unboundRule = t; return catalog.BindToContext(SchemaName, file, itemType, itemName);
unboundRule.Name = "6b577687-703b-41a1-8f5f-c44644f65f2a"; }
RazorExtension.deserializedFallbackRule = unboundRule;
} private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext)
} {
} if ((propertiesContext.IsProjectFile == true))
finally { {
if ((xamlStream != null)) { return null;
((System.IDisposable)(xamlStream)).Dispose(); }
} else
} {
} return propertiesContext.File;
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); }
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); }
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
} private void InitializeFallbackRule()
} {
if ((this.configuredProject == null))
internal partial class RazorProjectProperties { {
return;
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorExtension> CreateRazorExtensionPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorExtension>(CreateRazorExtensionProperties); }
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorExtension.deserializedFallbackRule;
private static RazorExtension CreateRazorExtensionProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state) { if ((unboundRule == null))
RazorProjectProperties that = ((RazorProjectProperties)(state)); {
return new RazorExtension(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); System.IO.Stream xamlStream = null;
} System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
try
/// <summary>Gets the strongly-typed property accessor used to get and set Extension Properties properties.</summary> {
internal System.Threading.Tasks.Task<RazorExtension> GetRazorExtensionPropertiesAsync() { xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorExtension.xaml");
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync(); Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream)));
return namedCatalogsTask.ContinueWith(CreateRazorExtensionPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
} for (
} ; ((unboundRule == null)
&& ruleEnumerator.MoveNext());
)
{
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current));
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName))
{
unboundRule = t;
unboundRule.Name = "e8ad5dd707beca947f7c014baa70b46c1d7a7fd6c8b49a5511ab299d8e1a3c70";
RazorExtension.deserializedFallbackRule = unboundRule;
}
}
}
finally
{
if ((xamlStream != null))
{
((System.IDisposable)(xamlStream)).Dispose();
}
}
}
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext");
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext");
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
}
}
internal partial class RazorProjectProperties
{
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorExtension> CreateRazorExtensionPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorExtension>(CreateRazorExtensionProperties);
private static RazorExtension CreateRazorExtensionProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state)
{
RazorProjectProperties that = ((RazorProjectProperties)(state));
return new RazorExtension(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
}
/// <summary>Gets the strongly-typed property accessor used to get and set Extension Properties properties.</summary>
internal System.Threading.Tasks.Task<RazorExtension> GetRazorExtensionPropertiesAsync()
{
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
return namedCatalogsTask.ContinueWith(CreateRazorExtensionPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
}
/// <summary>Gets the strongly-typed property accessor used to get value from the current project snapshot Extension Properties properties.</summary>
internal bool TryGetCurrentRazorExtensionPropertiesSnapshot(out RazorExtension snapshot, [System.Runtime.InteropServices.OptionalAttribute()] [System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] bool requiredToMatchProjectVersion)
{
snapshot = null;
Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.Properties.IProjectCatalogSnapshot> catalogSnapshot;
if (this.TryGetCurrentCatalogSnapshot(out catalogSnapshot))
{
if (requiredToMatchProjectVersion)
{
if ((this.ConfiguredProject.ProjectVersion.CompareTo(catalogSnapshot.DataSourceVersions[Microsoft.VisualStudio.ProjectSystem.ProjectDataSources.ConfiguredProjectVersion]) != 0))
{
return false;
}
}
Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule = this.GetSnapshotRule(catalogSnapshot.Value, "Project", RazorExtension.SchemaName);
if ((rule != null))
{
snapshot = new RazorExtension(rule, this.ConfiguredProject);
return true;
}
}
return false;
}
}
} }

View File

@ -8,228 +8,296 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules
{
internal partial class RazorGeneral {
internal partial class RazorGeneral
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary> {
private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary>
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary> private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
internal const string SchemaName = "RazorGeneral";
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary>
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string SchemaName = "RazorGeneral";
internal const string PrimaryDataSourceItemType = null;
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string PrimaryDataSourceItemType = null;
internal const string PrimaryDataSourceLabel = "";
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>Razor Language Version (The "RazorLangVersion" property).</summary> internal const string PrimaryDataSourceLabel = "";
internal const string RazorLangVersionProperty = "RazorLangVersion";
/// <summary>Razor Language Version (The "RazorLangVersion" property).</summary>
/// <summary>Razor Configuration Name (The "RazorDefaultConfiguration" property).</summary> internal const string RazorLangVersionProperty = "RazorLangVersion";
internal const string RazorDefaultConfigurationProperty = "RazorDefaultConfiguration";
/// <summary>Razor Configuration Name (The "RazorDefaultConfiguration" property).</summary>
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary> internal const string RazorDefaultConfigurationProperty = "RazorDefaultConfiguration";
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary>
/// <summary>Backing field for the file name of the rule property.</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
private string file;
/// <summary>Backing field for the file name of the rule property.</summary>
/// <summary>Backing field for the ItemType property.</summary> private string file;
private string itemType;
/// <summary>Backing field for the ItemType property.</summary>
/// <summary>Backing field for the ItemName property.</summary> private string itemType;
private string itemName;
/// <summary>Backing field for the ItemName property.</summary>
/// <summary>Configured Project</summary> private string itemName;
private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
/// <summary>Configured Project</summary>
/// <summary>The dictionary of named catalogs.</summary> private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
/// <summary>The dictionary of named catalogs.</summary>
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary> private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary>
/// <summary>Thread locking object</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
private object locker = new object();
/// <summary>Thread locking object</summary>
/// <summary>Initializes a new instance of the RazorGeneral class.</summary> private object locker = new object();
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) {
this.rule = rule; /// <summary>Initializes a new instance of the RazorGeneral class.</summary>
} internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule)
{
/// <summary>Initializes a new instance of the RazorGeneral class.</summary> this.rule = rule;
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) : }
this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) {
if ((configuredProject == null)) { /// <summary>Initializes a new instance of the RazorGeneral class.</summary>
throw new System.ArgumentNullException("configuredProject"); internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
} this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName))
this.configuredProject = configuredProject; {
this.catalogs = catalogs; if ((configuredProject == null))
this.file = file; {
this.itemType = itemType; throw new System.ArgumentNullException("configuredProject");
this.itemName = itemName; }
} this.configuredProject = configuredProject;
this.catalogs = catalogs;
/// <summary>Initializes a new instance of the RazorGeneral class.</summary> this.file = file;
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : this.itemType = itemType;
this(rule) { this.itemName = itemName;
if ((rule == null)) { }
throw new System.ArgumentNullException("rule");
} /// <summary>Initializes a new instance of the RazorGeneral class.</summary>
if ((configuredProject == null)) { internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
throw new System.ArgumentNullException("configuredProject"); this(rule)
} {
this.configuredProject = configuredProject; if ((rule == null))
this.rule = rule; {
this.file = this.rule.File; throw new System.ArgumentNullException("rule");
this.itemType = this.rule.ItemType; }
this.itemName = this.rule.ItemName; if ((configuredProject == null))
} {
throw new System.ArgumentNullException("configuredProject");
/// <summary>Initializes a new instance of the RazorGeneral class.</summary> }
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : this.configuredProject = configuredProject;
this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { this.rule = rule;
} this.file = this.rule.File;
this.itemType = this.rule.ItemType;
/// <summary>Initializes a new instance of the RazorGeneral class that assumes a project context (neither property sheet nor items).</summary> this.itemName = this.rule.ItemName;
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) : }
this(configuredProject, catalogs, "Project", null, null, null) {
} /// <summary>Initializes a new instance of the RazorGeneral class.</summary>
internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
/// <summary>Gets the IRule used to get and set properties.</summary> this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName)
public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { {
get { }
return this.rule;
} /// <summary>Initializes a new instance of the RazorGeneral class that assumes a project context (neither property sheet nor items).</summary>
} internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
this(configuredProject, catalogs, "Project", null, null, null)
/// <summary>Razor Language Version</summary> {
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorLangVersion { }
get {
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; /// <summary>Gets the IRule used to get and set properties.</summary>
if ((localRule == null)) { public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule
localRule = this.GeneratedFallbackRule; {
} get
if ((localRule == null)) { {
return null; return this.rule;
} }
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty))); }
if (((property == null)
&& (this.GeneratedFallbackRule != null))) { /// <summary>Razor Language Version</summary>
localRule = this.GeneratedFallbackRule; internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorLangVersion
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty))); {
} get
return property; {
} Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
} if ((localRule == null))
{
/// <summary>Razor Configuration Name</summary> localRule = this.GeneratedFallbackRule;
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorDefaultConfiguration { }
get { if ((localRule == null))
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; {
if ((localRule == null)) { return null;
localRule = this.GeneratedFallbackRule; }
} Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty)));
if ((localRule == null)) { if (((property == null)
return null; && (this.GeneratedFallbackRule != null)))
} {
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty))); localRule = this.GeneratedFallbackRule;
if (((property == null) property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty)));
&& (this.GeneratedFallbackRule != null))) { }
localRule = this.GeneratedFallbackRule; return property;
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty))); }
} }
return property;
} /// <summary>Razor Configuration Name</summary>
} internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorDefaultConfiguration
{
/// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary> get
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { {
get { Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
if (((this.fallbackRule == null) if ((localRule == null))
&& (this.configuredProject != null))) { {
System.Threading.Monitor.Enter(this.locker); localRule = this.GeneratedFallbackRule;
try { }
if ((this.fallbackRule == null)) { if ((localRule == null))
this.InitializeFallbackRule(); {
} return null;
} }
finally { Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty)));
System.Threading.Monitor.Exit(this.locker); if (((property == null)
} && (this.GeneratedFallbackRule != null)))
} {
return this.fallbackRule; localRule = this.GeneratedFallbackRule;
} property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty)));
} }
return property;
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { }
if ((catalog == null)) { }
return null;
} /// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary>
return catalog.BindToContext(SchemaName, file, itemType, itemName); private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule
} {
get
private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { {
if ((propertiesContext.IsProjectFile == true)) { if (((this.fallbackRule == null)
return null; && (this.configuredProject != null)))
} {
else { System.Threading.Monitor.Enter(this.locker);
return propertiesContext.File; try
} {
} if ((this.fallbackRule == null))
{
private void InitializeFallbackRule() { this.InitializeFallbackRule();
if ((this.configuredProject == null)) { }
return; }
} finally
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGeneral.deserializedFallbackRule; {
if ((unboundRule == null)) { System.Threading.Monitor.Exit(this.locker);
System.IO.Stream xamlStream = null; }
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); }
try { return this.fallbackRule;
xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGeneral.xaml"); }
Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); }
System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
for ( private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName)
; ((unboundRule == null) {
&& ruleEnumerator.MoveNext()); if ((catalog == null))
) { {
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); return null;
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { }
unboundRule = t; return catalog.BindToContext(SchemaName, file, itemType, itemName);
unboundRule.Name = "e0400917-b7e9-4731-b3e6-447b229db9d4"; }
RazorGeneral.deserializedFallbackRule = unboundRule;
} private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext)
} {
} if ((propertiesContext.IsProjectFile == true))
finally { {
if ((xamlStream != null)) { return null;
((System.IDisposable)(xamlStream)).Dispose(); }
} else
} {
} return propertiesContext.File;
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); }
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); }
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
} private void InitializeFallbackRule()
} {
if ((this.configuredProject == null))
internal partial class RazorProjectProperties { {
return;
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral> CreateRazorGeneralPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral>(CreateRazorGeneralProperties); }
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGeneral.deserializedFallbackRule;
private static RazorGeneral CreateRazorGeneralProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state) { if ((unboundRule == null))
RazorProjectProperties that = ((RazorProjectProperties)(state)); {
return new RazorGeneral(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); System.IO.Stream xamlStream = null;
} System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
try
/// <summary>Gets the strongly-typed property accessor used to get and set Razor Properties properties.</summary> {
internal System.Threading.Tasks.Task<RazorGeneral> GetRazorGeneralPropertiesAsync() { xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGeneral.xaml");
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync(); Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream)));
return namedCatalogsTask.ContinueWith(CreateRazorGeneralPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
} for (
} ; ((unboundRule == null)
&& ruleEnumerator.MoveNext());
)
{
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current));
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName))
{
unboundRule = t;
unboundRule.Name = "6851f2efc446915a1288ec829aa82f7dc9bcfc6addb65b97866a1bc9e30b3348";
RazorGeneral.deserializedFallbackRule = unboundRule;
}
}
}
finally
{
if ((xamlStream != null))
{
((System.IDisposable)(xamlStream)).Dispose();
}
}
}
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext");
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext");
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
}
}
internal partial class RazorProjectProperties
{
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral> CreateRazorGeneralPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGeneral>(CreateRazorGeneralProperties);
private static RazorGeneral CreateRazorGeneralProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state)
{
RazorProjectProperties that = ((RazorProjectProperties)(state));
return new RazorGeneral(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
}
/// <summary>Gets the strongly-typed property accessor used to get and set Razor Properties properties.</summary>
internal System.Threading.Tasks.Task<RazorGeneral> GetRazorGeneralPropertiesAsync()
{
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
return namedCatalogsTask.ContinueWith(CreateRazorGeneralPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
}
/// <summary>Gets the strongly-typed property accessor used to get value from the current project snapshot Razor Properties properties.</summary>
internal bool TryGetCurrentRazorGeneralPropertiesSnapshot(out RazorGeneral snapshot, [System.Runtime.InteropServices.OptionalAttribute()] [System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] bool requiredToMatchProjectVersion)
{
snapshot = null;
Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.Properties.IProjectCatalogSnapshot> catalogSnapshot;
if (this.TryGetCurrentCatalogSnapshot(out catalogSnapshot))
{
if (requiredToMatchProjectVersion)
{
if ((this.ConfiguredProject.ProjectVersion.CompareTo(catalogSnapshot.DataSourceVersions[Microsoft.VisualStudio.ProjectSystem.ProjectDataSources.ConfiguredProjectVersion]) != 0))
{
return false;
}
}
Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule = this.GetSnapshotRule(catalogSnapshot.Value, "Project", RazorGeneral.SchemaName);
if ((rule != null))
{
snapshot = new RazorGeneral(rule, this.ConfiguredProject);
return true;
}
}
return false;
}
}
} }

View File

@ -8,205 +8,268 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules
{
internal partial class RazorGenerateWithTargetPath {
internal partial class RazorGenerateWithTargetPath
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary> {
private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
/// <summary>Backing field for deserialized rule.<see cref='Microsoft.Build.Framework.XamlTypes.Rule'/>.</summary>
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary> private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule;
internal const string SchemaName = "RazorGenerateWithTargetPath";
/// <summary>The name of the schema to look for at runtime to fulfill property access.</summary>
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string SchemaName = "RazorGenerateWithTargetPath";
internal const string PrimaryDataSourceItemType = "RazorGenerateWithTargetPath";
/// <summary>The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary> internal const string PrimaryDataSourceItemType = "RazorGenerateWithTargetPath";
internal const string PrimaryDataSourceLabel = "";
/// <summary>The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource.</summary>
/// <summary>Target Path (The "TargetPath" property).</summary> internal const string PrimaryDataSourceLabel = "";
internal const string TargetPathProperty = "TargetPath";
/// <summary> (The "TargetPath" property).</summary>
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary> internal const string TargetPathProperty = "TargetPath";
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
/// <summary>Backing field for the <see cref='Microsoft.Build.Framework.XamlTypes.Rule'/> property.</summary>
/// <summary>Backing field for the file name of the rule property.</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule;
private string file;
/// <summary>Backing field for the file name of the rule property.</summary>
/// <summary>Backing field for the ItemType property.</summary> private string file;
private string itemType;
/// <summary>Backing field for the ItemType property.</summary>
/// <summary>Backing field for the ItemName property.</summary> private string itemType;
private string itemName;
/// <summary>Backing field for the ItemName property.</summary>
/// <summary>Configured Project</summary> private string itemName;
private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
/// <summary>Configured Project</summary>
/// <summary>The dictionary of named catalogs.</summary> private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject;
private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
/// <summary>The dictionary of named catalogs.</summary>
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary> private System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
/// <summary>Backing field for the <see cref='Microsoft.VisualStudio.ProjectSystem.Properties.IRule'/> property.</summary>
/// <summary>Thread locking object</summary> private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule;
private object locker = new object();
/// <summary>Thread locking object</summary>
/// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary> private object locker = new object();
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) {
this.rule = rule; /// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary>
} internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule)
{
/// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary> this.rule = rule;
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) : }
this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) {
if ((configuredProject == null)) { /// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary>
throw new System.ArgumentNullException("configuredProject"); internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, string file, string itemType, string itemName) :
} this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName))
this.configuredProject = configuredProject; {
this.catalogs = catalogs; if ((configuredProject == null))
this.file = file; {
this.itemType = itemType; throw new System.ArgumentNullException("configuredProject");
this.itemName = itemName; }
} this.configuredProject = configuredProject;
this.catalogs = catalogs;
/// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary> this.file = file;
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : this.itemType = itemType;
this(rule) { this.itemName = itemName;
if ((rule == null)) { }
throw new System.ArgumentNullException("rule");
} /// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary>
if ((configuredProject == null)) { internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) :
throw new System.ArgumentNullException("configuredProject"); this(rule)
} {
this.configuredProject = configuredProject; if ((rule == null))
this.rule = rule; {
this.file = this.rule.File; throw new System.ArgumentNullException("rule");
this.itemType = this.rule.ItemType; }
this.itemName = this.rule.ItemName; if ((configuredProject == null))
} {
throw new System.ArgumentNullException("configuredProject");
/// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary> }
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : this.configuredProject = configuredProject;
this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { this.rule = rule;
} this.file = this.rule.File;
this.itemType = this.rule.ItemType;
/// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class that assumes a project context (neither property sheet nor items).</summary> this.itemName = this.rule.ItemName;
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) : }
this(configuredProject, catalogs, "Project", null, null, null) {
} /// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class.</summary>
internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) :
/// <summary>Gets the IRule used to get and set properties.</summary> this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName)
public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { {
get { }
return this.rule;
} /// <summary>Initializes a new instance of the RazorGenerateWithTargetPath class that assumes a project context (neither property sheet nor items).</summary>
} internal RazorGenerateWithTargetPath(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog> catalogs) :
this(configuredProject, catalogs, "Project", null, null, null)
/// <summary>Target Path</summary> {
internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty TargetPath { }
get {
Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; /// <summary>Gets the IRule used to get and set properties.</summary>
if ((localRule == null)) { public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule
localRule = this.GeneratedFallbackRule; {
} get
if ((localRule == null)) { {
return null; return this.rule;
} }
Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(TargetPathProperty))); }
if (((property == null)
&& (this.GeneratedFallbackRule != null))) { /// <summary>TargetPath</summary>
localRule = this.GeneratedFallbackRule; internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty TargetPath
property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(TargetPathProperty))); {
} get
return property; {
} Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule;
} if ((localRule == null))
{
/// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary> localRule = this.GeneratedFallbackRule;
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { }
get { if ((localRule == null))
if (((this.fallbackRule == null) {
&& (this.configuredProject != null))) { return null;
System.Threading.Monitor.Enter(this.locker); }
try { Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(TargetPathProperty)));
if ((this.fallbackRule == null)) { if (((property == null)
this.InitializeFallbackRule(); && (this.GeneratedFallbackRule != null)))
} {
} localRule = this.GeneratedFallbackRule;
finally { property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(TargetPathProperty)));
System.Threading.Monitor.Exit(this.locker); }
} return property;
} }
return this.fallbackRule; }
}
} /// <summary>Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing</summary>
private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule
private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { {
if ((catalog == null)) { get
return null; {
} if (((this.fallbackRule == null)
return catalog.BindToContext(SchemaName, file, itemType, itemName); && (this.configuredProject != null)))
} {
System.Threading.Monitor.Enter(this.locker);
private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { try
if ((propertiesContext.IsProjectFile == true)) { {
return null; if ((this.fallbackRule == null))
} {
else { this.InitializeFallbackRule();
return propertiesContext.File; }
} }
} finally
{
private void InitializeFallbackRule() { System.Threading.Monitor.Exit(this.locker);
if ((this.configuredProject == null)) { }
return; }
} return this.fallbackRule;
Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGenerateWithTargetPath.deserializedFallbackRule; }
if ((unboundRule == null)) { }
System.IO.Stream xamlStream = null;
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName)
try { {
xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGenerateWithTargetPath.xaml"); if ((catalog == null))
Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); {
System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); return null;
for ( }
; ((unboundRule == null) return catalog.BindToContext(SchemaName, file, itemType, itemName);
&& ruleEnumerator.MoveNext()); }
) {
Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext)
if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { {
unboundRule = t; if ((propertiesContext.IsProjectFile == true))
unboundRule.Name = "4d01f23e-96db-4c90-9c01-17b7f8b61243"; {
RazorGenerateWithTargetPath.deserializedFallbackRule = unboundRule; return null;
} }
} else
} {
finally { return propertiesContext.File;
if ((xamlStream != null)) { }
((System.IDisposable)(xamlStream)).Dispose(); }
}
} private void InitializeFallbackRule()
} {
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); if ((this.configuredProject == null))
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); {
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); return;
} }
} Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGenerateWithTargetPath.deserializedFallbackRule;
if ((unboundRule == null))
internal partial class RazorProjectProperties { {
System.IO.Stream xamlStream = null;
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGenerateWithTargetPath> CreateRazorGenerateWithTargetPathPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGenerateWithTargetPath>(CreateRazorGenerateWithTargetPathProperties); System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
try
private static RazorGenerateWithTargetPath CreateRazorGenerateWithTargetPathProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state) { {
RazorProjectProperties that = ((RazorProjectProperties)(state)); xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGenerateWithTargetPath.xaml");
return new RazorGenerateWithTargetPath(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream)));
} System.Collections.Generic.IEnumerator<System.Object> ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator();
for (
/// <summary>Gets the strongly-typed property accessor used to get and set Razor Document Properties properties.</summary> ; ((unboundRule == null)
internal System.Threading.Tasks.Task<RazorGenerateWithTargetPath> GetRazorGenerateWithTargetPathPropertiesAsync() { && ruleEnumerator.MoveNext());
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync(); )
return namedCatalogsTask.ContinueWith(CreateRazorGenerateWithTargetPathPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); {
} Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current));
} if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName))
{
unboundRule = t;
unboundRule.Name = "4325a10cce970a389c33b97140c4307d2e10664e053c75cf9e0e0fd08288774f";
RazorGenerateWithTargetPath.deserializedFallbackRule = unboundRule;
}
}
}
finally
{
if ((xamlStream != null))
{
((System.IDisposable)(xamlStream)).Dispose();
}
}
}
this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext");
Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext");
this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName);
}
}
internal partial class RazorProjectProperties
{
private static System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGenerateWithTargetPath> CreateRazorGenerateWithTargetPathPropertiesDelegate = new System.Func<System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>>, object, RazorGenerateWithTargetPath>(CreateRazorGenerateWithTargetPathProperties);
private static RazorGenerateWithTargetPath CreateRazorGenerateWithTargetPathProperties(System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogs, object state)
{
RazorProjectProperties that = ((RazorProjectProperties)(state));
return new RazorGenerateWithTargetPath(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName);
}
/// <summary>Gets the strongly-typed property accessor used to get and set Razor Document Properties properties.</summary>
internal System.Threading.Tasks.Task<RazorGenerateWithTargetPath> GetRazorGenerateWithTargetPathPropertiesAsync()
{
System.Threading.Tasks.Task<System.Collections.Immutable.IImmutableDictionary<string, Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog>> namedCatalogsTask = this.GetNamedCatalogsAsync();
return namedCatalogsTask.ContinueWith(CreateRazorGenerateWithTargetPathPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default);
}
/// <summary>Gets the strongly-typed property accessor used to get value from the current project snapshot Razor Document Properties properties.</summary>
internal bool TryGetCurrentRazorGenerateWithTargetPathPropertiesSnapshot(out RazorGenerateWithTargetPath snapshot, [System.Runtime.InteropServices.OptionalAttribute()] [System.Runtime.InteropServices.DefaultParameterValueAttribute(true)] bool requiredToMatchProjectVersion)
{
snapshot = null;
Microsoft.VisualStudio.ProjectSystem.IProjectVersionedValue<Microsoft.VisualStudio.ProjectSystem.Properties.IProjectCatalogSnapshot> catalogSnapshot;
if (this.TryGetCurrentCatalogSnapshot(out catalogSnapshot))
{
if (requiredToMatchProjectVersion)
{
if ((this.ConfiguredProject.ProjectVersion.CompareTo(catalogSnapshot.DataSourceVersions[Microsoft.VisualStudio.ProjectSystem.ProjectDataSources.ConfiguredProjectVersion]) != 0))
{
return false;
}
}
Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule = this.GetSnapshotRule(catalogSnapshot.Value, "Project", RazorGenerateWithTargetPath.SchemaName);
if ((rule != null))
{
snapshot = new RazorGenerateWithTargetPath(rule, this.ConfiguredProject);
return true;
}
}
return false;
}
}
} }

View File

@ -29,7 +29,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
public TestProjectSystemServices(string fullPath, params TestPropertyData[] data) public TestProjectSystemServices(string fullPath, params TestPropertyData[] data)
{ {
ProjectService = new TestProjectService(); ProjectService = new TestProjectService();
ThreadingService = ProjectService.Services.ThreadingPolicy; ThreadingService = ProjectService.Services.TestThreadingPolicy;
UnconfiguredProject = new TestUnconfiguredProject(ProjectService, fullPath); UnconfiguredProject = new TestUnconfiguredProject(ProjectService, fullPath);
ProjectService.LoadedUnconfiguredProjects.Add(UnconfiguredProject); ProjectService.LoadedUnconfiguredProjects.Add(UnconfiguredProject);
@ -87,33 +87,33 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
dataSourceVersions: ImmutableDictionary<NamedIdentity, IComparable>.Empty); dataSourceVersions: ImmutableDictionary<NamedIdentity, IComparable>.Empty);
} }
public class TestProjectServices : IProjectServices public class TestProjectServices : ProjectServices
{ {
public TestProjectServices(TestProjectService projectService) public TestProjectServices(TestProjectService projectService)
{ {
ProjectService = projectService; TestProjectService = projectService;
ThreadingPolicy = new TestThreadingService(); TestThreadingPolicy = new TestThreadingService();
} }
public TestProjectService ProjectService { get; } public TestProjectService TestProjectService { get; }
public TestThreadingService ThreadingPolicy { get; } public TestThreadingService TestThreadingPolicy { get; }
IProjectLockService IProjectServices.ProjectLockService => throw new NotImplementedException(); public override IProjectService ProjectService => TestProjectService;
IProjectThreadingService IProjectServices.ThreadingPolicy => ThreadingPolicy; public override IProjectThreadingService ThreadingPolicy => TestThreadingPolicy;
IProjectFaultHandlerService IProjectServices.FaultHandler => throw new NotImplementedException(); public override ExportProvider ExportProvider => throw new NotImplementedException();
IProjectReloader IProjectServices.ProjectReloader => throw new NotImplementedException(); public override IProjectDataSourceRegistry DataSourceRegistry => throw new NotImplementedException();
ExportProvider IProjectCommonServices.ExportProvider => throw new NotImplementedException(); public override IProjectCapabilitiesScope Capabilities => throw new NotImplementedException();
IProjectDataSourceRegistry IProjectCommonServices.DataSourceRegistry => throw new NotImplementedException(); public override IProjectLockService ProjectLockService => throw new NotImplementedException();
IProjectService IProjectCommonServices.ProjectService => ProjectService; public override IProjectFaultHandlerService FaultHandler => throw new NotImplementedException();
IProjectCapabilitiesScope IProjectCommonServices.Capabilities => throw new NotImplementedException(); public override IProjectReloader ProjectReloader => throw new NotImplementedException();
} }
public class TestProjectService : IProjectService public class TestProjectService : IProjectService
@ -130,7 +130,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
IEnumerable<UnconfiguredProject> IProjectService.LoadedUnconfiguredProjects => throw new NotImplementedException(); IEnumerable<UnconfiguredProject> IProjectService.LoadedUnconfiguredProjects => throw new NotImplementedException();
IProjectServices IProjectService.Services => Services; ProjectServices IProjectService.Services => Services;
IProjectCapabilitiesScope IProjectService.Capabilities => throw new NotImplementedException(); IProjectCapabilitiesScope IProjectService.Capabilities => throw new NotImplementedException();
@ -171,15 +171,16 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
public List<TestConfiguredProject> LoadedConfiguredProjects { get; } public List<TestConfiguredProject> LoadedConfiguredProjects { get; }
public UnconfiguredProjectServices Services => throw new NotImplementedException();
string UnconfiguredProject.FullPath => FullPath; string UnconfiguredProject.FullPath => FullPath;
bool UnconfiguredProject.RequiresReloadForExternalFileChange => throw new NotImplementedException(); bool UnconfiguredProject.RequiresReloadForExternalFileChange => throw new NotImplementedException();
IProjectCapabilitiesScope UnconfiguredProject.Capabilities => throw new NotImplementedException(); IProjectCapabilitiesScope UnconfiguredProject.Capabilities => throw new NotImplementedException();
IProjectService UnconfiguredProject.ProjectService => ProjectService; IProjectService UnconfiguredProject.ProjectService => ProjectService;
IUnconfiguredProjectServices UnconfiguredProject.Services => throw new NotImplementedException();
IEnumerable<ConfiguredProject> UnconfiguredProject.LoadedConfiguredProjects => LoadedConfiguredProjects; IEnumerable<ConfiguredProject> UnconfiguredProject.LoadedConfiguredProjects => LoadedConfiguredProjects;
bool UnconfiguredProject.IsLoading => throw new NotImplementedException(); bool UnconfiguredProject.IsLoading => throw new NotImplementedException();
@ -323,7 +324,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
UnconfiguredProject ConfiguredProject.UnconfiguredProject => UnconfiguredProject; UnconfiguredProject ConfiguredProject.UnconfiguredProject => UnconfiguredProject;
IConfiguredProjectServices ConfiguredProject.Services => Services; ConfiguredProjectServices ConfiguredProject.Services => Services;
event AsyncEventHandler ConfiguredProject.ProjectUnloading event AsyncEventHandler ConfiguredProject.ProjectUnloading
{ {
@ -370,65 +371,81 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem
} }
} }
public class TestConfiguredProjectServices : IConfiguredProjectServices public class TestConfiguredProjectServices : ConfiguredProjectServices
{ {
public TestConfiguredProjectServices(TestConfiguredProject configuredProject, TestPropertyData[] data) public TestConfiguredProjectServices(TestConfiguredProject configuredProject, TestPropertyData[] data)
{ {
ConfiguredProject = configuredProject; ConfiguredProject = configuredProject;
AdditionalRuleDefinitions = new TestAdditionalRuleDefinitionsService(); TestAdditionalRuleDefinitions = new TestAdditionalRuleDefinitionsService();
PropertyPagesCatalog = new TestPropertyPagesCatalogProvider(new TestPropertyPagesCatalog(data)); TestPropertyPagesCatalog = new TestPropertyPagesCatalogProvider(new TestPropertyPagesCatalog(data));
} }
public TestConfiguredProject ConfiguredProject { get; } public TestConfiguredProject ConfiguredProject { get; }
public TestAdditionalRuleDefinitionsService AdditionalRuleDefinitions { get; } public TestAdditionalRuleDefinitionsService TestAdditionalRuleDefinitions { get; }
public TestPropertyPagesCatalogProvider PropertyPagesCatalog { get; } public override IAdditionalRuleDefinitionsService AdditionalRuleDefinitions => TestAdditionalRuleDefinitions;
IOutputGroupsService IConfiguredProjectServices.OutputGroups => throw new NotImplementedException(); public TestPropertyPagesCatalogProvider TestPropertyPagesCatalog { get; }
IBuildProject IConfiguredProjectServices.Build => throw new NotImplementedException(); public override IPropertyPagesCatalogProvider PropertyPagesCatalog => TestPropertyPagesCatalog;
IBuildSupport IConfiguredProjectServices.BuildSupport => throw new NotImplementedException(); public override IOutputGroupsService OutputGroups => throw new NotImplementedException();
IAssemblyReferencesService IConfiguredProjectServices.AssemblyReferences => throw new NotImplementedException(); public override IBuildProject Build => throw new NotImplementedException();
IComReferencesService IConfiguredProjectServices.ComReferences => throw new NotImplementedException(); public override IBuildSupport BuildSupport => throw new NotImplementedException();
ISdkReferencesService IConfiguredProjectServices.SdkReferences => throw new NotImplementedException(); public override IAssemblyReferencesService AssemblyReferences => throw new NotImplementedException();
IPackageReferencesService IConfiguredProjectServices.PackageReferences => throw new NotImplementedException(); public override IComReferencesService ComReferences => throw new NotImplementedException();
IWinRTReferencesService IConfiguredProjectServices.WinRTReferences => throw new NotImplementedException(); public override ISdkReferencesService SdkReferences => throw new NotImplementedException();
IBuildDependencyProjectReferencesService IConfiguredProjectServices.ProjectReferences => throw new NotImplementedException(); public override IPackageReferencesService PackageReferences => throw new NotImplementedException();
IProjectItemProvider IConfiguredProjectServices.SourceItems => throw new NotImplementedException(); public override IWinRTReferencesService WinRTReferences => throw new NotImplementedException();
IProjectPropertiesProvider IConfiguredProjectServices.ProjectPropertiesProvider => throw new NotImplementedException(); public override IBuildDependencyProjectReferencesService ProjectReferences => throw new NotImplementedException();
IProjectPropertiesProvider IConfiguredProjectServices.UserPropertiesProvider => throw new NotImplementedException(); public override IProjectItemProvider SourceItems => throw new NotImplementedException();
IProjectAsynchronousTasksService IConfiguredProjectServices.ProjectAsynchronousTasks => throw new NotImplementedException(); public override IProjectPropertiesProvider ProjectPropertiesProvider => throw new NotImplementedException();
IAdditionalRuleDefinitionsService IConfiguredProjectServices.AdditionalRuleDefinitions => AdditionalRuleDefinitions; public override IProjectPropertiesProvider UserPropertiesProvider => throw new NotImplementedException();
IPropertyPagesCatalogProvider IConfiguredProjectServices.PropertyPagesCatalog => PropertyPagesCatalog; public override IProjectSubscriptionService ProjectSubscription => throw new NotImplementedException();
IProjectSubscriptionService IConfiguredProjectServices.ProjectSubscription => throw new NotImplementedException(); public override IProjectSnapshotService ProjectSnapshotService => throw new NotImplementedException();
IProjectSnapshotService IConfiguredProjectServices.ProjectSnapshotService => throw new NotImplementedException(); public override IActiveConfiguredProjectSubscriptionService ActiveConfiguredProjectSubscription => throw new NotImplementedException();
object IConfiguredProjectServices.HostObject => throw new NotImplementedException(); public override IActiveConfiguredProjectProvider ActiveConfiguredProjectProvider => throw new NotImplementedException();
ExportProvider IProjectCommonServices.ExportProvider => throw new NotImplementedException(); public override IProjectAsynchronousTasksService ProjectAsynchronousTasks => throw new NotImplementedException();
IProjectDataSourceRegistry IProjectCommonServices.DataSourceRegistry => throw new NotImplementedException(); public override IProjectConfigurationsService ProjectConfigurationsService => throw new NotImplementedException();
IProjectService IProjectCommonServices.ProjectService => ConfiguredProject.UnconfiguredProject.ProjectService; public override object HostObject => throw new NotImplementedException();
IProjectCapabilitiesScope IProjectCommonServices.Capabilities => throw new NotImplementedException(); public override IProjectCapabilitiesRequirementsService ProjectCapabilitiesRequirementsService => throw new NotImplementedException();
public override ExportProvider ExportProvider => throw new NotImplementedException();
public override IProjectDataSourceRegistry DataSourceRegistry => throw new NotImplementedException();
public override IProjectService ProjectService => ConfiguredProject.UnconfiguredProject.ProjectService;
public override IProjectCapabilitiesScope Capabilities => throw new NotImplementedException();
public override IProjectLockService ProjectLockService => throw new NotImplementedException();
public override IProjectThreadingService ThreadingPolicy => throw new NotImplementedException();
public override IProjectFaultHandlerService FaultHandler => throw new NotImplementedException();
public override IProjectReloader ProjectReloader => throw new NotImplementedException();
} }
public class TestAdditionalRuleDefinitionsService : IAdditionalRuleDefinitionsService public class TestAdditionalRuleDefinitionsService : IAdditionalRuleDefinitionsService