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


C# System.Runtime.Versioning.FrameworkName.ToString方法代码示例

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


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

示例1: TestGeneralFrameworkMonikerGoodWithInvalidIncludePath

        public void TestGeneralFrameworkMonikerGoodWithInvalidIncludePath()
        {
            string tempDirectory = Path.Combine(Path.GetTempPath(), "TestGeneralFrameworkMonikerGoodWithInvalidIncludePath");
            string framework41Directory = Path.Combine(tempDirectory, "MyFramework\\v4.1\\");
            string redistListDirectory = Path.Combine(framework41Directory, "RedistList");
            string redistListFile = Path.Combine(redistListDirectory, "FrameworkList.xml");
            try
            {
                Directory.CreateDirectory(framework41Directory);
                Directory.CreateDirectory(redistListDirectory);

                string redistListContents =
                        "<FileList Redist='Microsoft-Windows-CLRCoreComp' IncludeFramework='..\\Mooses' Name='Chained oh noes'>" +
                            "<File AssemblyName='System.Xml' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                             "<File AssemblyName='Microsoft.Build.Engine' Version='2.0.0.0' PublicKeyToken='b03f5f7f11d50a3a' Culture='Neutral' FileVersion='2.0.50727.208' InGAC='true' />" +
                        "</FileList >";

                File.WriteAllText(redistListFile, redistListContents);

                string targetFrameworkMoniker = "MyFramework, Version=v4.1";
                MockEngine engine = new MockEngine();
                GetReferenceAssemblyPaths getReferencePaths = new GetReferenceAssemblyPaths();
                getReferencePaths.BuildEngine = engine;
                getReferencePaths.TargetFrameworkMoniker = targetFrameworkMoniker;
                getReferencePaths.RootPath = tempDirectory;
                getReferencePaths.Execute();
                string[] returnedPaths = getReferencePaths.ReferenceAssemblyPaths;
                Assert.Equal(0, returnedPaths.Length);
                string displayName = getReferencePaths.TargetFrameworkMonikerDisplayName;
                Assert.Null(displayName);
                FrameworkNameVersioning frameworkMoniker = new FrameworkNameVersioning(getReferencePaths.TargetFrameworkMoniker);
                string message = ResourceUtilities.FormatResourceString("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkMoniker.ToString());
                engine.AssertLogContains(message);
            }
            finally
            {
                if (Directory.Exists(framework41Directory))
                {
                    Directory.Delete(framework41Directory, true);
                }
            }
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:42,代码来源:GetReferencePaths_Tests.cs

示例2: TestGeneralFrameworkMonikerNonExistent

 public void TestGeneralFrameworkMonikerNonExistent()
 {
     MockEngine engine = new MockEngine();
     GetReferenceAssemblyPaths getReferencePaths = new GetReferenceAssemblyPaths();
     getReferencePaths.BuildEngine = engine;
     // Make a framework which does not exist, intentional mispelling of framework
     getReferencePaths.TargetFrameworkMoniker = ".NetFramewok, Version=v99.0";
     getReferencePaths.Execute();
     string[] returnedPaths = getReferencePaths.ReferenceAssemblyPaths;
     Assert.Equal(0, returnedPaths.Length);
     string displayName = getReferencePaths.TargetFrameworkMonikerDisplayName;
     Assert.Null(displayName);
     FrameworkNameVersioning frameworkMoniker = new FrameworkNameVersioning(getReferencePaths.TargetFrameworkMoniker);
     string message = ResourceUtilities.FormatResourceString("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkMoniker.ToString());
     engine.AssertLogContains(message);
 }
开发者ID:cameron314,项目名称:msbuild,代码行数:16,代码来源:GetReferencePaths_Tests.cs

示例3: TestGeneralFrameworkMonikerNonExistentOverrideError

 public void TestGeneralFrameworkMonikerNonExistentOverrideError()
 {
     MockEngine engine = new MockEngine();
     GetReferenceAssemblyPaths getReferencePaths = new GetReferenceAssemblyPaths();
     getReferencePaths.BuildEngine = engine;
     // Make a framework which does not exist, intentional misspelling of framework
     getReferencePaths.TargetFrameworkMoniker = ".NetFramewok, Version=v99.0";
     
     try
     {
         Environment.SetEnvironmentVariable("MSBUILDWARNONNOREFERENCEASSEMBLYDIRECTORY", "1");
         bool success = getReferencePaths.Execute();
         Assert.True(success);
     }
     finally
     {
         Environment.SetEnvironmentVariable("MSBUILDWARNONNOREFERENCEASSEMBLYDIRECTORY", null);
     }
     
     string[] returnedPaths = getReferencePaths.ReferenceAssemblyPaths;
     Assert.Equal(0, returnedPaths.Length);
     string displayName = getReferencePaths.TargetFrameworkMonikerDisplayName;
     Assert.Null(displayName);
     FrameworkNameVersioning frameworkMoniker = new FrameworkNameVersioning(getReferencePaths.TargetFrameworkMoniker);
     string message = ResourceUtilities.FormatResourceString("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkMoniker.ToString());
     engine.AssertLogContains("WARNING MSB3644: " + message);
 }
开发者ID:nikson,项目名称:msbuild,代码行数:27,代码来源:GetReferencePaths_Tests.cs

示例4: GetPaths

        /// <summary>
        /// Generate the set of chained reference assembly paths
        /// </summary>
        private IList<String> GetPaths(string rootPath, FrameworkNameVersioning frameworkmoniker)
        {
            IList<String> pathsToReturn = null;

            if (String.IsNullOrEmpty(rootPath))
            {
                pathsToReturn = ToolLocationHelper.GetPathToReferenceAssemblies(frameworkmoniker);
            }
            else
            {
                pathsToReturn = ToolLocationHelper.GetPathToReferenceAssemblies(rootPath, frameworkmoniker);
            }

            // No reference assembly paths could be found, log a warning as there could be future errors which may be confusing because of this.
            if (pathsToReturn.Count == 0)
            {
                Log.LogWarningWithCodeFromResources("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkmoniker.ToString());
            }

            return pathsToReturn;
        }
开发者ID:cameron314,项目名称:msbuild,代码行数:24,代码来源:GetReferenceAssemblyPaths.cs

示例5: GetPaths

        /// <summary>
        /// Generate the set of chained reference assembly paths
        /// </summary>
        private IList<String> GetPaths(string rootPath, FrameworkNameVersioning frameworkmoniker)
        {
            IList<String> pathsToReturn = null;

            if (String.IsNullOrEmpty(rootPath))
            {
                pathsToReturn = ToolLocationHelper.GetPathToReferenceAssemblies(frameworkmoniker);
            }
            else
            {
                pathsToReturn = ToolLocationHelper.GetPathToReferenceAssemblies(rootPath, frameworkmoniker);
            }

            // No reference assembly paths could be found, log an error so an invalid build will not be produced.
            // 1/26/16: Note this was changed from a warning to an error (see GitHub #173). Also added the escape hatch 
            // (set MSBUILDWARNONNOREFERENCEASSEMBLYDIRECTORY = 1) in case this causes issues.
            // TODO: This should be removed for Dev15
            if (pathsToReturn.Count == 0)
            {
                var warn = Environment.GetEnvironmentVariable(WARNONNOREFERENCEASSEMBLYDIRECTORY);

                if (string.Equals(warn, "1", StringComparison.Ordinal))
                {
                    Log.LogWarningWithCodeFromResources("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkmoniker.ToString());
                }
                else
                {
                    Log.LogErrorWithCodeFromResources("GetReferenceAssemblyPaths.NoReferenceAssemblyDirectoryFound", frameworkmoniker.ToString());
                }
            }

            return pathsToReturn;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:36,代码来源:GetReferenceAssemblyPaths.cs


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