小编Luk*_*Fan的帖子

指定旧版测试设置时,在Visual Studio 2017中未发现并执行单元测试

我正在使用Visual Studio 2017 Professional 15.4.5,我发现.testsettings通过在Test > Test Settings > Select Test Settings菜单中选择遗留加载旧版时将不会发现单元测试

以下是重现它的步骤:

  1. 创建新的解决方案
  2. 使用以下简单类创建Class Library具有目标框架的项目.NET Framework 4.5.2:

    public class Class1
    {
        public bool True => true;
    }
    
    Run Code Online (Sandbox Code Playgroud)
  3. 创建一个Unit Test Project(.Net Framework)带有目标框架.NET Framework 4.5.2和设置项目参考并编写一个简单的测试:

    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.IsTrue(new Class1().True);
        }
    }
    
    Run Code Online (Sandbox Code Playgroud)
  4. 运行测试,应该发现并运行测试

  5. 使用解决方案上下文菜单进行选择Add > New Item,Test Settings在左侧窗格中选择Test Settings并在中间选择以创建新的测试设置.
  6. 只需关闭对话框即可跳过设置.单击菜单设置测试设置Test > Test Settings > Select …

unit-testing visual-studio-2017

10
推荐指数
0
解决办法
2188
查看次数

ASP.NET WebForm App_Theme导致编译错误

我有一个引用这样的主题的WebForm:

<%@ Page Title="Test" Language="C#" MasterPageFile="~/Test.master" AutoEventWireup="true"
CodeFile="Test.aspx.cs" Inherits="Test"  Theme="TestTheme"%>
Run Code Online (Sandbox Code Playgroud)

并且TestTheme只包含一个Test.skin文件,其中包含以下内容:

<asp:Button runat="server" CssClass="button" />
Run Code Online (Sandbox Code Playgroud)

如果我执行页面,我总是得到一个编译错误消息,如下所示:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
Compiler Error Message: The compiler failed with error code -1073741701.
Run Code Online (Sandbox Code Playgroud)

仔细查看生成的html后,我发现了这条隐藏的消息:

<!-- 
[HttpCompileException]: External component has thrown an exception.
   at System.Web.Compilation.AssemblyBuilder.Compile()
   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(String themeName)
   at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(HttpContext context, String themeName)
   at System.Web.UI.Page.InitializeThemes()
   at …
Run Code Online (Sandbox Code Playgroud)

asp.net webforms

3
推荐指数
1
解决办法
750
查看次数