我正在尝试使用以下命令构建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?)
答案 0 :(得分:0)
我遇到了同样的问题,发现这是由使用Microsoft.VisualStudio.QualityTools.UnitTestFramework
的旧版Visual Studio中创建的单元测试项目引起的。应该将其更改为使用Microsoft.VisualStudio.TestPlatform.TestFramework
,这是以后的单元测试项目中使用的默认设置。解决步骤: