NealR
NealR

Reputation: 10669

Visual Studio builds solution but MSBuild from the command line fails

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

Upvotes: 0

Views: 3945

Answers (1)

MihaiP.
MihaiP.

Reputation: 145

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.

Upvotes: 1

Related Questions