Premake4:如何使用单元测试项目创建 C# 解决方案

Premake4: how to create c# solution with unit test project

我是 Premake 新手。 我想创建一个包含 2 个项目的解决方案:

我知道 "kind" 值是:

-ConsoleApp

-WindowedApp

-共享库

-静态库

我没有看到单元测试的类型!有办法创建这个吗? 下面是我所做的...

solution "MySolution"
--framework ""
configurations { "Debug","Release" }
platforms { "x32","Universal" }
    project "MyProject1"
        targetname "MyProject1"
        location "MyProject1"
        kind "SharedLib"
        language "C#"
        files { "MyProject1/**.cs" } 
        excludes { "**/bin/**", "**/obj/**" } 
        links { "System","System.Core","Microsoft.CSharp","System.Runtime.Serialization","System.ComponentModel.DataAnnotations" }

        configuration "Debug"
            defines { "TRACE","DEBUG" }
            flags { "Symbols" }
            targetdir "../../../../../../../deploy/bin/"

        configuration "Release"
            defines { "TRACE" }
            flags { "Optimize" }
            targetdir "../../../../../../../deploy/bin/"

我找到的解决方案是无论如何都要创建一个 class 库项目,并在其中添加对通用单元测试项目的引用。然后 Visual Studio 允许您执行这些测试。您只是缺少单元测试项目图标。

希望这对其他人有帮助!