0

まず、stackoverflow の質問に対して短いバージョンのコードを試しましたが、コンパイラ エラーは発生しません。また、複数の Web サイトとクラス ライブラリのソリューションを構築しているため、MsBuild の代わりに AspnetCompiler を使用できません。私のビルド サーバーのセットアップは何年も前から行われており、このような問題は一度もありません。私は C# で広く使用している VB.Net ライブラリを持っています。そのライブラリには次のものがあります。

   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: 'Participant' には 'LoginId' の定義が含まれておらず、タイプ 'Participant' の最初の引数を受け入れる拡張メソッド 'LoginId' が見つかりませんでした (using ディレクティブまたはアセンブリ参照がありませんか?)

4

2 に答える 2

0

Visual Studio でソリューションの各プロジェクトを手動で再構築し、エラーが表示されるかどうかを確認してください。同じソリューション (任意の CPU と x86) でプラットフォームが異なる 2 つのプロジェクトが原因で、同様の問題が発生しました。

于 2013-08-06T03:43:19.663 に答える