/// <devdoc> /// Returns the default CompilerType to be used for a specific language /// </devdoc> protected CompilerType GetDefaultCompilerTypeForLanguage(string language) { return(CompilationUtil.GetCompilerInfoFromLanguage(VirtualPathObject, language)); }
/// <devdoc> /// Returns the default CompilerType to be used for the default language /// </devdoc> protected CompilerType GetDefaultCompilerType() { return(CompilationUtil.GetDefaultLanguageCompilerInfo(null /*compConfig*/, VirtualPathObject)); }
private static string GetVisualBasicCompilerVersion() { return(CompilationUtil.GetCompilerVersion(typeof(VBCodeProvider))); }
private static string GetCSharpCompilerVersion() { return(CompilationUtil.GetCompilerVersion(typeof(CSharpCodeProvider))); }
public override void GenerateCode(AssemblyBuilder assemblyBuilder) { #if !FEATURE_PAL // FEATURE_PAL does not support System.Data.Design // Get the namespace that we will use string ns = Util.GetNamespaceFromVirtualPath(VirtualPathObject); // We need to use XmlDocument to parse the xsd file is order to open it with the // correct encoding (VSWhidbey 566286) XmlDocument doc = new XmlDocument(); using (Stream stream = OpenStream()) { doc.Load(stream); } String content = doc.OuterXml; // Generate a CodeCompileUnit from the dataset CodeCompileUnit codeCompileUnit = new CodeCompileUnit(); CodeNamespace codeNamespace = new CodeNamespace(ns); codeCompileUnit.Namespaces.Add(codeNamespace); // Devdiv 18365, Dev10 bug 444516 // Call a different Generate method if compiler version is v3.5 or above bool isVer35OrAbove = CompilationUtil.IsCompilerVersion35OrAbove(assemblyBuilder.CodeDomProvider.GetType()); if (isVer35OrAbove) { TypedDataSetGenerator.GenerateOption generateOptions = TypedDataSetGenerator.GenerateOption.None; generateOptions |= TypedDataSetGenerator.GenerateOption.HierarchicalUpdate; generateOptions |= TypedDataSetGenerator.GenerateOption.LinqOverTypedDatasets; Hashtable customDBProviders = null; TypedDataSetGenerator.Generate(content, codeCompileUnit, codeNamespace, assemblyBuilder.CodeDomProvider, customDBProviders, generateOptions); } else { TypedDataSetGenerator.Generate(content, codeCompileUnit, codeNamespace, assemblyBuilder.CodeDomProvider); } // Add all the assembly references needed by the generated code if (TypedDataSetGenerator.ReferencedAssemblies != null) { var isVer35 = CompilationUtil.IsCompilerVersion35(assemblyBuilder.CodeDomProvider.GetType()); foreach (Assembly a in TypedDataSetGenerator.ReferencedAssemblies) { if (isVer35) { var aName = a.GetName(); if (aName.Name == "System.Data.DataSetExtensions") { // Dev10 Bug 861688 - We need to specify v3.5 version so that the build system knows to use the v3.5 version // because the loaded assembly here is always v4.0 aName.Version = new Version(3, 5, 0, 0); CompilationSection.RecordAssembly(aName.FullName, a); } } assemblyBuilder.AddAssemblyReference(a); } } // Add the CodeCompileUnit to the compilation assemblyBuilder.AddCodeCompileUnit(this, codeCompileUnit); #else // !FEATURE_PAL throw new NotImplementedException("System.Data.Design - ROTORTODO"); #endif // !FEATURE_PAL }
protected CompilerType GetDefaultCompilerType() { return(CompilationUtil.GetDefaultLanguageCompilerInfo(null, this.VirtualPathObject)); }
private static CompilerType GetDefaultCompilerTypeWithParams(CompilationSection compConfig, VirtualPath configPath) { return(CompilationUtil.GetCSharpCompilerInfo(compConfig, configPath)); }