无法通过命令行运行Rest Automation Project [英] Not able to Run Rest Automation Project through Command line

查看:90
本文介绍了无法通过命令行运行Rest Automation Project的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,Rest Automation Project的工具版本是14.0,以下是在视觉上编译和运行的命令

Actually Rest Automation Project’s toolsversion is 14.0 and following are the commands to compile and run in visual

Studio 2015(在VS 2015中创建的项目具有toolversion 14.0 ) 

Studio 2015 (Projects created in VS 2015 has toolsversion 14.0)  

它在VS 2015中运行良好

It works fine in VS 2015

编译

c:\Projects \ Genscape \ Repository \RestAutomation> C:\ Windows \ Microsoftoft.NET \ Framework64 \v4.0.30319 \ MSBuild.exe / m project.targets / t:compile /toolsversion:14.0

c:\Projects\Genscape\Repository\RestAutomation>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /m project.targets /t:compile /toolsversion:14.0

运行

c:\Projects\Genscape \ Repository \RestAutomation> C:\ Windows \ Microsoft \\ Microsoft \\\\\\\\\\\\\\\\ \ MSBuild.exe / m project.targets / t:quick /toolsversion:14.0

c:\Projects\Genscape\Repository\RestAutomation>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /m project.targets /t:quick /toolsversion:14.0

----------------- -------------------------------------------------- -------------------------------------------------- -----------------------------------------

--------------------------------------------------------------------------------------------------------------------------------------------------------------

但是当我在VS 2017中使用相同的命令编译时

but when I compile with same command in VS 2017

C:\Projects\Genscape \\ Repository\restautomation> C:\ Windows \ Microsoftoft.NET \ Framework64 \v4.0.30319 \ MSBuild.exe / m project.targets / t:compile /toolsversion:14.0

C:\Projects\Genscape\Repository\restautomation>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /m project.targets /t:compile /toolsversion:14.0

Microsoft(R)Build Engine版本4.7.3056.0

Microsoft (R) Build Engine version 4.7.3056.0

[Microsoft .NET Framework,版本4.0.30319.42000]

[Microsoft .NET Framework, version 4.0.30319.42000]

版权所有(C)Microsoft公司。保留所有权利。

Copyright (C) Microsoft Corporation. All rights reserved.

Build build 2/22/2019 2:44:25 PM。

Build started 2/22/2019 2:44:25 PM.

     1>项目"C:\Projects \ Genscape \ Repository \\\ testautomation\project.targets"在节点1上(编译目标)。

     1>Project "C:\Projects\Genscape\Repository\restautomation\project.targets" on node 1 (compile target(s)).

     1> C:\Projects\Genscape \ Repository \BuildTools \BuildUtils \ common.environment.targets(14,2):错误MSB4019:导入的项目"C:\Program Files(x86)\\ \\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets"
未找到。确认< Import>中的路径声明是正确的,

     1>C:\Projects\Genscape\Repository\BuildTools\BuildUtils\common.environment.targets(14,2): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the

      文件存在于磁盘上。 [C:\Projects\Genscape\Repository\restautomation\project.targets]

       file exists on disk. [C:\Projects\Genscape\Repository\restautomation\project.targets]

     1>完成建筑项目"C:\Projects \Genscape \ Repository \\\ testautomation\project.targets" (编译目标) - 失败。

     1>Done Building Project "C:\Projects\Genscape\Repository\restautomation\project.targets" (compile target(s)) -- FAILED.

建立失败。

       " C:\Projects\Genscape\Repository\restautomation\project.targets" (编译目标)(1) - >

       "C:\Projects\Genscape\Repository\restautomation\project.targets" (compile target) (1) ->

         C:\Projects\Genscape \ Repository \BuildTools \BuildUtils \ common.environment.targets(14,2):错误MSB4019:导入的项目"C:\Program Files(x86)\ MSBuild \ Mi

         C:\Projects\Genscape\Repository\BuildTools\BuildUtils\common.environment.targets(14,2): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Mi

       crosoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets"没找到。确认< Import>中的路径声明是正确的,并且

       crosoft\VisualStudio\v14.0\CodeAnalysis\Microsoft.CodeAnalysis.Targets" was not found. Confirm that the path in the <Import> declaration is correct, and that th

       e文件存在于磁盘上。 [C:\Projects\Genscape\Repository\restautomation\project.targets]

       e file exists on disk. [C:\Projects\Genscape\Repository\restautomation\project.targets]

    0警告

    0 Warning(s)

    1错误

    1 Error(s)

如果我更改了toolversion 15.0

If I changed the toolversion 15.0

C:\Projects\Genscape\Repository\restautomation> C: \ Windows \ microsoft.NET \ Framework64 \v4.0.30319 \ MSBuild.exe / m project.targets / t:compile /toolsversion:15.0

C:\Projects\Genscape\Repository\restautomation>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /m project.targets /t:compile /toolsversion:15.0

Microsoft(R)Build引擎版本4.7.3056.0

Microsoft (R) Build Engine version 4.7.3056.0

[Microsoft .NET Framework,版本4.0.30319.42000]

[Microsoft .NET Framework, version 4.0.30319.42000]

版权所有(C)Microsoft Corporation。保留所有权利。

Copyright (C) Microsoft Corporation. All rights reserved.

MSBUILD:错误MSB1040:ToolsVersion无效。工具版本"15.0"无法识别。可用的工具版本是"14.0","4.0"。

MSBUILD : error MSB1040: ToolsVersion is not valid. The tools version "15.0" is unrecognized. Available tools versions are "14.0", "4.0".

开关:15.0           &NBSP;&NBSP;

Switch: 15.0            

----------------------------------- -------------------------------------------------- -------------------------------------------------- --------------------------

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

最后我使用以下命令

C:\Projects\Genscape\Repository\restautomation\src> C:\ Windows \ Microsoftoft.NET\Framework64 \v4.0.30319 \ MSBuild.exe

C:\Projects\Genscape\Repository\restautomation\src>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe

C:\Projects\Genscape\Repository\restautomation\src>" C:\Program Files(x86)\ Microsoft Visual Studio\2017 \Professional\MSBuild \\ \\ 15.0\Bin\MSBuild.exe"

C:\Projects\Genscape\Repository\restautomation\src>"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"

编译成功。 。 。

正如你所看到的,我的机器中有两个msbuild版本

As you can see there are two msbuild versions in my machine

所以我非常不知道如何在VS 2017中运行Project。 / p>

So I am very badly stuck in how to Run Project in VS 2017.

推荐答案

您遇到的问题与MSBuild有关。从VS 2017开始,可以安装任何#的MSBuild实例。不再是"全球"的版。每次安装VS 2017时,它都会获得自己的MSBuild副本。这是讨论

这里
。对于15之前的MSBuild版本,虽然公共路径仍然可用且可以使用。 

What you're having issues with is related to MSBuild. Starting with VS 2017 there can be any # of MSBuild instances installed. There is no longer a "global" version. Each time you install VS 2017 it gets its own copy of MSBuild. This is discussed here. For versions of MSBuild prior to 15 though the common path is still available and can be used. 

为了使用MSBuild v15 +扩展,需要更新以使用MSBuild的版本项目的目标是而不是全球项目。这需要改变他们的一面。有一段时间了,项目已经切换到`

In order to work with MSBuild v15+ extensions need to be updated to use the version of MSBuild that the project is targeting instead of the global one. This requires a change on their side. For a while now projects have been switching over to the `


> MSBuildToolsPath )`
变量,为此做准备。 
(MSBuildToolsPath)` variable in preparation for this. 

一般来说,加载到VS 2017的VS 2015项目将继续正确编译,因为VS 2015仍然安装,因此可以使用MSBuild 14.0。除非您更改项目的目标版本以使用较新的MSBuild,否则它仍然可以工作。
如果您需要支持MSBuild 15.0,那么包含您尝试使用的库的扩展需要先更新。大多数代码都转移到NuGet,以便您可以只安装一个包。软件包现在可以注入目标文件,无需额外安装

In general a VS 2015 project loaded into VS 2017 will continue to compile correctly because VS 2015 is still installed and therefore MSBuild 14.0 is available. Unless you change the project's target version to use the newer MSBuild then it should still work. If you need to support MSBuild 15.0 then the extension that contains the library you're trying to use needs to update first. Most code is moving to NuGet so that you can just install a package. Packages can now inject targets files which eliminates the need for extra installs.


这篇关于无法通过命令行运行Rest Automation Project的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆