Search code examples
visual-studio-lightswitchlightswitch-2013

Type 'MyType' is not defined in LightSwitch Desktopclient


I added a computed field in a LightSwitch application to be able to show a string representation of an integer field from an importerd database that has as type a self defined enum. The code is thus:

     Private Sub StatusDescription_Compute(ByRef result As String)
        Dim enumValue As CompetitionStatus = Me.Status
        result = enumValue.ToString
    End Sub

The CompetitionStatus is an enum. Visual studio's IDE accepts this syntax happily after I have added a reference to the dll that contains the enum and added an Imports (using) statement.

I find the added reference back in the LightSwitch's Server subproject (and cannot add it anywhere else.) However, the code refuses to compile, telling me that the CompetitionStatustype is not defined.

What is happening here?


Solution

  • The assembly that CompetitionStatus is defined in must be a Portable Class Library, otherwise it can't be used by the Client project (since it's a Silverlight project). Here's some info: How to Make Portable Class Libraries Work for You