SharpDevelop RT Edition (beta) – Code Windows Forms Directly On Windows RT

Playing with my Microsoft Surface RT I was itching to do some coding on it. So I have started porting SharpDevelop http://www.icsharpcode.net/opensource/sd/download/ so that it will run on Windows RT.

A few notes:

  • This is unsupported by Microsoft method, your device must be “unlocked” to allow running 3rd party Desktop apps
  • I had to go back to SharpDevelop 3.2 as it was last version without WPF based GUI (Windows RT doesn’t support WPF)
  • So far I only tested C# Windows Forms GUI design & compile + C# Console. C# ASP.NET compiles but you’ll need to deploy manually to a web server. VB.NET currently doesn’t work.
  • Debugging does not work, you must run compiled EXE outside debugger currently
  • Ensure target framework is .NET 4.0 and platform is Any CPU (not x86/x64)
  • I removed SVN support, WPF templates
  • I migrated projects to .NET 4.5 framework and changed the build platform from x86 to Any CPU
  • You need to copy from full Windows machine with .NET 4 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.Targets onto Windows RT. Possibly other files in this folder too. I copied the entire C:\Windows\Microsoft.NET\Framework\v4.0.30319 from my Win8 machine with VS2012 & Windows SDK installed but did not overwrite any existing files in the directory on Windows RT device, if you do you’ll trash your .NET. I chose “skip” for duplicate files. Recommend make backup of dir on Windows RT before modification.
  • You will need to copy from existing Windows development machine with Visual Studio 2012 installed – C:\Program Files\Reference Assemblies on 32-bit machine or C:\Program Files (x86)\Reference Assemblies to your Windows RT devices. You should have structure like this:

  • I also had to take these two DLLs from an existing Windows 8 machine and copy to these locations

xcopy system.xml.linq.dll C:\windows\assembly\GAC_MSIL\System.Xml.Linq\4.0.0.0__b77a5c561934e089\

xcopy system.data.datasetextensions.dll C:\windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\4.0.0.0__b77a5c561934e089\

  • It is possible you may need to copy other DLLs from a Windows 8 machine, the name of missing DLL should be displayed when running EXE

Once above is accomplished you can do the following:

  1. Download and Extract
  2. Run bin\SharpDevelop.exe
  3. Click File | New Solution
  4. Select Windows Application
  5. Give it name Hello World, click Create
  6. Select MainForm.cs tab, then select Design
  7. Click View | Tools
  8. Expand Windows Forms, drag label onto Form
  9. Right click label properties, change text to Hello, Worl

  10. Click Build | Edit Configuration/Platform
  11. In Platform click x86 and Edit

  1. Add anycpu then select it click OK
  2. Select platform Any CPU again. Should look like this:

  1. Hit the red exclamation mark to run program (next to green play button) or hit Ctrl+FN+Search Button

Vs201 project Source code and binary here:

https://skydrive.live.com/redir?resid=E1A3C870740A073D!270&authkey=!AI0vFrK_EVY53hI

original project here: http://www.icsharpcode.net/opensource/sd/download/

About Malcolm McCaffery

specializes in end-user computing technologies. disclaimer 1) use at your own risk. test any solution in your environment. if you do not understand the impact/consequences of what you're doing please stop, and ask advice from somebody who does. 2) views are my own at the time of posting and do not necessarily represent my current view or the view of my employer and family members/relatives. 3) over the years Microsoft/Citrix/VMWare have given me a few free shirts, pens, paper notebooks/etc. despite these gifts i will try to remain unbiased.
This entry was posted in Uncategorized. Bookmark the permalink.

20 Responses to SharpDevelop RT Edition (beta) – Code Windows Forms Directly On Windows RT

  1. for this specific error you just need to copy the Microsoft.CSharp.Targets file though (I think installed by visual studio)

  2. Austin says:

    Took another look at it tonight and it worked with your appended instructions, thanks! I figured that was the issue but I had no idea where to get the mentioned files.

    Also, for anyone that cares, I grabbed the files from a Win 7 edition of VS2012 and so far it works fine!

  3. mspbkhn says:

    when I compiled, I got this error:
    Parameter “SearchPaths” has invalid value “{CandidateAssemblyFiles}%3b
    %3b
    {HintPathFromItem}%3b
    {TargetFrameworkDirectory}%3b
    {Registry:Software\Microsoft\.NETFramework,v4.0,AssemblyFoldersEx}%3b
    %3b
    {GAC}%3b
    {RawFileName}%3b
    bin\Debug\System.winmd”. Illegal characters in path. (MSB3248)

    • There is invalid characters in SearchPaths. MSBuild obtains this path from the following locations:

      (1) Files from current project – indicated by {CandidateAssemblyFiles}
      (2) $(ReferencePath) – the reference path property, which comes from the .USER file.
      (3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
      (4) The directory of MSBuild’s “target” runtime from GetFrameworkPath.
      The “target” runtime folder is the folder of the runtime that MSBuild is a part of.
      (5) Registered assembly folders, indicated by {Registry:*,*,*}
      (6) Legacy registered assembly folders, indicated by {AssemblyFolders}
      (7) Resolve to the GAC.
      (8) Treat the reference’s Include as if it were a real file name.
      (9) Look in the application’s output folder (like bin\debug)

      Option (2) would be most likely cause. I haven’t see this issue myself, but this problem with msbuild.exe is also known to occur on full Windows with Visual Studio, so you might look for other solutions people have found for this problem out on the internet, they may have more details.

    • Grancapi says:

      The problem is SharpDevelop and the target files in v4.0.30319 are not fully compatible.
      The simplest fix is to just add:

      v4.0 C:\Windows\Microsoft.NET\Framework\v4.0.30319

      to your project, in the PropertyGroup section.

      • Grancapi says:

        Correction (copy paste missed some tags)

        <FrameworkPathOverride^gt;C:\Windows\Microsoft.NET\Framework\v4.0.30319</FrameworkPathOverride>

  4. Nhan Phan says:

    I got this error:

    SharpDevelop Version : 3.2.1.6466
    .NET Version : 4.0.30319.18033
    OS Version : Microsoft Windows NT 6.2.9200.0
    Current culture : Vietnamese (Vietnam) (vi-VN)
    Current UI language : en-US
    Working Set Memory : 34356kb
    GC Heap Memory : 2316kb

    Unhandled exception terminated SharpDevelop
    Exception thrown:
    System.NullReferenceException: Object reference not set to an instance of an object.
    at ICSharpCode.Core.WinForms.ToolBarComboBox..ctor(Codon codon, Object caller) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.Core.WinForms\ToolBar\ToolBarComboBox.cs:line 52
    at ICSharpCode.Core.WinForms.ToolbarService.CreateToolbarItemFromDescriptor(ToolbarItemDescriptor descriptor) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.Core.WinForms\ToolBar\ToolBarService.cs:line 55
    at ICSharpCode.Core.WinForms.ToolbarService.CreateToolStripItems(Object owner, AddInTreeNode treeNode) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.Core.WinForms\ToolBar\ToolBarService.cs:line 27
    at ICSharpCode.Core.WinForms.ToolbarService.CreateToolStrip(Object owner, AddInTreeNode treeNode) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.Core.WinForms\ToolBar\ToolBarService.cs:line 74
    at ICSharpCode.Core.WinForms.ToolbarService.CreateToolbars(Object owner, String addInTreePath) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.Core.WinForms\ToolBar\ToolBarService.cs:line 111
    at ICSharpCode.SharpDevelop.Gui.DefaultWorkbench.CreateToolBars() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Gui\Workbench\DefaultWorkbench.cs:line 681
    at ICSharpCode.SharpDevelop.Gui.DefaultWorkbench.Initialize() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Gui\Workbench\DefaultWorkbench.cs:line 288
    at ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Gui\WorkbenchSingleton.cs:line 107
    at ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.InitializeWorkbench() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Gui\WorkbenchSingleton.cs:line 90
    at ICSharpCode.SharpDevelop.Sda.CallHelper.RunWorkbenchInternal(Object settings) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\CallHelper.cs:line 122
    at ICSharpCode.SharpDevelop.Sda.CallHelper.RunWorkbench(WorkbenchSettings settings) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\CallHelper.cs:line 112
    at ICSharpCode.SharpDevelop.Sda.SharpDevelopHost.RunWorkbench(WorkbenchSettings settings) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\SharpDevelopHost.cs:line 117
    at ICSharpCode.SharpDevelop.SharpDevelopMain.RunApplication() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\StartUp\Project\SharpDevelopMain.cs:line 182
    at ICSharpCode.SharpDevelop.SharpDevelopMain.Run(String[] args) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\StartUp\Project\SharpDevelopMain.cs:line 97
    at ICSharpCode.SharpDevelop.SharpDevelopMain.Main(String[] args) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\StartUp\Project\SharpDevelopMain.cs:line 49

    —- Recent log messages:
    Failed to append recent log messages.
    System.InvalidOperationException: Sequence contains no elements
    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
    at ICSharpCode.SharpDevelop.Sda.LogMessageRecorder.AppendRecentLogMessages(StringBuilder sb, ILog log) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\LogMessageRecorder.cs:line 109
    at ICSharpCode.SharpDevelop.Sda.ExceptionBox.getClipboardString() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\ExceptionBox.cs:line 138

    —- Post-error application state information:
    Installed 3rd party AddIns:

  5. Hans Martin says:

    I followed the instruction, but when I try to run Sharp Develop it says, that SearchAndReplace.dll or a dependency of it was not found.

  6. Zhang Tianyi says:

    Hello!
    I’m very exiting for I can develop on my surface rt.So,how di you port the #Develop to the arm?VS2012 is inpossible I think.#develop of course can not.So what tool did you use to port the PC app to the WIndows RT?So,Can you port the vbc.exe to windows RT?With this exe you can use # Develop to write vb.net program.I would like to ask, whether the arm version of the vbc.exe or whether to write?I need it! Because I usually need to use VB.NET programming.So,what tool did you use to port PC app to the Windows RT?And do you have a vbc.exe in arm edition?

  7. Zhang Tianyi says:

    Hello!
    I’ve got 2 questions:
    1.Why the vb.net doesn’t work?Because the vbc.exe doesn’t work?So can you port vbc.exe to windows rt?I really need to write vb.net!
    2.How did you port the #develop from pc to arm?How to?What tool did you use?

    • 1. Can’t port vbc.exe no source code and not included in RT. If it was pure .NET this wouldn’t be issue
      2. To port it I used Visual Studio 2012 and switched all projects to compile,under “any CPU” and .net 4.5. I didn’t change any code. I removed any native (non .net) plugins

      The easiest option is to switch to C# or use auto convert tools to convert your vb.net to c#. Or remote connect to full windows machine with visual studio, set your .net project to 4.5 and any CPU, then your project will run on Windows RT (jail break devices)

  8. DealExtreme2 says:

    Hi there! I just wanted to say: fantastic! It works really, really well! This is like makeing the RT worth 10 times more! Whoohoooo :)

  9. Austin Shirley says:

    Here’s the error:

    SharpDevelop Version : 3.2.1.6466
    .NET Version : 4.0.30319.18033
    OS Version : Microsoft Windows NT 6.2.9200.0
    Current culture : English (United States) (en-US)
    Working Set Memory : 71456kb
    GC Heap Memory : 9048kb

    Exception thrown:
    Microsoft.Build.BuildEngine.InvalidProjectFileException: The imported project “C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.Targets” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
    at Microsoft.Build.BuildEngine.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, XmlNode xmlNode, String resourceName, Object[] args)
    at Microsoft.Build.BuildEngine.Project.LoadImportedProject(Import import)
    at Microsoft.Build.BuildEngine.Project.ProcessImportElement(XmlElement importElement, String projectDirectoryLocation, Boolean importedProject)
    at Microsoft.Build.BuildEngine.Project.ProcessProjectChildren(XmlElement projectElement, String projectDirectoryLocation, Boolean importedProject)
    at Microsoft.Build.BuildEngine.Project.ProcessMainProjectElement()
    at Microsoft.Build.BuildEngine.Project.RefreshProjectIfDirty()
    at Microsoft.Build.BuildEngine.Project.GetEvaluatedItemsByName(String itemName)
    at ICSharpCode.SharpDevelop.Project.MSBuildBasedProject.CreateItemsListFromMSBuild() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Project\MSBuildBasedProject.cs:line 841
    at ICSharpCode.SharpDevelop.Project.MSBuildBasedProject.AddImport(String projectFile, String condition) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Project\MSBuildBasedProject.cs:line 214
    at CSharpBinding.CSharpProject.Create(ProjectCreateInformation information) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\AddIns\BackendBindings\CSharpBinding\Project\Src\Project\CSharpProject.cs:line 64
    at CSharpBinding.CSharpProject..ctor(ProjectCreateInformation info) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\AddIns\BackendBindings\CSharpBinding\Project\Src\Project\CSharpProject.cs:line 56
    at CSharpBinding.CSharpLanguageBinding.CreateProject(ProjectCreateInformation info) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\AddIns\BackendBindings\CSharpBinding\Project\Src\CSharpLanguageBinding.cs:line 32
    at ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.CreateProject(ProjectCreateInformation projectCreateInformation, String defaultLanguage) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Internal\Templates\Project\ProjectDescriptor.cs:line 309
    at ICSharpCode.SharpDevelop.Internal.Templates.ProjectTemplate.CreateProject(ProjectCreateInformation projectCreateInformation) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Internal\Templates\Project\ProjectTemplate.cs:line 395
    at ICSharpCode.SharpDevelop.Project.Dialogs.NewProjectDialog.OpenEvent(Object sender, EventArgs e) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\Base\Project\Src\Gui\Dialogs\NewProjectDialog.cs:line 353
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    —- Recent log messages:
    Failed to append recent log messages.
    System.InvalidOperationException: Sequence contains no elements
    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
    at ICSharpCode.SharpDevelop.Sda.LogMessageRecorder.AppendRecentLogMessages(StringBuilder sb, ILog log) in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\LogMessageRecorder.cs:line 109
    at ICSharpCode.SharpDevelop.Sda.ExceptionBox.getClipboardString() in c:\Users\mccafferym\Downloads\SharpDevelop_3.2.1.6466_Source\src\Main\ICSharpCode.SharpDevelop.Sda\Src\ExceptionBox.cs:line 138

    —- Post-error application state information:
    Installed 3rd party AddIns:
    Workbench.ActiveContent: ICSharpCode.SharpDevelop.BrowserDisplayBinding.BrowserPane
    ProjectService.OpenSolution:
    ProjectService.CurrentProject:

  10. Thanks sorry about this, missing steps in instructions as I already made so many mods to my WinRT device. You need to copy C:\Windows\Microsoft.NEt\Framework from a Windows 8 machine DO NOT OVERWRITE ANY EXISTING FILES. You may want to back up c:\windows\microsoft.net\framework on Windows RT first. I copied the folder and chose option “skip” for existing files.You can see in error message “C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.Targets” was not found. If you see any further errors look for “not found” error, then copy said file from a windows 8 machine. Thanks, good luck.

  11. Lars says:

    Fixer ist.
    But i dont have Windows 8 , so it would be Nice if you upload tue requested Files.

  12. Lars says:

    Fixed it … stupid Auto correct -.-

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s