0
votes

I've seen a number of posts on this subject but none really seem to address my specific error/situation (or at least the solutions haven't worked yet). I can build my solution just fine in Visual Studio, but using the following command line statement fails.

msbuild Project.sln /t:Build /p:RunOctoPack=true

I get 21 errors in total, each one similar to those I've posted below (Invalid Token).

ApplicationConfiguration\ApplicationSessionService.cs(19,30): error CS1002: ; e xpected [C:\Projectstuff\Project.Common\Project.Common.csproj] ApplicationConfiguration\ApplicationSessionService.cs(19,54): error CS1519: Inv alid token '!=' in class, struct, or interface member declaration [C:\Projectstuff\Project.Common\Project.Common.csproj] Events\UsbDeviceChanged.cs(48,46): error CS1056: Unexpected character '$' [C:\Projectstuff\Project.Common\Project.Common..Common.csproj]

The project is built with .Net 4.5.2, however I noticed this is one of the first output lines in the command window. Again, this builds in Visual Studio 2015 Community Edition and I know I have the .Net 4.5.2 framework on my machine, so not sure if this matters or not.

CoreCompile: C:\windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe

1
What version of MSBuild? Do you have any other Visual Studio's installed? Afaik, MSBuild switches to the compiler it originally came with (ieg, MSBuild 14 uses the VS2015 compiler), so it might be compiling with a compiler that does not fully support your code. This is especially the case if you set the compiler to use differently within your IDE (this affects mostly C++ projects though. Not entirely sure about C#) - Biepbot Von Stirling

1 Answers

1
votes

It just happened to me last week and I bet you are in the same situation! Please see my question here.

You may have a non-displayable character in your code. You might want to try to re-write the code around the location of the first error reported by the compiler.