我在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
namespace path
{
public class file : Ifile
{
public IContactService ContactService => Locator.GetService<IContactService>();
public IAddressService AddressService => Locator.GetService<IAddressService>();
}
}
感谢您帮助我!
答案 0 :(得分:2)
public IContactService ContactService => Locator.GetService<IContactService>();
这是expression-bodied property,仅在CSC 6及更高版本中实施。您的TFS可能正在运行CSC 5或更早版本。您必须将其更改为:
public IContactService ContactService
{
get { return Locator.GetService<IContactService>(); }
}