public T4LightWeightAssemblyResolutionCache( Lifetime lifetime, [NotNull] IShellLocks locks, [NotNull] IPersistentIndexManager persistentIndexManager, [NotNull] RawVsServiceProvider provider ) : base(lifetime, locks, persistentIndexManager, T4LightWeightAssemblyResolutionDataMarshaller.Instance) { Components = Lazy.Of(() => new Optional <ITextTemplatingComponents>( provider.Value.GetService <STextTemplating, ITextTemplatingComponents>() ), true); }
public T4LightWeightAssemblyResolutionCache( Lifetime lifetime, IPersistentIndexManager persistentIndexManager, [NotNull] RawVsServiceProvider provider ) : base(lifetime, persistentIndexManager, T4LightWeightAssemblyResolutionDataMarshaller.Instance) =>
public T4Environment( [NotNull] IVsEnvironmentInformation vsEnvironmentInformation, [NotNull] RawVsServiceProvider rawVsServiceProvider ) { _vsEnvironmentInformation = vsEnvironmentInformation; _components = Lazy.Of(() => new Optional <ITextTemplatingComponents>(rawVsServiceProvider.Value.GetService <STextTemplating, ITextTemplatingComponents>()), true); switch (vsEnvironmentInformation.VsVersion2.Major) { case VsVersions.Vs2010: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 0)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp40; _textTemplatingAssemblyNames = new[] { CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating", 10), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 10) }; break; case VsVersions.Vs2012: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 5)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating", 11), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 11), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 10) }; break; case VsVersions.Vs2013: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 5)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating", 12), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 11), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 10) }; break; case VsVersions.Vs2015: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 5)); const int vs2015Update2Build = 25123; CSharpLanguageLevel = vsEnvironmentInformation.VsVersion4.Build >= vs2015Update2Build ? CSharpLanguageLevel.CSharp60 : CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating", 14), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 11), CreateGacAssemblyName("Microsoft.VisualStudio.TextTemplating.Interfaces", 10) }; break; case VsVersions.Vs2017: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 6)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp70; _textTemplatingAssemblyNames = new[] { CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.15.0"), CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.Interfaces.11.0"), CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0") }; break; case VsVersions.Vs2019: _targetFrameworkId = TargetFrameworkId.Create(FrameworkIdentifier.NetFramework, new Version(4, 7, 2)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp73; _textTemplatingAssemblyNames = new[] { CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.15.0"), CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.Interfaces.11.0"), CreateDevEnvPublicAssemblyName(vsEnvironmentInformation, "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0") }; break; default: _textTemplatingAssemblyNames = EmptyArray <string> .Instance; break; } }
public T4Environment([NotNull] IVsEnvironmentInformation vsEnvironmentInformation, [NotNull] RawVsServiceProvider rawVsServiceProvider) { _vsEnvironmentInformation = vsEnvironmentInformation; _components = Lazy.Of(() => new Optional <ITextTemplatingComponents>(rawVsServiceProvider.Value.GetService <STextTemplating, ITextTemplatingComponents>()), true); uint vsMajorVersion = vsEnvironmentInformation.VsVersion2.Major; switch (vsMajorVersion) { case VsVersions.Vs2010: _platformID = new PlatformID(FrameworkIdentifier.NetFramework, new Version(4, 0)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp40; _textTemplatingAssemblyNames = new[] { "Microsoft.VisualStudio.TextTemplating.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" }; break; case VsVersions.Vs2012: _platformID = new PlatformID(FrameworkIdentifier.NetFramework, new Version(4, 5)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { "Microsoft.VisualStudio.TextTemplating.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" }; break; case VsVersions.Vs2013: _platformID = new PlatformID(FrameworkIdentifier.NetFramework, new Version(4, 5)); CSharpLanguageLevel = CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { "Microsoft.VisualStudio.TextTemplating.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" }; break; case VsVersions.Vs2015: _platformID = new PlatformID(FrameworkIdentifier.NetFramework, new Version(4, 5)); const int vs2015Update2Build = 25123; CSharpLanguageLevel = vsEnvironmentInformation.VsVersion4.Build >= vs2015Update2Build ? CSharpLanguageLevel.CSharp60 : CSharpLanguageLevel.CSharp50; _textTemplatingAssemblyNames = new[] { "Microsoft.VisualStudio.TextTemplating.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "Microsoft.VisualStudio.TextTemplating.Interfaces.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" }; break; default: _textTemplatingAssemblyNames = EmptyArray <string> .Instance; break; } }