25

I use some C# 7 features in my project:

static void Main(string[] args)
{
}

public byte ContainerVersion
{
    get => 1;
    private set => throw new NotImplementedException();
}

and it builds fine in visual studio 2017, but I get an error on my CI agent when using old msbuild (v14.0 C:\Program Files (x86)\MSBuild\14.0\Bin\msbuid.exe consoleApplication.csproj.):

error CS1513: } expected.

2 Answers 2

35

You'll need to install msbuild-2015 on your CI agent.

https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15

The default install directory for msbuild will be: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe

Sign up to request clarification or add additional context in comments.

4 Comments

MSBuild 15 is installed with VS. It would be under %VSINSTALLDIR%\MSBuild\15.0\Bin\MSBuild.exe. The Build Tools SKU is intended for CI agents where you don't want to have VS installed. It's worth noting both cases.
Jimmy, you are right. But, we have some special tasks that uses msbuild manual on CI agents.
Even after installing the standalone 2017 build tools on a server c:\program files (x86)\msbuild\15.0 has nothing in it but a \FileTracker folder there is no msbuild.exe or anything. I did have VS2017 installed on the server before I tried this but seems like something is messed up, any ideas?
Do you know, why the msbuild.exe which comes with .NET Framework is unable build C# 7 features?
5

Having installed Visual Studio 2017 Community Edition, the path to msbuild.exe on my machine is:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.