2

I have using the built in CSharpCodeProvider class in previous C# .NET projects and it has worked great. I see this has been removed in UWP. I've been banging my head against the wall trying to figure out if there is a way. I can't seem to find any scrap of information. But, I did come across an interesting app called #Code by Shahul Hameed on the Windows Store. This software claims to be able to compile code and be able to run it, and indeed it does. How are they achieving this, if such actions are not possible on the framework? Is it possible they're sending the code over the net to a web service of some kind and getting the returned console output? I thought so, but what about the live stdin support they've provided in the app, how would that work in a cloud compile situation?

Thanks for shedding any light

Code on Windows Store: https://www.microsoft.com/en-us/store/p/code/9nblggh4s3mf

Kyle
  • 2,339
  • 10
  • 33
  • 67
  • 1
    is `Microsoft.CodeAnalysis.CSharp` available in UWP? If yes then you can use `CSharpCompilation` which is the Roslyn infrastructure if I don't recall it wrong. – Gusman May 04 '17 at 22:24
  • @Gusman It does not appear to be available from my trials. – Kyle May 04 '17 at 22:27
  • It's a NuGet package, add it and it will work (tested and compiles fine). – Gusman May 04 '17 at 22:30
  • 1
    The design-goal for UWP (WinRT actually) was to make Microsoft competitive in the mobile computing business. Similar to how iOS is different from OSX. Billions of dollars spent on it. That phone that nobody wants to buy does not have a just-in-time compiler. That contraption you are supposed to wear on your head doesn't either. Ahead-of-time is important for such devices, called .NET Native. – Hans Passant May 04 '17 at 22:59
  • @Gusman Ok this is trickier but it does seem to have a possibility. Except that by default it can't find any System namespace items. I'm going to have to study it some more. – Kyle May 04 '17 at 23:33
  • IF you want I can add an example on how to compile a DLL with this namespace. – Gusman May 04 '17 at 23:34
  • I believe you add it ot MetadataReference array. But the real question is, how to avoid adding like 20 different DLLs – Kyle May 04 '17 at 23:39
  • I'm going to delete the answer, the compilation phase works but there's no way to load at runtime the libraries under UWP. Sorry :( – Gusman May 05 '17 at 00:10

0 Answers0