How does Silverlight determine an assembly is “Silverlight”?

前端 未结 2 696
-上瘾入骨i
-上瘾入骨i 2021-02-14 02:27

I\'m trying to compile code from F# to use in Silverlight. I compile with:

--noframework --cliroot \"C:\\program Files\\Microsoft Silverlight\\2.0.31005.0\" --standalon

相关标签:
2条回答
  • 2021-02-14 02:59

    Visual Studio uses the IsSilverlightAssembly() function in the Microsoft.VisualStudio.Silverlight.SLUtil type to check if a reference can be set.

    David Betz has a nice blog post describing the details here.

    0 讨论(0)
  • 2021-02-14 03:00

    Answer!

    Apparently the problem is that when you add a reference to the bin\Release or bin\Debug, Visual Studio (or the Silverlight project system) decides to try to reference the project. This fails for whatever reason.

    If you copy the F# output DLL to another location, then the reference goes through just fine. (This will be a file reference, not a project reference, of course.)

    Then setup dependencies so the F# library builds first, then you can use a file reference to get the F#-generated binary.

    Update: One more apparent issue. If I turn optimize code on, then I get this error:

    C:\test\SilverlightApplication1\FSC(0,0): error FS0193: internal error: the module/namespace 'System' from compilation unit 'mscorlib' did not contain the namespace, module or type 'MarshalByRefObject'
    

    If I keep optimized code off, this goes away and everything works fine.

    0 讨论(0)
提交回复
热议问题