Invalid Token Errors when using MSBuild via Comman

2019-08-26 10:11发布

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.

Example of one of the errors:

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]

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.

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

1条回答
该账号已被封号
2楼-- · 2019-08-26 10:57

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

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

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

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

Hope this helps.

查看更多
登录 后发表回答