locked
Forms-Applications, Silverlight and Mac (Linux)? RRS feed

  • Question

  • Hello,

    Is it possible to create a Silverlight Application in Blend, which uses the System.Reflection and System.Windows.Forms namespaces to compile a Forms-Application during its runtime on a Mac?

    If not, are there any other possibilities to do something similar (For example compiling a Silverlight application with System.Reflctions)?

    My Project is running OutOfBrowser and I'm using C#.

    Has anyone a solution for my problem?

    Friday, August 6, 2010 1:48 AM

All replies

  • Could you please describe what you are trying to accomplish with examples?  There are many things possible with reflection, but this isn't really a yes or no question without details.
    Friday, August 6, 2010 1:10 PM
    Moderator
  • I want to Compile a Silverlight application while the runtime of my own application using System.Reflections (or another namespace?).
    Friday, August 6, 2010 1:29 PM
  • Silverlight can't compile anything, but it can instantiate things via reflection from already compiled code. Can you provide more details about your goals?  Details please.
    Friday, August 6, 2010 1:46 PM
    Moderator
  • I want to create some kind of a designer for WPF-applications (Sorry, I've written "Silverlight" above).

    So the user can drag controls in an empty UserControl and design his own application. Then the program generates the code from the design and compiles it into a standalone WPF application.

    Friday, August 6, 2010 1:59 PM
  • So you want to create Blend, in Blend? :)

    Yes, WPF and .Net are certainly capable of this (Blend being a good example), but it is a complex problem.

    If you have specific questions we can try to help, just let us know.

    Friday, August 6, 2010 2:05 PM
    Moderator
  • My problem is the XAML-Code. System.Reflections compiles the C# code, but I don't have a clue how i can compile the user-designed XAML-GUI and combine it with the C# code (to create the WPF-Application).
    Friday, August 6, 2010 2:21 PM
  • You will probably have to invoke the csc compiler, directly or using msbuild with a generated csproj file.
    Friday, August 6, 2010 2:24 PM
    Moderator
  • Ok, I'll try it, but how do I generate a csproj file from a cs file and a xaml file?
    Friday, August 6, 2010 2:36 PM
  • In theory you would need some sort of template that you could generate, like what Visual Studio and Blend do. Like I said previously, this is a big and complex problem. You could also just invoke the csc compiler with the files you want compiled. MSBuild + csproj files are in the end just a series of steps.
    Friday, August 6, 2010 2:48 PM
    Moderator
  • Could you give me a Code example of how to use the csc compiler to compile and combine a cs file and a xaml file to a wpf-application?

    I never used the csc compiler before :)

    Friday, August 6, 2010 3:44 PM
  • Your best option is to create a brand new WPF app in Visual Studio, close VS, open a command prompt and use msbuild to build the csproj file. You can study the output from msbuild to see the steps. It is not the simplest of things, as there is a markup pass that turns xaml into baml/cs code.
    Friday, August 6, 2010 3:50 PM
    Moderator
  • Does this mean, that xaml is not necessary to create a wpf application? Can I directly design the GUI in C#?

    How do I use msbuild?

    Friday, August 6, 2010 4:01 PM
  • Anything you can do in xaml you can do in c#. It is often much more difficult to do in c# however. A typical csc command combines cs backing files, with an autogenerated cs file for the xaml, and the compiled baml file which comes from the xaml.
    Friday, August 6, 2010 4:40 PM
    Moderator
  • ok and which command do I need to use? and how can I run the command in my program?
    Friday, August 6, 2010 4:46 PM
  • This is a very complex problem, I can't just say "System.CompileMyCode()" as an answer. You will have to read the documentation for csproj, msbuild, csc, etc...

    msbuild/csproj are intended to be extensible and easy to use once you understand them. I suggest starting there to learn about the build system.

    Friday, August 6, 2010 5:52 PM
    Moderator
  • Ok, thanks for your help.

    I'll read a bit through the documentation.

    Friday, August 6, 2010 6:44 PM