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


C# Project.GetFullPath方法代码示例

本文整理汇总了C#中Project.GetFullPath方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetFullPath方法的具体用法?C# Project.GetFullPath怎么用?C# Project.GetFullPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


在下文中一共展示了Project.GetFullPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetProjectTemplateRoot

        public static string GetProjectTemplateRoot(Project project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            return Path.Combine(project.GetFullPath(), "CodeTemplates");
        }
开发者ID:TomDu,项目名称:lab,代码行数:9,代码来源:TemplateSearchDirectories.cs

示例2: SaveProjectConfig

 private void SaveProjectConfig(Project project, XmlScaffoldingConfig config)
 {
     var projectConfigItem = project.GetProjectItem(ConfigXmlFilename);
     if (projectConfigItem != null) 
         SaveConfigToFile(projectConfigItem.GetFullPath(), config);
     else {
         var outputFilename = Path.Combine(project.GetFullPath(), ConfigXmlFilename);
         SaveConfigToFile(outputFilename, config);
         project.ProjectItems.AddFromFile(outputFilename);
     }
 }
开发者ID:processedbeets,项目名称:ASP.NET-MVC-Scaffolding,代码行数:11,代码来源:XmlScaffoldingConfigStore.cs

示例3: GetProjectManager

        public override IProjectManager GetProjectManager(Project project)
        {
            IProjectManager projectManager;
            if (_projectManagers.TryGetValue(project, out projectManager))
            {
                return projectManager;
            }

            var projectSystem = new MockVsProjectSystem(project);
            var localRepository = new PackageReferenceRepository(
                new MockFileSystem(project.GetFullPath()),
                project.Name,
                LocalRepository);
            projectManager = new ProjectManager(
                this,
                PathResolver, 
                projectSystem,
                localRepository);
            _projectManagers[project] = projectManager;
            return projectManager;
        }
开发者ID:rikoe,项目名称:nuget,代码行数:21,代码来源:MockVsPackageManager.cs

示例4: MockVsProjectSystem

 public MockVsProjectSystem(Project project) 
     : base(VersionUtility.DefaultTargetFramework, project.GetFullPath())
 {
     _project = project;
 }
开发者ID:rikoe,项目名称:nuget,代码行数:5,代码来源:MockVsPackageManager.cs

示例5: GetTemplateOutput

        private static TemplateRenderingResult GetTemplateOutput(Project project, IFileSystem fileSystem, string template, string projectRelativeOutputPath, Hashtable model, bool force)
        {
            var templateFullPath = FindTemplateAssertExists(project, fileSystem, template);
            var templateContent = fileSystem.ReadAllText(templateFullPath);
            templateContent = PreprocessTemplateContent(templateContent);

            // Create the T4 host and engine
            using (var host = new DynamicTextTemplatingEngineHost { TemplateFile = templateFullPath }) {
                var t4Engine = GetT4Engine();

                // Make it possible to reference the same assemblies that your project references
                // using <@ Assembly @> directives.
                host.AddFindableAssembly(FindProjectAssemblyIfExists(project));
                foreach (dynamic reference in ((dynamic)project.Object).References) {
                    if ((!string.IsNullOrEmpty(reference.Path)) && (!reference.AutoReferenced))
                        host.AddFindableAssembly(reference.Path);
                }

                string projectRelativeOutputPathWithExtension = null;
                ProjectItem existingOutputProjectItem = null;
                if (!string.IsNullOrEmpty(projectRelativeOutputPath)) {
                    // Respect the <#@ Output Extension="..." #> directive
                    projectRelativeOutputPathWithExtension = projectRelativeOutputPath + GetOutputExtension(host, t4Engine, templateContent);

                    // Resolve the output path and ensure it doesn't already exist (unless "Force" is set)
                    var outputDiskPath = Path.Combine(project.GetFullPath(), projectRelativeOutputPathWithExtension);
                    existingOutputProjectItem = project.GetProjectItem(projectRelativeOutputPathWithExtension);
                    if (existingOutputProjectItem != null)
                        outputDiskPath = existingOutputProjectItem.GetFullPath();
                    if ((!force) && fileSystem.FileExists(outputDiskPath)) {
                        return new TemplateRenderingResult(projectRelativeOutputPathWithExtension) { SkipBecauseFileExists = true };
                    }
                }

                // Convert the incoming Hashtable to a dynamic object with properties for each of the Hashtable entries
                host.Model = DynamicViewModel.FromObject(model);

                // Run the text transformation
                var templateOutput = t4Engine.ProcessTemplate(templateContent, host);
                return new TemplateRenderingResult(projectRelativeOutputPathWithExtension) {
                    Content = templateOutput,
                    Errors = host.Errors,
                    ExistingProjectItemToOverwrite = existingOutputProjectItem,
                };
            }
        }
开发者ID:tikrimi,项目名称:MvcScaffolding4TwitterBootstrapMvc,代码行数:46,代码来源:InvokeScaffoldTemplateCmdlet.cs

示例6: FindProjectAssemblyIfExists

 private static string FindProjectAssemblyIfExists(Project project)
 {
     if ((project.ConfigurationManager != null)
         && (project.ConfigurationManager.ActiveConfiguration != null)
         && (project.ConfigurationManager.ActiveConfiguration.Properties != null)
         && (project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath") != null)
         && (!string.IsNullOrEmpty((string)project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value))
         && (project.Properties.Item("OutputFileName") != null)
         && (!string.IsNullOrEmpty((string)project.Properties.Item("OutputFileName").Value))
         ) {
         var outputDir = Path.Combine(project.GetFullPath(), (string)project.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value);
         var assemblyLocation = Path.Combine(outputDir, (string)project.Properties.Item("OutputFileName").Value);
         if (File.Exists(assemblyLocation))
             return assemblyLocation;
     }
     return null;
 }
开发者ID:tikrimi,项目名称:MvcScaffolding4TwitterBootstrapMvc,代码行数:17,代码来源:InvokeScaffoldTemplateCmdlet.cs

示例7: AddTextFileToProject

 private static void AddTextFileToProject(Project project, IFileSystem fileSystem, string projectRelativePath, string text)
 {
     // Need to be sure the folder exists first
     var outputDirPath = Path.GetDirectoryName(projectRelativePath);
     var projectDir = project.GetOrCreateProjectItems(outputDirPath, true /* create */, fileSystem);
     var diskPath = Path.Combine(project.GetFullPath(), projectRelativePath);
     fileSystem.WriteAllText(diskPath, text);
     projectDir.AddFromFile(diskPath);
 }
开发者ID:tikrimi,项目名称:MvcScaffolding4TwitterBootstrapMvc,代码行数:9,代码来源:InvokeScaffoldTemplateCmdlet.cs

示例8: TranslatePath

        /// <summary>
        /// Splits a PATH (with ; or : as separators) into its parts, while 
        /// resolving references to environment variables.
        /// </summary>
        /// <param name="project">The <see cref="Project" /> to be used to resolve relative paths.</param>
        /// <param name="source">The path to translate.</param>
        /// <returns>
        /// A PATH split up its parts, with references to environment variables
        /// resolved and duplicate entries removed.
        /// </returns>
        public static StringCollection TranslatePath(Project project, string source)
        {
            StringCollection result = new StringCollection();

            if (source == null) {
                return result;
            }

            string[] parts = source.Split(':',';');
            for (int i = 0; i < parts.Length; i++) {
                string part = parts[i];

                // on a DOS filesystem, the ':' character might be part of a
                // drive spec and in that case we need to combine the current
                // and the next part
                if (part.Length == 1 && Char.IsLetter(part[0]) && _dosBasedFileSystem && (parts.Length > i + 1)) {
                    string nextPart = parts[i + 1].Trim();
                    if (nextPart.StartsWith("\\") || nextPart.StartsWith("/")) {
                        part += ":" + nextPart;
                        // skip the next part as we've also processed it
                        i++;
                    }
                }

                // expand env variables in part
                string expandedPart = Environment.ExpandEnvironmentVariables(part);

                // check if part is a reference to an environment variable
                // that could not be expanded (does not exist)
                if (expandedPart.StartsWith("%") && expandedPart.EndsWith("%")) {
                    continue;
                }

                // resolve each part in the expanded environment variable to a
                // full path
                foreach (string path in expandedPart.Split(Path.PathSeparator)) {
                    try {
                        string absolutePath = project.GetFullPath(path);
                        if (!result.Contains(absolutePath)) {
                            result.Add(absolutePath);
                        }
                    } catch (Exception ex) {
                        project.Log(Level.Verbose, "Dropping path element '{0}'"
                            + " as it could not be resolved to a full path. {1}",
                            path, ex.Message);
                    }
                }
            }

            return result;
        }
开发者ID:vardars,项目名称:ci-factory,代码行数:61,代码来源:PathSet.cs

示例9: ReadFromXml

        /// <summary>
        /// Populates the project from the xml definition file
        /// </summary>
        /// <param name="project"></param>
        /// <param name="FilePath">The file to read the project definition from.</param>
        public static void ReadFromXml(Project project, string FilePath)
        {
            project.ClearUserOptions();
            project.Functions.Clear();
            XPathDocument doc = null;
            string ext = Path.GetExtension(FilePath);

            if (ext == ".st")
            {
                doc = new XPathDocument(FilePath);
            }
            else if (ext == ".stz")
            {
                // Delete all files in the temp folder
                if (Directory.Exists(Controller.TempPath))
                {
                    Directory.Delete(Controller.TempPath, true);
                }
                Directory.CreateDirectory(Controller.TempPath);
                Utility.UnzipFile(FilePath, Controller.TempPath);

                string[] includedFiles = Directory.GetFiles(Controller.TempPath, "*");
                project.ClearIncludedFiles();

                foreach (string file in includedFiles)
                {
                    if (!Utility.StringsAreEqual(Path.GetFileName(file), "definition.xml", false))
                    {
                        project.AddIncludedFile(new IncludedFile(Path.GetFileName(file)));
                    }
                }
                string xmlPath = Path.Combine(Controller.TempPath, "definition.xml");

                // Backward compatability mpr
                StreamReader reader = new StreamReader(xmlPath);
                string definitionXml = reader.ReadToEnd();
                reader.Close();

                StreamWriter writer = File.CreateText(xmlPath);
                //writer.Write(Convert.Script.Replace(definitionXml));
                writer.Write(definitionXml);
                writer.Close();
                // mpr

                doc = new XPathDocument(xmlPath);
            }
            XPathNavigator rootNavigator = doc.CreateNavigator();
            XPathNavigator navigator = rootNavigator.SelectSingleNode(@"ROOT/config/project");
            XPathNavigator fileVersionNavigator = rootNavigator.SelectSingleNode(@"ROOT/@fileversion");
            int fileVersion = fileVersionNavigator != null ? fileVersionNavigator.ValueAsInt : 0;
            List<string> missingTypesMessages = new List<string>();

            #region Project details

            project.ProjectName = navigator.SelectSingleNode("name").Value;
            project.ProjectDescription = navigator.SelectSingleNode("description").Value;
            ReadXmlReferencedFiles(project, FilePath, rootNavigator);
            string compileFolderRelPath = navigator.SelectSingleNode("compilefile") == null ? "" : navigator.SelectSingleNode("compilefile").Value;
            compileFolderRelPath = project.GetFullPath(compileFolderRelPath);
            project.DebugProjectFile = navigator.SelectSingleNode("debugfile") == null ? "" : navigator.SelectSingleNode("debugfile").Value;
            project.TestGenerateDirectory = navigator.SelectSingleNode("testgeneratedirectory") == null ? "" : navigator.SelectSingleNode("testgeneratedirectory").Value;

            if (Directory.Exists(compileFolderRelPath))
            {
                compileFolderRelPath = Path.GetDirectoryName(compileFolderRelPath);
            }
            else
            {
                compileFolderRelPath = Path.GetDirectoryName(project.ProjectFileName);
            }
            project.CompileFolderName = compileFolderRelPath;
            //CompileFolderName = GetFullPath(CompileFolderName);
            project.Version = navigator.SelectSingleNode("version") == null ? "0.0.0" : navigator.SelectSingleNode("version").Value;

            project.Namespaces.Clear();
            project.Namespaces.AddRange(rootNavigator.SelectSingleNode(@"ROOT/namespaces").Value.Split(','))
                ;
            #endregion

            //#region Default Value Functions
            //m_defaultValueFunctions = new List<DefaultValueFunction>();

            //foreach (XPathNavigator subNode in navigator.Select("defaultvaluefunctions/defaultvaluefunction"))
            //{
            //    ReadXmlDefaultValueFunctionNode(missingTypesMessages, subNode);
            //}
            //#endregion

            #region Functions
            foreach (XPathNavigator funcNode in rootNavigator.Select("/ROOT/function"))
            {
                ReadXmlFunctionNode(project, missingTypesMessages, funcNode);
            }
            project.SortFunctions();
            #endregion
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:101,代码来源:ProjectLoadAndSaveHelper.cs

示例10: GetFullPathOfReferencedFile

        /// <summary>
        /// Gets the full path of a referenced file, by looking in all the obvious places. Returns 
        /// just the filename if the full path can't be determined.
        /// </summary>
        /// <param name="relativePath"></param>
        /// <returns></returns>
        private static string GetFullPathOfReferencedFile(Project project, string relativePath)
        {
            string refFilePath = project.GetFullPath(relativePath);

            if (!File.Exists(refFilePath))
            {
                string refFileName = Path.GetFileName(refFilePath);

                // Can we find the file in the same folder as the current project file (.stz)?
                string pathToCheck = Path.Combine(Path.GetDirectoryName(project.ProjectFileName), refFileName);

                if (File.Exists(pathToCheck))
                {
                    refFilePath = pathToCheck;
                }
                else
                {
                    // Can we find it in the application path?
                    pathToCheck = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), refFileName);

                    if (File.Exists(pathToCheck))
                    {
                        refFilePath = pathToCheck;
                    }
                    else
                    {
                        // We still can't find it anywhere, so let's rather make the path blank, rather
                        // than a weird non-existant one from the development environment!
                        refFilePath = refFileName;
                    }
                }
            }
            return refFilePath;
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:40,代码来源:ProjectLoadAndSaveHelper.cs


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