Visual Studio 2012 为测试项目显示错误的图标 [英] Visual Studio 2012 Displays Wrong Icon For Test Project
问题描述
我有一个示例解决方案,其中一个测试项目有不同的测试"图标,但其他两个没有.
I have a sample solution that has a different "test" icon on one of the test projects, but not on the other two.
我以为这个项目的项目类型guid可能不同,但在解决方案文件中它们都具有相同的项目类型(C#)
I thought that maybe the project type guid was different on this project, but in the solution file they all have the same project type (C#)
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DomainModel.Tests", "DomainModel.Tests\DomainModel.Tests.csproj", "{61A4733D-4C5B-4705-98CB-8048751BBEFA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extensions.Tests", "Extensions.Tests\Extensions.Tests.csproj", "{1D6AA1C5-1FEC-44E4-9258-ACF84A20353C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Repository.Tests", "Repository.Tests\Repository.Tests.csproj", "{248434B7-3690-4705-85F0-66B765AEB431}"
EndProject
并且在每个项目文件中,它们都有相同的项目类型(Test 和 C#)
And in each project file they have idential project types (Test and C#)
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
为什么 DomainModel.Tests 有正确的测试图标,而 Extensions.Tests 和 Repository.Tests 有一个普通的 C# 库图标?
Why does DomainModel.Tests have the correct test icon, but Extensions.Tests and Repository.Tests have a plain C# library icon?
推荐答案
当从类库项目开始然后从那里添加测试类时,这也可能发生在 VS2013 中.
This can also happen in VS2013 when starting with a class library project and then adding test classes from there.
将以下子节点添加到项目文件中的主 PropertyGroup 节点可修复这种情况下的图标:
Adding the following child node to the main PropertyGroup node in the project file fixes the icon in this case:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
这篇关于Visual Studio 2012 为测试项目显示错误的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!