如何创建基于F#的Visual Studio加载项? [英] How to create a F# based Visual Studio Add-In?

查看:108
本文介绍了如何创建基于F#的Visual Studio加载项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使安装了F#,Visual Studio 2008(可能还有2010)也仅提供用于C#,VB.NET和C ++的加载项项目模板.

Even with F# installed, Visual Studio 2008 (and probably 2010) only provides Add-In project templates for C#, VB.NET and C++.

那么,如何创建基于F#的加载项?

So, how to create a F# based Add-In?

我尝试使用实现IDTExtensibility2的新类创建F#类库项目,设置正确的引用(EnvDTE,Extensibility等),从C#加载项(主要是命令行)中复制一些项目属性进行调试),并手动创建.AddIn清单文件,但没有成功.启动VS时,可用插件中未列出我的加载项.

I have tried to create a F# class library project with a new class implementing IDTExtensibility2, setting the correct references (EnvDTE, Extensibility, ...), copying a few project attributes from the C# Add-In (mainly the command line for debugging), and creating the .AddIn manifest file by hand, but no success. When VS is launched, my Add-In is not listed in the available ones.

缺少哪些步骤?在某处进行某种COM注册?

What are the missing steps? Some kind of COM registration somewhere?

推荐答案

我终于发现问题出在哪里:我只是忘记将.AddIn文件放在AddIn目录中(C#向导会自动执行此操作).

I finally found what went wrong: I simply forgot to put the .AddIn file in the AddIn directory (the C# wizard is doing this automatically).

因此,要为Visual Studio创建基于F#的加载项,

So, to create a F# based Add-In for Visual Studio:

  • 创建一个新的F#类库项目
  • 在项目中添加一些参考程序集(主要是EnvDTE,EnvDTE80,EnvDTE90,可扩展性)
  • 创建一个实现IDTExtensibility2的新类
  • 将基于C#的加载项项目的调试属性复制到F#项目中
  • 复制.AddIn清单文件,并根据您的F#项目对其进行修改 * ..并且不要忘记将该新文件复制到用户会话的AddIn目录中
  • 享受!
  • Create a new F# class library project
  • Add a few reference assemblies to the project (mainly EnvDTE, EnvDTE80, EnvDTE90, Extensibility)
  • Create a new class implementing IDTExtensibility2
  • Copy the debugging properties of a C# based Add-In project into your F# project
  • Copy the .AddIn manifest file, and modify it according to your F# project *.. and don't forget to copy that new file in the AddIn directory for the user session
  • enjoy!

这篇关于如何创建基于F#的Visual Studio加载项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆