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


C# FrameworkName.ToString方法代码示例

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


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

示例1: GetMissingDependenciesWarning

        public string GetMissingDependenciesWarning(FrameworkName targetFramework)
        {
            var sb = new StringBuilder();

            // TODO: Localize messages

            sb.AppendFormat("Failed to resolve the following dependencies for target framework '{0}':", targetFramework.ToString());
            sb.AppendLine();

            foreach (var d in Libraries.Where(d => !d.Resolved).OrderBy(d => d.Identity.Name))
            {
                sb.AppendLine("   " + d.Identity.ToString());
            }

            sb.AppendLine();
            sb.AppendLine("Searched Locations:");

            foreach (var path in GetAttemptedPaths(targetFramework))
            {
                sb.AppendLine("  " + path);
            }

            sb.AppendLine();
            sb.AppendLine("Try running 'dnu restore'.");

            return sb.ToString();
        }
开发者ID:elanwu123,项目名称:dnx,代码行数:27,代码来源:DependencyWalker.cs

示例2: TargetFramework_TargetFrameworkVersionIsSilverlight20DefinedInProject_ReturnsSilverlight

		public void TargetFramework_TargetFrameworkVersionIsSilverlight20DefinedInProject_ReturnsSilverlight ()
		{
			CreateTestProject ();
			project.TargetFrameworkMoniker = new TargetFrameworkMoniker ("Silverlight", "v2.0");
			CreateProjectSystem (project);

			FrameworkName expectedName = new FrameworkName ("Silverlight, Version=v2.0");

			Assert.AreEqual (expectedName.ToString (), projectSystem.TargetFramework.ToString ());
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:10,代码来源:MonoDevelopProjectSystemTests.cs

示例3: VerifyConstructor

 private static void VerifyConstructor(FrameworkName name, string expectedName, string expectedIdentifier, Version expectedVersion, string expectedProfile)
 {
     Assert.Equal(expectedName, name.FullName);
     Assert.Equal(expectedName, name.ToString());
     Assert.Equal(expectedIdentifier, name.Identifier);
     Assert.Equal(expectedProfile, name.Profile);
     Assert.Equal(expectedVersion, name.Version);
 }
开发者ID:johnhhm,项目名称:corefx,代码行数:8,代码来源:FrameworkName.cs

示例4: TargetFramework_TargetFrameworkVersion40DefinedInProject_ReturnsFullDotNetFramework40

		public void TargetFramework_TargetFrameworkVersion40DefinedInProject_ReturnsFullDotNetFramework40 ()
		{
			CreateTestProject ();
			project.TargetFrameworkMoniker = new TargetFrameworkMoniker ("v4.0");
			CreateProjectSystem (project);

			FrameworkName expectedName = new FrameworkName (".NETFramework, Version=v4.0");

			Assert.AreEqual (expectedName.ToString (), projectSystem.TargetFramework.ToString ());
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:10,代码来源:MonoDevelopProjectSystemTests.cs

示例5: CreateTestProject

		public void TargetFramework_TargetFrameworkVersion35ClientProfileDefinedInProject_ReturnsClientProfileDotNetFramework35 ()
		{
			CreateTestProject ();
			project.TargetFrameworkMoniker = new TargetFrameworkMoniker (".NETFramework", "v3.5", "Client");
			CreateProjectSystem (project);

			FrameworkName expectedName = new FrameworkName (".NETFramework, Profile=Client, Version=v3.5");

			Assert.AreEqual (expectedName.ToString (), projectSystem.TargetFramework.ToString ());
		}
开发者ID:kdubau,项目名称:monodevelop,代码行数:10,代码来源:MonoDevelopProjectSystemTests.cs

示例6: GenerateReferenceAssemblyPath

        /// <summary>
        /// Take the parts of the Target framework moniker and formulate the reference assembly path based on the the following pattern:
        /// For a framework and version:
        ///     $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)
        /// For a subtype:
        ///     $(TargetFrameworkRootPath)\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\SubType\$(TargetFrameworkSubType)
        /// e.g.NET Framework v4.0 would locate its reference assemblies in:
        ///     \Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
        /// e.g.Silverlight v2.0 would locate its reference assemblies in:
        ///     \Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v2.0
        /// e.g.NET Compact Framework v3.5, subtype PocketPC would locate its reference assemblies in:
        ///     \Program Files\Reference Assemblies\Microsoft\Framework\.NETCompactFramework\v3.5\SubType\PocketPC
        /// </summary>
        /// <returns>The path to the reference assembly location</returns>
        internal static string GenerateReferenceAssemblyPath(string targetFrameworkRootPath, FrameworkName frameworkName)
        {
            ErrorUtilities.VerifyThrowArgumentNull(targetFrameworkRootPath, "targetFrameworkRootPath");
            ErrorUtilities.VerifyThrowArgumentNull(frameworkName, "frameworkName");

            try
            {
                string path = targetFrameworkRootPath;
                path = Path.Combine(path, frameworkName.Identifier);
                path = Path.Combine(path, "v" + frameworkName.Version.ToString());
                if (!String.IsNullOrEmpty(frameworkName.Profile))
                {
                    path = Path.Combine(path, "Profile");
                    path = Path.Combine(path, frameworkName.Profile);
                }

                path = Path.GetFullPath(path);
                return path;
            }
            catch (Exception e) when (ExceptionHandling.IsIoRelatedException(e))
            {
                ErrorUtilities.ThrowInvalidOperation("FrameworkLocationHelper.CouldNotGenerateReferenceAssemblyDirectory", targetFrameworkRootPath, frameworkName.ToString(), e.Message);
                // The compiler does not see the massage above an as exception;
                return null;
            }
        }
开发者ID:joperezr,项目名称:msbuild,代码行数:40,代码来源:FrameworkLocationHelper.cs

示例7: GetFriendlyFrameworkName

        public string GetFriendlyFrameworkName(FrameworkName targetFramework)
        {
            // We don't have a friendly name for this anywhere on the machine so hard code it
            if (string.Equals(targetFramework.Identifier, "K", StringComparison.OrdinalIgnoreCase))
            {
                return ".NET Core Framework 4.5";
            }
            else if (string.Equals(targetFramework.Identifier, VersionUtility.AspNetCoreFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
            {
                return "ASP.NET Core 5.0";
            }
            else if (string.Equals(targetFramework.Identifier, VersionUtility.AspNetFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
            {
                return "ASP.NET 5.0";
            }
            else if (string.Equals(targetFramework.Identifier, VersionUtility.DnxCoreFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
            {
                return "DNX Core 5.0";
            }
            else if (string.Equals(targetFramework.Identifier, VersionUtility.DnxFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
            {
                return "DNX " + targetFramework.Version.ToString();
            }
            else if (string.Equals(targetFramework.Identifier, VersionUtility.NetPlatformFrameworkIdentifier, StringComparison.OrdinalIgnoreCase))
            {
                return ".NET Platform";
            }

            var information = _cache.GetOrAdd(targetFramework, GetFrameworkInformation);

            if (information == null)
            {
                return targetFramework.ToString();
            }

            return information.Name;
        }
开发者ID:henghu-bai,项目名称:dnx,代码行数:37,代码来源:FrameworkReferenceResolver.cs

示例8: UpdateFrameworkNames

        private static IEnumerable<KeyValuePair<string, string>> UpdateFrameworkNames(IEnumerable<KeyValuePair<string, string>> properties)
        {
            foreach (var prop in properties)
            {
                if (StringComparer.Ordinal.Equals("targetframework", prop.Key))
                {
                    NuGetFramework nuFramework = NuGetFramework.Parse(prop.Value);

                    FrameworkName frameworkName = new FrameworkName(nuFramework.FullFrameworkName);

                    KeyValuePair<string, string> fixedProp = new KeyValuePair<string,string>(prop.Key, frameworkName.ToString());

                    yield return fixedProp;
                }
                else
                {
                    yield return prop;
                }
            }

            yield break;
        }
开发者ID:pabomex,项目名称:NuGet.PackageManagement,代码行数:22,代码来源:NuGetBuildApi.cs

示例9: SynthesizeFrameworkFriendlyName

 private static string SynthesizeFrameworkFriendlyName(FrameworkName targetFramework)
 {
     // Names are not present in the RedistList.xml file for older frameworks or on Mono
     // We do some custom version string rendering to match how net40 is rendered (.NET Framework 4)
     if (targetFramework.Identifier.Equals(VersionUtility.NetFrameworkIdentifier))
     {
         string versionString = targetFramework.Version.Minor == 0 ?
             targetFramework.Version.Major.ToString() :
             targetFramework.Version.ToString();
         return ".NET Framework " + versionString;
     }
     return targetFramework.ToString();
 }
开发者ID:cemoses,项目名称:aspnet,代码行数:13,代码来源:FrameworkReferenceResolver.cs

示例10: GetMissingDependenciesWarning

        public string GetMissingDependenciesWarning(FrameworkName targetFramework)
        {
            var sb = new StringBuilder();

            // TODO: Localize messages

            sb.AppendFormat("Failed to resolve the following dependencies for target framework '{0}':", targetFramework.ToString());
            sb.AppendLine();

            foreach (var d in GetLibraryDescriptions().Where(d => !d.Resolved).OrderBy(d => d.Identity.Name))
            {
                sb.Append("   " + d.Identity);
                if (!d.Compatible)
                {
                    sb.Append(" (incompatible)");
                }
                sb.AppendLine();
            }

            return sb.ToString();
        }
开发者ID:cemoses,项目名称:aspnet,代码行数:21,代码来源:LibraryManager.cs

示例11: GetPaths

 private IList<string> GetPaths(string rootPath, FrameworkName frameworkmoniker)
 {
     IList<string> pathToReferenceAssemblies = null;
     if (string.IsNullOrEmpty(rootPath))
     {
         pathToReferenceAssemblies = ToolLocationHelper.GetPathToReferenceAssemblies(frameworkmoniker);
     }
     else
     {
         pathToReferenceAssemblies = ToolLocationHelper.GetPathToReferenceAssemblies(rootPath, frameworkmoniker);
     }
     if (pathToReferenceAssemblies.Count == 0)
     {
         base.Log.LogWarningWithCodeFromResources("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", new object[] { frameworkmoniker.ToString() });
     }
     return pathToReferenceAssemblies;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:GetReferenceAssemblyPaths.cs

示例12: PrintDependencyGraph

        private void PrintDependencyGraph(GraphNode root, FrameworkName frameworkName)
        {
            // Box Drawing Unicode characters:
            // http://www.unicode.org/charts/PDF/U2500.pdf
            const char LIGHT_HORIZONTAL = '\u2500';
            const char LIGHT_UP_AND_RIGHT = '\u2514';
            const char LIGHT_VERTICAL_AND_RIGHT = '\u251C';

            var frameworkSuffix = string.Format(" [{0}]", frameworkName.ToString());
            Reports.Verbose.WriteLine(root.Item.Match.Library.ToString() + frameworkSuffix);

            Func<GraphNode, bool> isValidDependency = d => 
                (d != null && d.Library != null && d.Item != null && d.Item.Match != null);
            var dependencies = root.Dependencies.Where(isValidDependency).ToList();
            var dependencyNum = dependencies.Count;
            for (int i = 0; i < dependencyNum; i++)
            {
                var branchChar = LIGHT_VERTICAL_AND_RIGHT;
                if (i == dependencyNum - 1)
                {
                    branchChar = LIGHT_UP_AND_RIGHT;
                }

                var name = dependencies[i].Item.Match.Library.ToString();
                var dependencyListStr = string.Join(", ", dependencies[i].Dependencies
                    .Where(isValidDependency)
                    .Select(d => d.Item.Match.Library.ToString()));
                var format = string.IsNullOrEmpty(dependencyListStr) ? "{0}{1} {2}{3}" : "{0}{1} {2} ({3})";
                Reports.Verbose.WriteLine(string.Format(format,
                    branchChar, LIGHT_HORIZONTAL, name, dependencyListStr));
            }
            Reports.Verbose.WriteLine();
        }
开发者ID:jack4it,项目名称:KRuntime,代码行数:33,代码来源:RestoreCommand.cs


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