通过命令行使用MSBuild而不是在Visual Studio上使用无效的令牌错误 [英] Invalid Token Errors when using MSBuild via Command Line but not on Visual Studio

查看:118
本文介绍了通过命令行使用MSBuild而不是在Visual Studio上使用无效的令牌错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过命令行使用MSBuild命令时,我在cmd中收到许多错误,指向模棱两可的语法错误(大约300).但是,当我通过Visual Studio 2015进行构建时,不会出现此类问题.

When I use MSBuild command through the Command Line I receive many errors in the cmd pointing to ambiguous syntax errors (approximately 300). However when I do a Build via Visual Studio 2015 I don't receive these types of issues.

错误之一的示例:

Pages\BookingScreen.cs(15,38): error CS1002: ; expected [C:\BLAH\UITests\UITests\UITests.csproj]
Pages\BookingScreen.cs(15,66): error CS1519: Invalid token '(' in class, struct, or interface member declaration [C:\BLAH\UITests\UITests\UITests.csproj]
Pages\BookingScreen.cs(17,39): error CS1002: ; expected [C:\BLAH\UITests\UITests\UITests.csproj]
Pages\BookingScreen.cs(17,67): error CS1519: Invalid token '(' in class, struct, or interface member declaration [C:\BLAH\UITests\UITests\UITests.csproj]
Pages\BookingScreen.cs(23,47): error CS1002: ; expected [C:\BLAH\UITests\UITests\UITests.csproj]

想知道是否有人会通过在命令行中运行"MSBuild"来了解可能的差异,这可能会导致发生此类错误.

Was wondering if anyone would know the possible differences through running "MSBuild" via command line, that may have caused an error like this to occur.

背景信息: MSBuild环境变量指向:"C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319"

Background info: MSBuild Environment Variable points to: "C:\Windows\Microsoft.NET\Framework\v4.0.30319"

推荐答案

背景信息:MSBuild环境变量指向:"C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319"

Background info: MSBuild Environment Variable points to: "C:\Windows\Microsoft.NET\Framework\v4.0.30319"

由于使用的是Visual Studio 2015,因此应将MSBuild环境变量点设置为以下路径:

Since you are using the Visual Studio 2015, you should set MSBuild Environment Variable points to the following path:

C:\Program Files (x86)\MSBuild\14.0\Bin

由于从Visual Studio 2013开始,MSBuild 2013版本将作为Visual Studio的一部分而不是.NET Framework发行.

Because starting with Visual Studio 2013, the 2013 version of MSBuild will ship as a part of Visual Studio instead of the .NET Framework.

您可以检查Visual Studio博客:

You can check the Visual Studio Blog: MSBuild is now part of Visual Studio! for some more details.

希望这会有所帮助.

这篇关于通过命令行使用MSBuild而不是在Visual Studio上使用无效的令牌错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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