Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Treat custom file extension as CSharp

$
0
0

Hi, 

I'm trying to open up files of type '.mcsx' as if they were .cs files in Visual Studio 2012 - i.e. with code completion and with rich formatting. I've tried a number of things to no avail:

1) I've tried writing a VSIX extension that registers a custom ContentType:

 static class ContentType
    {
        public const string Name = "MyCScript";

        [Export]
        [Name(Name)]
        [DisplayName("CSharp Script")]
        [BaseDefinition("CSharp")]
        public static ContentTypeDefinition MarkdownModeContentType = null;


        [Export]
        [ContentType("CSharp")]
        [FileExtension(".mcsx")]
        public static FileExtensionToContentTypeDefinition MkdFileExtension = null;

    }

2) I've also tried creating an extension package following this blog post: http://blogs.msdn.com/b/noahric/archive/2010/03/01/new-extension-css-is-less.aspx. I managed to grab the appropriate GUID from the registry and create a VSIX with just a pkgdef file with the following entries (and included it in the vsix):

[$RootKey$\Languages\File Extensions\.mcsx]
@="{A066E284-DCAB-11D2-B551-00C04F68D4DB}"

[$RootKey$\Editors\{A066E284-DCAB-11D2-B551-00C04F68D4DB}\Extensions]
"mcsx"=dword:00000028

In this case the entries appear in the registry, but I'm still not getting CSharp completion for my mcsx files. Can anyone help me?


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>