當前位置: 首頁>>代碼示例>>C#>>正文


C# NuGetFramework.GetTwoDigitShortFolderName方法代碼示例

本文整理匯總了C#中NuGet.Frameworks.NuGetFramework.GetTwoDigitShortFolderName方法的典型用法代碼示例。如果您正苦於以下問題:C# NuGetFramework.GetTwoDigitShortFolderName方法的具體用法?C# NuGetFramework.GetTwoDigitShortFolderName怎麽用?C# NuGetFramework.GetTwoDigitShortFolderName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NuGet.Frameworks.NuGetFramework的用法示例。


在下文中一共展示了NuGetFramework.GetTwoDigitShortFolderName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MakeDefaultTargetFrameworkDefine

        private static string MakeDefaultTargetFrameworkDefine(NuGetFramework targetFramework)
        {
            var shortName = targetFramework.GetTwoDigitShortFolderName();

            if (targetFramework.IsPCL)
            {
                return null;
            }

            var candidateName = shortName.ToUpperInvariant();

            // Replace '-', '.', and '+' in the candidate name with '_' because TFMs with profiles use those (like "net40-client")
            // and we want them representable as defines (i.e. "NET40_CLIENT")
            candidateName = candidateName.Replace('-', '_').Replace('+', '_').Replace('.', '_');

            // We require the following from our Target Framework Define names
            // Starts with A-Z or _
            // Contains only A-Z, 0-9 and _
            if (!string.IsNullOrEmpty(candidateName) &&
                (char.IsLetter(candidateName[0]) || candidateName[0] == '_') &&
                candidateName.All(c => Char.IsLetterOrDigit(c) || c == '_'))
            {
                return candidateName;
            }

            return null;
        }
開發者ID:piotrpMSFT,項目名稱:cli-old,代碼行數:27,代碼來源:ProjectReader.cs

示例2: GetOutputPaths

        public static OutputPaths GetOutputPaths(
            Project project,
            NuGetFramework framework,
            string runtimeIdentifier,
            string configuration,
            string solutionRootPath,
            string buildBasePath,
            string outputPath)
        {
            string resolvedBuildBasePath;
            if (string.IsNullOrEmpty(buildBasePath))
            {
                resolvedBuildBasePath = project.ProjectDirectory;
            }
            else
            {
                if (string.IsNullOrEmpty(solutionRootPath))
                {
                    resolvedBuildBasePath = Path.Combine(buildBasePath, project.Name);
                }
                else
                {
                    resolvedBuildBasePath = project.ProjectDirectory.Replace(solutionRootPath, buildBasePath);
                }
            }

            var compilationOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(resolvedBuildBasePath,
                BinDirectoryName,
                configuration,
                framework.GetShortFolderName()));

            string runtimeOutputPath = null;
            if (string.IsNullOrEmpty(outputPath))
            {
                if (!string.IsNullOrEmpty(runtimeIdentifier))
                {
                    runtimeOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(compilationOutputPath, runtimeIdentifier));
                }
                else
                {
                    // "Runtime" assets (i.e. the deps file) will be dropped to the compilation output path, because
                    // we are building a RID-less target.
                    runtimeOutputPath = compilationOutputPath;
                }
            }
            else
            {
                runtimeOutputPath = PathUtility.EnsureTrailingSlash(Path.GetFullPath(outputPath));
            }

            var intermediateOutputPath = PathUtility.EnsureTrailingSlash(Path.Combine(
                resolvedBuildBasePath,
                ObjDirectoryName,
                configuration,
                framework.GetTwoDigitShortFolderName()));

            var compilationFiles = new CompilationOutputFiles(compilationOutputPath, project, configuration, framework);

            RuntimeOutputFiles runtimeFiles = null;
            if (runtimeOutputPath != null)
            {
                runtimeFiles = new RuntimeOutputFiles(runtimeOutputPath, project, configuration, framework);
            }
            return new OutputPaths(intermediateOutputPath, compilationOutputPath, runtimeOutputPath, compilationFiles, runtimeFiles);
        }
開發者ID:ericstj,項目名稱:cli,代碼行數:65,代碼來源:OutputPathsCalculator.cs


注:本文中的NuGet.Frameworks.NuGetFramework.GetTwoDigitShortFolderName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。