Windows Mobile device states that the assembly System.Windows.Forms 2.0.0.0 cannot be found

StackOverflow https://stackoverflow.com/questions/3981606

  •  09-10-2019
  •  | 
  •  

Question

I am a newbie to .NET programming and I'm trying to create a simple Windows Forms application for a Windows Mobile device using the .NET Compact Framework 2.0. I develop using Boo and using Nant to build my application. My application compiles but it won't run. When I launch the application on my devices it states that the assembly System.Windows.Forms 2.0.0.0 cannot be found. Compact Framework is however installed on the device. The application runs fine on a desktop Windows installation.

My source code:

import System.Drawing
import System.Windows.Forms

def Main():
    button = Button(Text: "Ok", Location: Point(10, 10))
    form = Form(Text: "Sample", FormBorderStyle: FormBorderStyle.FixedDialog,     MaximizeBox: false, MinimizeBox: false, AcceptButton: button, StartPosition: FormStartPosition.CenterScreen)
    form.ShowDialog()

My Nant build script:

<project name="Sample" default="compile">
    <property name="dir.build" value="./build"/>
    <property name="nant.settings.currentframework" value="netcf-2.0"/>

    <target name="clean">
        <delete dir="${dir.build}" failonerror="false"/>
    </target>

    <target name="compile">
        <mkdir dir="${dir.build}"/>
        <booc target="exe" output="${dir.build}/Sample.exe">
            <sources basedir="./source">
                <include name="**/*.boo"/>
            </sources>
        </booc>
    </target>
</project>

Is there something simple thats wrong with this or have I misunderstood something regarding assembly references? As I said, I'm rather new to .NET development and don't know exactly how assembly references work.

Was it helpful?

Solution

Turns out Boo doesn't support the compact framework. The Boo.Lang.dll assembly uses functionality not available in CF. That does however not explain the error I have gotten but my best guess is that Nant allows the Boo compiler to use assemblies from the full .NET framework even though I have specified that .NET CF 2.0 should be the "current framework". It is probably my understanding of what Nant means with "current framework" that is the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top