首先,我嘗試了一個較短版本的代碼爲我的stackoverflow問題,但不會導致我的編譯器錯誤。另外,我無法使用AspnetCompiler而不是MsBuild,因爲我正在構建多個網站和類庫的解決方案。我的構建服務器設置已經存在多年,我從來沒有像這樣的任何問題。我有我的C#廣泛使用VB.Net圖書館,在圖書館中,我有以下幾點:奇怪的MsBuild錯誤(在Visual Studio中一切正常)
Public Class PropertyParticipants
Public Property Participants As List(Of Participant)
Private _propertyId As Integer
Public Sub New(propertyId As Integer)
Participants = New List(Of Participant)()
_propertyId = propertyId
LoadParticipants()
End Sub
End Class
Public Class Participant
Public Property Role As ParticipantRole
Public Property Type As ParticipantType
Public Property FirstName As String
Public Property LastName As String
Public Property Password As String
Public Property LoginId As String
Public Property Initials As String
Public Property UserId As Integer
Public ReadOnly Property FullName() As String
Get
Return Me.FirstName & " " & Me.LastName
End Get
End Property
Public Enum ParticipantRole
Primary
Party
Pending
End Enum
Public Enum ParticipantType
Seller
Buyer
End Enum
End Class
然後在我的C#代碼後面我有以下
PropertyParticipants propPart = new PropertyParticipants(PropertyId);
foreach (Participant part in propPart.Participants.Where(p => p.Role != Participant.ParticipantRole.Pending))
{
int userId = part.UserId; //this is fine
string loginId = part.LoginId; //compiler error
}
錯誤CS1061:'參與者'不包含'LoginId'的定義,並且沒有找到接受'參與者'類型的第一個參數的擴展方法'LoginId'(您是否缺少使用指令或程序集引用?)
我錯過了實際的編譯錯誤是什麼? –
哎呀抱歉,編譯器錯誤添加到我的問題 –