admin管理员组文章数量:1356815
I maintain a legacy application recently upgraded to .NET Framework 4.8, with 3 MSTest classes in it. From within VS 2022 I can build and test the application fine. I've got a GitHub Action, which runs in a self-hosted runner on one of our servers. It gives me several errors all of this sort:
D:\actions-runner_work\Legacy_App\Legacy_App\PJATools.Tests\TestBirthday.cs(57,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\actions-runner_work\Legacy_App\Legacy_App\PJATools.Tests\PJATools.Tests.csproj]
I've searched for that error and found several places that discuss it, but all saying that an assembly is not referenced. In this case that is not true. The 3 MSTest classes all reference Microsoft.VisualStudio.TestTools.UnitTesting and all the test methods have the TestCategory (TestMethodAttribute) defined and are recongized in VS 2022. Here's the beginning of one of the methods:
[TestMethod]
[TestCategory("Test PJA.Birthday")]
public void TestDateOfBirth()
{
So, why am I getting this error in the self-hosted runner of the GitHub Action, but don't when I test it in VS 2022?
Addendum
Here's the code snippet that's failing in my YAML file:
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
- name: Build solution
run: msbuild $env:Solution_Name /p:Configuration=Release
本文标签: cWhy doesn39t MSBuild recognize TestCategoryStack Overflow
版权声明:本文标题:c# - Why doesn't MSBuild recognize TestCategory? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744021123a2577225.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论