[英]How to fix (29,20): error CS1519: Invalid token '}' in class, struct, or interface member declaration
[英]TFS Build -Error CS1002: ; expected and Error CS1519 Invalid 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
namespace path
{
public class file : Ifile
{
public IContactService ContactService => Locator.GetService<IContactService>();
public IAddressService AddressService => Locator.GetService<IAddressService>();
}
}
感谢你们对我的帮助!
public IContactService ContactService => Locator.GetService<IContactService>();
这是一个表达主体的属性 ,仅在CSC 6和更高版本中实现。 您的TFS可能正在运行CSC 5或更早版本。 您必须将其更改为:
public IContactService ContactService
{
get { return Locator.GetService<IContactService>(); }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.