当前位置: 首页>>代码示例>>C#>>正文


C# VSNet.Configuration类代码示例

本文整理汇总了C#中NAnt.VSNet.Configuration的典型用法代码示例。如果您正苦于以下问题:C# Configuration类的具体用法?C# Configuration怎么用?C# Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Configuration类属于NAnt.VSNet命名空间,在下文中一共展示了Configuration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MSBuildConfiguration

        public MSBuildConfiguration(MSBuildProject project, NAnt.MSBuild.BuildEngine.Project msproj, Configuration projectConfig)
            : base(project)
        {
            _name = projectConfig.Name;
            _platform = projectConfig.Platform;

            //explicit set. EvaluatedProperties will use those.
            //Its caller responsibility to set it back to original values, if needed
            msproj.GlobalProperties.SetProperty("Configuration", _name);

            if (!String.IsNullOrEmpty(_platform)) {
                msproj.GlobalProperties.SetProperty("Platform", _platform.Replace(" ", string.Empty));
            }

            _relativeOutputDir = msproj.GetEvaluatedProperty("OutputPath");
            if (!_relativeOutputDir.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture))) {
                _relativeOutputDir = _relativeOutputDir + Path.DirectorySeparatorChar;
            }
            _outputDir = new DirectoryInfo(FileUtils.CombinePaths(
                project.ProjectDirectory.FullName,
                _relativeOutputDir));

            _objdir = new DirectoryInfo(msproj.GetEvaluatedProperty("IntermediateOutputPath"));

            _outputType = GetType(msproj.GetEvaluatedProperty("OutputType"));
            _asmname = msproj.GetEvaluatedProperty("AssemblyName");
        }
开发者ID:julianhaslinger,项目名称:nant,代码行数:27,代码来源:MSBuildConfiguration.cs

示例2: MSBuildProject

        public MSBuildProject(SolutionBase solution, string projectPath, XmlElement xmlDefinition, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver, DirectoryInfo outputDir)
            : base(xmlDefinition, solutionTask, tfc, gacCache, refResolver, outputDir)
        {
            string cfgname = solutionTask.Configuration;
            string platform = solutionTask.Platform;

            _msbuild = MSBuildEngine.CreateMSEngine(solutionTask);
            _msproj = new Microsoft.Build.BuildEngine.Project(_msbuild);
            _msproj.FullFileName = projectPath;
            _msproj.LoadXml(xmlDefinition.OuterXml);
            _msproj.GlobalProperties.SetProperty("Configuration", cfgname);
            SetPlatform (platform);
            if (outputDir != null) _msproj.GlobalProperties.SetProperty("OutputPath", outputDir.FullName);

            //evaluating
            _guid = _msproj.GetEvaluatedProperty("ProjectGuid");
            _projectDirectory = new DirectoryInfo(_msproj.GetEvaluatedProperty("ProjectDir"));
            _projectPath = _msproj.GetEvaluatedProperty("ProjectPath");

            ProjectEntry projectEntry = solution.ProjectEntries [_guid];
            if (projectEntry != null && projectEntry.BuildConfigurations != null) {
                foreach (ConfigurationMapEntry ce in projectEntry.BuildConfigurations) {
                    Configuration projectConfig = ce.Value;
                    ProjectConfigurations[projectConfig] = new MSBuildConfiguration(this, _msproj, projectConfig);
                }
            } else {
                Configuration projectConfig = new Configuration (cfgname, platform);
                ProjectConfigurations[projectConfig] = new MSBuildConfiguration(this, _msproj, projectConfig);
            }

            //references
            _references = new ArrayList();
            Microsoft.Build.BuildEngine.BuildItemGroup refs = _msproj.GetEvaluatedItemsByName("Reference");
            foreach (Microsoft.Build.BuildEngine.BuildItem r in refs) {
                string rpath = r.FinalItemSpec;
                string priv = r.GetMetadata("Private");
                string hintpath = r.GetMetadata("HintPath");

                ReferenceBase reference = new MSBuildAssemblyReference(
                    xmlDefinition, ReferencesResolver, this, gacCache,
                    rpath, priv, hintpath);
                _references.Add(reference);
            }
            refs = _msproj.GetEvaluatedItemsByName("ProjectReference");
            foreach (Microsoft.Build.BuildEngine.BuildItem r in refs) {
                string pguid = r.GetMetadata("Project");
                string pname = r.GetMetadata("Name");
                string rpath = r.FinalItemSpec;
                string priv = r.GetMetadata("Private");
                ReferenceBase reference = new MSBuildProjectReference(
                    ReferencesResolver, this, solution, tfc, gacCache, outputDir,
                    pguid, pname, rpath, priv);
                _references.Add(reference);
            }
        }
开发者ID:smaclell,项目名称:NAnt,代码行数:55,代码来源:MSBuildProject.cs

示例3: MSBuildConfiguration

        public MSBuildConfiguration(MSBuildProject project, Microsoft.Build.BuildEngine.Project msproj, Configuration projectConfig)
            : base(project)
        {
            _name = projectConfig.Name;

            msproj.GlobalProperties.SetProperty("Configuration", _name);
            project.SetPlatform (projectConfig.Platform);
            _platform = msproj.GetEvaluatedProperty("Platform");

            _relativeOutputDir = msproj.GetEvaluatedProperty("OutputPath");
            if (!_relativeOutputDir.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture))) {
                _relativeOutputDir = _relativeOutputDir + Path.DirectorySeparatorChar;
            }
            _outputDir = new DirectoryInfo(FileUtils.CombinePaths(
                project.ProjectDirectory.FullName,
                _relativeOutputDir));

            _objdir = new DirectoryInfo(msproj.GetEvaluatedProperty("IntermediateOutputPath"));

            _outputType = GetType(msproj.GetEvaluatedProperty("OutputType"));
            _asmname = msproj.GetEvaluatedProperty("AssemblyName");
        }
开发者ID:smaclell,项目名称:NAnt,代码行数:22,代码来源:MSBuildConfiguration.cs

示例4: IsManaged

 /// <summary>
 /// Gets a value indicating whether the reference is managed for the
 /// specified configuration.
 /// </summary>
 /// <param name="config">The build configuration of the reference.</param>
 /// <returns>
 /// <see langword="true" />.
 /// </returns>
 public override bool IsManaged(Configuration config)
 {
     return true;
 }
开发者ID:julianhaslinger,项目名称:nant,代码行数:12,代码来源:FileReferenceBase.cs

示例5: Remove

 public void Remove(Configuration configuration) {
     _innerHash.Remove(configuration);
 }
开发者ID:RoastBoy,项目名称:nant,代码行数:3,代码来源:ConfigurationMap.cs

示例6: GetTimestamp

 /// <summary>
 /// Gets the timestamp of the reference.
 /// </summary>
 /// <param name="solutionConfiguration">The solution configuration that is built.</param>
 /// <returns>
 /// The timestamp of the reference.
 /// </returns>
 public abstract DateTime GetTimestamp(Configuration solutionConfiguration);
开发者ID:skolima,项目名称:NAnt,代码行数:8,代码来源:ReferenceBase.cs

示例7: GetOutputFiles

 /// <summary>
 /// Gets the complete set of output files of the reference for the 
 /// specified configuration.
 /// </summary>
 /// <param name="solutionConfiguration">The solution configuration that is built.</param>
 /// <param name="outputFiles">The set of output files to be updated.</param>
 /// <remarks>
 /// The key of the case-insensitive <see cref="Hashtable" /> is the 
 /// full path of the output file and the value is the path relative to
 /// the output directory.
 /// </remarks>
 public abstract void GetOutputFiles(Configuration solutionConfiguration, Hashtable outputFiles);
开发者ID:skolima,项目名称:NAnt,代码行数:12,代码来源:ReferenceBase.cs

示例8: Add

 public void Add(Configuration key, Configuration value) {
     _innerHash.Add (key, value);
 }
开发者ID:RoastBoy,项目名称:nant,代码行数:3,代码来源:ConfigurationMap.cs

示例9: return

 public Configuration this[Configuration key] {
     get { return (Configuration) _innerHash[key]; }
     set { _innerHash[key] = value; }
 }
开发者ID:RoastBoy,项目名称:nant,代码行数:4,代码来源:ConfigurationMap.cs

示例10: GetOutputFiles

        /// <summary>
        /// Gets the complete set of output files for the project configuration
        /// matching the specified solution configuration.
        /// </summary>
        /// <param name="solutionConfiguration">The solution configuration that is built.</param>
        /// <param name="outputFiles">The set of output files to be updated.</param>
        /// <remarks>
        ///   <para>
        ///   The key of the case-insensitive <see cref="Hashtable" /> is the 
        ///   full path of the output file and the value is the path relative to
        ///   the output directory.
        ///   </para>
        ///   <para>
        ///   If the project is not configured to be built for the specified
        ///   solution configuration, then no output files are added.
        ///   </para>
        /// </remarks>
        public override void GetOutputFiles(Configuration solutionConfiguration, Hashtable outputFiles)
        {
            base.GetOutputFiles (solutionConfiguration, outputFiles);

            // obtain project configuration (corresponding with solution configuration)
            ConfigurationSettings projectConfig = (ConfigurationSettings)
                BuildConfigurations[solutionConfiguration];
            if (projectConfig == null) {
                // the project is not configured to be built for the specified
                // solution configuration
                return;
            }

            // add type library
            if (projectConfig.RegisterForComInterop) {
                string typeLib = GetTypeLibraryPath(projectConfig);
                if (!outputFiles.ContainsKey(typeLib)) {
                    outputFiles.Add(typeLib, Path.GetFileName(typeLib));
                }
            }

            // add satellite assemblies
            Hashtable resourceSets = GetLocalizedResources();
            foreach (LocalizedResourceSet localizedResourceSet in resourceSets.Values) {
                FileInfo satelliteAssembly = localizedResourceSet.GetSatelliteAssemblyPath(
                    projectConfig, ProjectSettings);
                // skip files that do not exist, or are already in hashtable
                if (satelliteAssembly.Exists && !outputFiles.ContainsKey(satelliteAssembly.FullName)) {
                    string relativePath = localizedResourceSet.GetRelativePath(
                        ProjectSettings);
                    outputFiles.Add(satelliteAssembly.FullName, relativePath);
                }
            }
        }
开发者ID:nantos,项目名称:nant,代码行数:51,代码来源:ManagedProjectBase.cs

示例11: WriteNeutralResourceOptions

        private void WriteNeutralResourceOptions(StreamWriter sw, Configuration solutionConfiguration)
        {
            // no further processing required if there are no neutral resource
            // files
            if (_neutralResources.Count == 0) {
                return;
            }

            foreach (Resource resource in _neutralResources) {
                Log(Level.Verbose, " - {0}", resource.InputFile);

                if (resource.IsResX) {
                    // determine filename of compiled file
                    FileInfo compiledResxFile = resource.GetCompiledResourceFile(solutionConfiguration);
                    // determine manifest resource name
                    string manifestResourceName = resource.GetManifestResourceName(
                        solutionConfiguration);
                    // write option to response file
                    sw.WriteLine(string.Format(CultureInfo.InvariantCulture,
                        "/res:\"{0}\",\"{1}\"", compiledResxFile.FullName,
                        manifestResourceName));
                } else {
                    // compile resource
                    FileInfo compiledResourceFile = resource.Compile(
                        solutionConfiguration);
                    // write option to response file
                    sw.WriteLine(string.Format(CultureInfo.InvariantCulture,
                        "/res:\"{0}\",\"{1}\"", compiledResourceFile.FullName,
                        resource.GetManifestResourceName(solutionConfiguration)));
                }
            }
        }
开发者ID:nantos,项目名称:nant,代码行数:32,代码来源:ManagedProjectBase.cs

示例12: UnregisterForComInterop

        /// <summary>
        /// Unregister a type library for the specified assembly, and the types
        /// in that assembly.
        /// </summary>
        /// <param name="config">The project configuration that is built.</param>
        /// <param name="solutionConfiguration">The solution configuration that is built.</param>
        /// <remarks>
        /// The <c>regasm</c> tool is used to unregister the type library, and
        /// remove the COM registration for types in the specified assembly.
        /// </remarks>
        private void UnregisterForComInterop(ConfigurationSettings config, Configuration solutionConfiguration)
        {
            // if COM interop registration is not enabled or the previous project
            // output does not exist, then there's nothing to do
            if (!config.RegisterForComInterop || !File.Exists(config.OutputPath)) {
                return;
            }

            Log(Level.Verbose, "Unregistering project output for COM Interop...");

            // create and initialize regasm task
            RegAsmTask regasm = CreateRegAsmTask();
            // add assembly references
            foreach (ReferenceBase reference in References) {
                StringCollection assemblyReferences = reference.GetAssemblyReferences(
                    solutionConfiguration);
                foreach (string assemblyFile in assemblyReferences) {
                    regasm.References.Includes.Add(assemblyFile);
                }
            }
            // unregister types
            regasm.Unregister = true;
            // assembly to unregister
            regasm.AssemblyFile = new FileInfo(config.OutputPath);
            // determine path for type library
            string typeLibPath = GetTypeLibraryPath(config);
            // if the type library exists, unregister it
            if (File.Exists(typeLibPath)) {
                regasm.TypeLib = new FileInfo(typeLibPath);
            }

            // increment indentation level
            regasm.Project.Indent();
            try {
                regasm.Execute();
            } finally {
                // restore indentation level
                regasm.Project.Unindent();
            }
        }
开发者ID:nantos,项目名称:nant,代码行数:50,代码来源:ManagedProjectBase.cs

示例13: RegisterForComInterop

        /// <summary>
        /// Generates a type library for the specified assembly, registers it.
        /// </summary>
        /// <param name="config">The project configuration that is built.</param>
        /// <param name="solutionConfiguration">The solution configuration that is built.</param>
        /// <param name="typelibPath">The path of the type library to generate.</param>
        /// <remarks>
        /// The <c>regasm</c> tool is used to generate the type library.
        /// </remarks>
        private void RegisterForComInterop(ConfigurationSettings config, Configuration solutionConfiguration, string typelibPath)
        {
            Log(Level.Verbose, "Registering project output for COM Interop...");

            // create and initialize regasm task
            RegAsmTask regasm = CreateRegAsmTask();
            // add assembly references
            foreach (ReferenceBase reference in References) {
                StringCollection assemblyReferences = reference.GetAssemblyReferences(
                    solutionConfiguration);
                foreach (string assemblyFile in assemblyReferences) {
                    regasm.References.Includes.Add(assemblyFile);
                }
            }
            // assembly to register for COM interop
            regasm.AssemblyFile = new FileInfo(config.BuildPath);
            // type library to create
            regasm.TypeLib = new FileInfo(typelibPath);

            // increment indentation level
            regasm.Project.Indent();
            try {
                // execute task
                regasm.Execute();
            } finally {
                // restore indentation level
                regasm.Project.Unindent();
            }
        }
开发者ID:nantos,项目名称:nant,代码行数:38,代码来源:ManagedProjectBase.cs

示例14: CompileResXFiles

        private void CompileResXFiles(Configuration solutionConfiguration)
        {
            Log(Level.Verbose, "Compiling resources:");

            Hashtable resxResources = new Hashtable();

            // neutral resources
            foreach (Resource resource in _neutralResources) {
                if (!resource.IsResX) {
                    continue;
                }

                Log(Level.Verbose, " - {0}", resource.InputFile);

                // determine filename of output file
                FileInfo compiledResxFile = resource.GetCompiledResourceFile(solutionConfiguration);
                // add to list of resx files to compile
                resxResources.Add(resource, compiledResxFile);
            }

            // localized resources
            foreach (Resource resource in _localizedResources) {
                if (!resource.IsResX) {
                    continue;
                }

                Log(Level.Verbose, " - {0}", resource.InputFile);

                // determine filename of output file
                FileInfo compiledResxFile = resource.GetCompiledResourceFile(solutionConfiguration);
                // add to list of resx files to compile
                resxResources.Add(resource, compiledResxFile);
            }

            // no further processing required if there are no resx files to
            // compile
            if (resxResources.Count == 0) {
                return;
            }

            // create instance of ResGen task
            ResGenTask rt = new ResGenTask();

            // inherit project from solution task
            rt.Project = SolutionTask.Project;

            // inherit namespace manager from solution task
            rt.NamespaceManager = SolutionTask.NamespaceManager;

            // parent is solution task
            rt.Parent = SolutionTask;

            // inherit verbose setting from solution task
            rt.Verbose = SolutionTask.Verbose;

            // make sure framework specific information is set
            rt.InitializeTaskConfiguration();

            // set parent of child elements
            rt.Assemblies.Parent = rt;

            // inherit project from solution task from parent task
            rt.Assemblies.Project = rt.Project;

            // inherit namespace manager from parent task
            rt.Assemblies.NamespaceManager = rt.NamespaceManager;

            // set base directory for filesets
            rt.Assemblies.BaseDirectory = ProjectDirectory;

            // set resx files to compile
            foreach (DictionaryEntry entry in resxResources) {
                Resource resource = (Resource) entry.Key;
                FileInfo outputFile = (FileInfo) entry.Value;

                QualifiedResource qualifiedResource = new QualifiedResource(
                    resource.InputFile, outputFile);

                rt.QualifiedResources.Add(qualifiedResource);
            }

            // inherit assembly references from project
            foreach (ReferenceBase reference in References) {
                StringCollection assemblyReferences = reference.GetAssemblyReferences(
                    solutionConfiguration);
                foreach (string assemblyFile in assemblyReferences) {
                    rt.Assemblies.Includes.Add(assemblyFile);
                }
            }

            // increment indentation level
            rt.Project.Indent();
            try {
                // execute task
                rt.Execute();
            } finally {
                // restore indentation level
                rt.Project.Unindent();
            }
        }
开发者ID:nantos,项目名称:nant,代码行数:100,代码来源:ManagedProjectBase.cs

示例15: IsManaged

 /// <summary>
 /// Gets a value indicating whether the reference is managed for the
 /// specified configuration.
 /// </summary>
 /// <param name="config">The build configuration of the reference.</param>
 /// <returns>
 /// <see langword="true" /> if the reference is managed for the
 /// specified configuration; otherwise, <see langword="false" />.
 /// </returns>
 public override bool IsManaged(Configuration config)
 {
     return Project.IsManaged(config);
 }
开发者ID:julianhaslinger,项目名称:nant,代码行数:13,代码来源:VcProjectReference.cs


注:本文中的NAnt.VSNet.Configuration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。