4

Well I want to add support for the PAWN language to Visual Studio 2012.

But because of the lack of experience and lack of tutorials/add-ins which I can edit it's really a difficult task.

For now I only want to add the filetypes and compiler, no need for intellisense and for syntax highlighting the C syntax highlighter can be used.

I know there is the OOK Language implementation and Boo Language but those add-ins are for VS2010 and won't compile for VS2012.

How would I accomplish this?

Is there a language add-in (for VS2012) which I can edit/use as base/ use as example?

My last attempt resulted in a black window / unusable VS2012 IDE.

  • stackoverflow for Visual Studio 2010 with links for Boo. http://stackoverflow.com/questions/4283072/how-to-create-a-new-language-for-use-in-visual-studio – Richard Chambers Dec 30 '12 at 03:16
  • boo stuf won't compile on/for VS2012 :( –  Dec 30 '12 at 03:26
  • I understand that boo stuff will not compile for VS2012 however the material may be a starting place for understanding and some of the concepts and methods may transfer to VS2012. – Richard Chambers Dec 30 '12 at 03:28
  • looks nice but I prefer to have some .sln or .vbproj .csproj files so I can just open it and see how the structure of the whole project/solution is. I'm not a cmake / make user :( anyway will give a nice bounty tomorrow as I see this question doesn't really have enough attention :/ –  Dec 30 '12 at 22:26

2 Answers2

18

The official language extension sample for Visual Studio 2010 was the Iron Python Integration sample.

You can download it from here: IronPython Integration. There is a related documentation here: Visual Studio IronPython Integration Deep Dive

Unfortunately this sample was not updated for Visual Studio 2012 to my knowledge. However here are the steps to convert it to Visual Studio 2012.

  1. install the Visual Studio 2012 SDK from here: Microsoft Visual Studio 2012 SDK
  2. download the Iron Python integration sample, extract somewhere on your disk
  3. open IronPython.sln, and accept all upgrade conversions
  4. change the projects' platform target from AnyCpu to x86
  5. some projects have incorrect (auto hinted) references to Visual Studio 11 assemblies (built against .NET 4.5), so they won't compile as is. Change them back to Visual Studio 10 assemblies. Example, Microsoft.VisualStudio.ExtensibilityHosting.dll in the IronPython.Console projet needs to point to the equivalent file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies.
  6. define the IronPython.Project project as the start up project, and update it's Debug parameters: the start action needs to start the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe (VS 2012 shell) external program instead of the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe (VS 2010 shell) one that was set by default. Command line arguments should be set to /RootSuffix Exp
  7. update all base templates to use VS 2012 directories instead of only VS 2010 ones: search for the IronPython.targets string in all .pyproj file and add the VS 2012 case, like this:

before:

  <PropertyGroup>
    <!-- Set the IronPythonPath property by proving in different locations where Iron Python could be installed -->
    <!-- Regular LocalAppData -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
    <!-- Experimental LocalAppData -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
      <!-- Integrated Shell -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(MSBuildExtensionsPath)\Microsoft\IronPython Studio 2010\1.0\IronPython.targets')">$(MSBuildExtensionsPath)\Microsoft\IronPython Studio 2010\1.0</IronPythonPath>
  </PropertyGroup>

after:

  <PropertyGroup>
    <!-- Set the IronPythonPath property by proving in different locations where Iron Python could be installed -->
    <!-- Regular LocalAppData -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\10.0\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
    <!-- Experimental LocalAppData -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\10.0Exp\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
      <!-- Regular LocalAppData VS10212 -->
      <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\11.0\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\11.0\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
      <!-- Experimental LocalAppData VS2012-->
      <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(LocalAppData)\Microsoft\VisualStudio\11.0Exp\Extensions\Microsoft\IronPython\1.0\IronPython.targets')">$(LocalAppData)\Microsoft\VisualStudio\11.0Exp\Extensions\Microsoft\IronPython\1.0</IronPythonPath>
      <!-- Integrated Shell -->
    <IronPythonPath Condition=" '$(IronPythonPath)' == '' AND Exists('$(MSBuildExtensionsPath)\Microsoft\IronPython Studio 2010\1.0\IronPython.targets')">$(MSBuildExtensionsPath)\Microsoft\IronPython Studio 2010\1.0</IronPythonPath>
  </PropertyGroup>

That's it. Compile and run (both can take a while the first time due to registration mysteries).

Here is the result when starting a new Iron Python project from Visual Studio 2012: enter image description here

and when building: enter image description here

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • this answer's totally what I was looking, You sir deserve a gold medal :) –  Jan 08 '13 at 14:09
  • Nice work +1, just a quick comment for anyone download the 'prepared solution', you still have to update the templates to point to correct target paths. – Erti-Chris Eelmaa Mar 04 '14 at 14:00
  • This was exactly the lainching framework I was looking for THANK YOU! A heads up to anyone coming across this...if like me you were using VS 2013 you'll need to install 2012 and 2010 and each SDK respectively. Further see this SO question I posted. Turns out the prepared solution at the end of the answer didn't quite match everything up for me. http://stackoverflow.com/questions/24459310/vs-2012-project-compile-errors-over-seven-missing-cs-files – GPGVM Jun 27 '14 at 22:01
5

Take a look at this CodeProject article Developing extension packages using C# and source that appears to have been updated for Visual Studio 2012 as well as older versions of Visual Studio.

Here is an article from Microsoft on the subject of Creating an Add-in.

Here is a second CodeProject article, part of a series Extending Visual Studio Part 2 Creating Addins.

Richard Chambers
  • 16,643
  • 4
  • 81
  • 106
  • +1 for finding the codeproject stuff etc, good answer but not the kind of answer I was expecting –  Dec 30 '12 at 22:27