TeamCity C # compile error: Invalid expression term 'int'

A project that is compiled locally (targeting .NET Framework 4.6.1) does not work in TeamCity with the following message:

[CoreCompile] Csc [Csc] Using shared compilation with the compiler from the directory: C: \ Program Files (x86) \ MSBuild \ 14.0 \ bin

[19:02:15] [Csc] Services \ MyFile.cs (20, 55): Error CS1525: Invalid expression term 'INT'

[19:02:15] [Csc] Services \ MyFile.cs (20, 59): error CS1003: syntax error, ',' expected

I also get a lot of them in a failed compilation in a red letter:

[Step 5/9] Target "MvcBuildViews" specified in table "BeforeTargets" attribute in "C: \ Program Files (X86) \ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ Web \ Microsoft.Web.Publishing.targets (845,131 ) "does not exist in the project and will be ignored.

+3


source to share


1 answer


Firstly, if it can help anyone, when TeamCity fails a step, a lot of text in that step will be red (even simple warnings), so at first I ran into a dead end believing the second error message was a problem. This is not true.

It turns out my Resharper 2016.3.2 (on Visual Studio 2017) changed the following

int newInt;
if (!int.TryParse(theChar.ToString(), out newInt))
    return false;

      

in



if (!int.TryParse(theChar.ToString(), out int newInt))
    return false;

      

with a Alt+ refactoring Entercalled "String Variable Declaration" (which usually sounds pretty harmless) and I was as good as good.

This did not cause any problems locally as it is C # 7 syntax, but my TeamCity compiler failed with the compiler due to a too low MSBuild version.

+6


source







All Articles