# T4 Text Templates ## Links * [Code Generation and T4 Text Templates](http://msdn.microsoft.com/en-us/library/bb126445.aspx) * [Design-Time Code Generation by using T4 Text Templates](http://msdn.microsoft.com/en-us/library/dd820620.aspx) * [T4 Include Directive](http://msdn.microsoft.com/en-us/library/gg586949.aspx) ## Code string configFile = this.Host.ResolvePath("ZMQ.config"); var serviceProvider = this.Host as IServiceProvider; var dte = serviceProvider.GetService(typeof(DTE)) as DTE; var solutionConfig = dte.Solution.SolutionBuild.ActiveConfiguration.Name ; var configFileMap = new ExeConfigurationFileMap {ExeConfigFilename = configFile}; var config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(configFileMap, ConfigurationUserLevel.None); var settings = config.AppSettings.Settings; var val = settings["Namespace"]; string zmqNamespace = val != null ? val.Value : "NULL"; val = settings["ClassName"]; string zmqClassName = val != null ? val.Value : "public"; val = settings["Visibility"]; string zmqVisibility = val != null ? val.Value : "public"; val = settings["Version"]; Version zmqVersion = val != null ? new Version(val.Value) : new Version(1,0); string vs; switch (dte.Version) { case "9.0": vs = "v90"; break; case "10.0": vs = "v100"; break; case "11.0": vs = "v110"; break; default: vs = "v120"; break; } var dllFile = string.Format("libzmq-{0}-mt-{1}_{2}_{3}.dll", vs, zmqVersion.Major, zmqVersion.Minor, zmqVersion.Build);