TFS Build -Error CS1002 :;预期和错误CS1519无效令牌

时间:2017-03-24 16:07:45

标签: c# tfs build token

我在Visual Studio中正确构建了我的解决方案,但是当我使用TFS构建时,我有几个错误,例如:

path\file.cs (8, 47)
path\file.cs(8,47): Error CS1002: ; expected
path\file.cs (8, 85)
path\file.cs(8,85): Error CS1519: Invalid token '(' in class, struct, or interface member declaration

屏幕:enter image description here

namespace path
{
    public class file : Ifile
    {
        public IContactService ContactService => Locator.GetService<IContactService>();
        public IAddressService AddressService => Locator.GetService<IAddressService>();
    }
}

感谢您帮助我!

1 个答案:

答案 0 :(得分:2)

public IContactService ContactService => Locator.GetService<IContactService>();

这是expression-bodied property,仅在CSC 6及更高版本中实施。您的TFS可能正在运行CSC 5或更早版本。您必须将其更改为:

public IContactService ContactService
{
    get { return Locator.GetService<IContactService>(); }
}