接收CS0234:类型或名称空间名称'VisualStudio'在使用MSBuild.exe的名称空间'Microsoft'中不存在

问题描述 投票:0回答:1

我正在尝试使用以下命令构建dotnet解决方案,但出现错误

CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' using MSBuild.exe

命令:

bat "\"${tool 'MSBuild'}\" Test.sln  /t:Rebuild /p:Configuration=Release /p:VisualStudioVersion=14.0 /p:NoWarn=7035 /p:Platform=\"Any CPU\" "

该代码存在于Bitbucket中,我正在从Jenkins触发构建。该代码正在Windows服务器中运行。

bat "\"${tool 'MSBuild'}\" Test.sln  /t:Rebuild /p:Configuration=Release /p:VisualStudioVersion=14.0 /p:NoWarn=7035 /p:Platform=\"Any CPU\" "

error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?) 

error CS0246: The type or namespace name 'TestInitialize' could not be found (are you missing a using directive or an assembly reference?)

error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
jenkins-groovy msbuild-4.0
1个回答
0
投票
打开单元测试项目引用,并删除对Microsoft.VisualStudio.QualityTools.UnitTestFramework的引用:UnitTests References

打开项目的管理NuGet程序包,然后添加MSTest.TestFramework程序包。

    在Visual Studio中重新运行单元测试(作为健全性检查,应该可以通过。)>
  1. 从Jenkins提交更改,推送,重新运行构建。
© www.soinside.com 2019 - 2024. All rights reserved.