hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

Resource embedded seven times

Last post 07-23-2008, 4:20 by dsyme. 2 replies.
Sort Posts: Previous Next
  •  06-03-2008, 2:24 6058

    Resource embedded seven times

    When I try to embed resources. I found the samples101 in the fsharp directory.
    The sample add .resx file to itself. Compile it.
    The .exe file size is 323KB. And then Open it using Reflector I found that there is seven resources in it:
    FSharp Resxc Bug 1

    But if I use the other method: --resource "SampleForm.resources" Command-Line.
    The file size is 119KB. There is one resource only in Reflector:
    FSharp Resxc Bug 2


    Is there any one have the save issue???

    FSharp-1.9.4.17   .NET 3.5   Server2k8
  •  07-22-2008, 15:20 6423 in reply to 6058

    Re: Resource embedded seven times


    I have the same issue with 1.9.4.19.  When I included a images.resx in the file, it get compiled and included in the dll as images.resources 7 times according to .NET Reflector.  Can you briefly explain the process for the other method?

    Once I actually get it in the assembly, how do I load it?  Right now, I'm trying to load an image and set it as the form icon like so:

        let rm = new ResourceManager("images", System.Reflection.Assembly.GetExecutingAssembly())
        let imageList = new ImageList()
        imageList.ImageStream <- ((rm.GetObject("imageList.ImageStream")) :?> ImageListStreamer) // p176
        let images = imageList.Images
        printfn "# of images: %d" images.Count
        let bitmap = images.[0] :?> Bitmap
        let icon = Icon.FromHandle(bitmap.GetHicon())
        form.Icon <- icon

    but it isn't working. Any ideas?
  •  07-23-2008, 4:20 6429 in reply to 6423

    Re: Resource embedded seven times

    Thanks for reporting this issue.

    For now, please use "--resource" (Chris - you compile the resource using resgen.exe, part of the .NET Framework SDK).

    The ability to pass a .resx file on the command line is likely to be deprecated in a future release in favour of "doing it properly" with by using tools such as MSBuild.

    Kind regards

    don

     

     

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems