Extend Visual Studio to wrap around an external provider - visual-studio-extensions

I want to write a visual studio extension to build a wrapper around a technology outside of .Net. Essentially I am looking to create functionality similar to the "Service Reference" where the user will specify a resource and my extension will build a .Net wrapper around that resource.
I read this question which references the article Create custom editors and designers. The article explains editors but despite its name barely mentions designers and never really distinguishes the two.
Also, the article has a line that makes me think that writing an editor may not be what I need,
Note, however, that users will not be able to use a custom editor to
edit standard Visual Studio projects.
So, in order to make a custom editor I have to make my own project type? What if I want my extension to be usable in any project type?
I would appreciate any direction that can be provided. I have extensive .Net experience, but am new to writing VS Extensions. I am building in visual Studio 2019 RC.

Related

ReSharper actions not working while editing individual file

I've been asked to make some changes to an old ASP site, and I've been editing individual ASP files in VS (I don't have the original project file). However, I'm finding that none of my favorite ReSharper actions (like Selection Extend/Shrink) are firing while editing that individual ASP file. I know this feature is supported in ASP, and they work when I'm editing C# files as part of a larger project.
Do these features only work when the ASP file is opened as part of an ASP.NET project? Is there something else incorrectly configured?
I'm using R# 7.1.3 C# Edition and VS 2012 Ultimate (11.0.61219.00). Thanks!
Update 1
I just tested opening a C# file from VS without opening the C# Project file. I was NOT able to use the ReSharper features. Perhaps a project file truly is required?
ReSharper doesn't know anything about Classic ASP, which means there's a lot of functionality it just can't implement. For example, "extend selection" - extend to what? Because it doesn't know what the file format is, it has no way of knowing what code construct the selection should be extended to.
In a similar vein, it can't offer full functionality for known file types, such as C#, unless they're in a project, because the project gives it so much context. For example, all the types you're using are defined in assemblies that are referenced in the project, so without a project, you don't get the assemblies, you don't get any known types, so you don't get code completion.

Single Page Application Project Templates for.NET 4.5 and Angular

Has there ever been a more confusing/difficult time to be a web developer using the Microsoft stack? That's not really my question... I know that the answer is a categorical no. :)
The single page app template that comes with VS 2013 is deplorable.
I've been working on building up a similar project template that uses Angular JS on the client, but I'm starting to spin my wheels a bit porting over the external (openId/oauth) login features.
I believe this is because of the lack of good, single-point-of-truth, and current documentation for Katana's auth/security bits and also because of how unreadable the client side code is in the S.P.A. template in visual studio 2013.
I know that I can get through it, but while I'm struggling with it, I'm wondering:
Are there any good community provided project templates or example code bases in existence that use .NET 4.5 (MVC5/Web Api 2), Angular JS, the new ASP.NET Identity stuff, and the Katana packages?
There's HotTowel.Angular, but it takes no stance on security. Besides, it's a Nuget package, which can't or shouldn't dictate as much as a proper project template can.
I agree with your observations. I have found the following setup that seems to meet your requirements and I think works very well (I don't have a template), I would suggest the following:
Create an empty WebApi2 project and adopt authentication/authorization depicted here
Use a regular index.html in the base directory as a launching point for your angular application. You can either maintain your client packages with nuget, npm, or bower.
Use whatever technique you like for organization of client code.
Personally, I would create 3 projects, One for client code, (mydomain.com) One for your api (api.mydomain.com) and one for your Model/Repository/Data Access layer.
update
Here is an open-source project that might be what you're looking for!

ASP.NET MVC 3: can I combine C# Razor Views with F# Controllers?

I figure this is a straight forward question, and I think there is a good chance the answer is "yes" (while mixed-language projects are generally not possible, it seems to me that the View Engine gets special treatment). I know I could also try this out pretty easily myself, but for the record, and to save myself some time, I'd like to know if this combination is possible (I've not used ASP.NET MVC or Razor myself yet, I'm considering options for a new project at work).
Edit: I am particularly interested in whether this combination is possible within a single project. Or more specifically whether there are any feature losses using this combination (even if the two project setup is the way to go).
You can definitely mix a C# Razor code with F# controllers. It may be possible to do this in a single project (by modifying the web project to use F#). An easier alternative is to create a standard C# Razor Web project and a separate F# project (containing model and controller code).
I created a Visual Studio template that allows you to do exactly this.
Unfortunatelly, the template is not yet available on Visual Studio Gallery (so you cannot see it from "Online Templates" tab in "New Project" dialog). There is some issue with their upload mechanism, that I'm trying to resolve, so it should hopefully appear there soon. There are also several ASP.NET MVC templates by Daniel Mohl on Visual Studio Gallery, but I'm not sure if any of them uses Razor.

Where can I find a clean API for Visual Basic development?

I am completely new to ASP.NET programming, and was asked to work on a small project involving ASP.NET, VB (which I am new to as well) and Microsoft SQL Server 2005.
Being used to php/java I was hoping to find some kind of similar API to php.net and the javadoc. It would be very useful to have as I would prefer to work with a text editor, instead of using DreamWeaver or Visual Web Developer.
In the project I basically only need to use ASP.NET to read from a SQL 2005 database and write to JSON files. Could anyone please give me some pointers on where to find a clean and decent API to work with? I would also appreciate any input and tips I could get to get started working on this.
I would prefer to work with a text editor, instead of using DreamWeaver or Visual Web Developer.
Imo this is a mistake in .Net. The platform was built with the IDE in mind. You really will be able to get a lot more done, and do it better, if you let yourself learn to use Visual Studio.
That said, the place to look for .Net documentation is, of course, the MSDN Library. Maybe start on this page:
http://msdn.microsoft.com/en-us/library/w0x726c2.aspx
only need to use ASP.NET to read from a SQL 2005 database and write to JSON files
You might want to take a look at ASP.NET MVC.
You controllers can return a JsonReasult which will automatically result in JSON being sent. No need to define any markup.
"Could anyone please give me some
pointers on where to find a clean and
decent API to work with?"
If you want to develop a VB.NET application, you have to use the VB.NET programming language; there are no other APIs available.
Where does javadoc fit into this? That's just markup you apply to your source code to create documentation. .NET has its own system which works in the same way but is built on XML.
As Joel says, Visual Studio has everything you need. It features a visual editor but also gives you access to all the source code.
you will need to have the IDE to develop ASP.Net application. It will be much easier using it. You can find docs and articles on developing on ASP.Net in this site. its a nice one.
https://web.archive.org/web/20211027112438/https://aspnet.4guysfromrolla.com/default.aspx#Tools2
https://web.archive.org/web/20210513213529/http://aspnet.4guysfromrolla.com/articles/042705-1.aspx
https://web.archive.org/web/20210802161558/https://aspnet.4guysfromrolla.com/articles/110905-1.aspx
work on a small project involving ASP.NET, VB (which I am new to as well) and Microsoft SQL Server 2005
It might not be VB, it might be VB.Net?

Add ons in a compiled language

We are developing a CMS in ASP.NET. We love the idea of add-ons (like in Wordpress, where any developer can add a menu button or a widget) and would like to enable developers to do the same with our system.
However I think that the fact that C# is a compiled language is an obstacle in the way of add-ons.
Am I right? Or is there a way to create add-ons for a ASP.NET application?
The fact that C# is a compiled language isn't a problem at all. In fact the .NET framework should make it relatively easy to load other code (just as Java does, for the same reason). Look into the Managed Extensibility Framework, which is all about loading Add-Ons in managed code.
It's not an obstacle at all. MEF has already been mentioned, you could also use:
System.Addin
Mono.Addins
I'm not sure for ASP.NET specifically, but in the only compiled programming language I know (Objective-C/Cocoa), there's the concept of Bundles that can be loaded dynamically. I'm not sure how that works on the backend, but I'd guess that there is some similar system for C#/ASP.NET.
I don't know how it's done in Wordpress, but there should be many ways. You can allow developers to upload their assemblies with compiled code or you can allow them to upload code in C# or IronPython or anything that supported and compile it dynamically. Maybe you can use WebParts for your task.
Microsoft has created the Managed Extensibility Framework (MEF), specifically for this problem: providing .NET plugins for .NET applications. It is the framework that (future versions of) Visual Studio use for writing managed plugins.
However, please consider using a dynamic scripting language for this! Problems like this are exactly what they are specifically designed for. If you host the Dynamic Language Runtime in your application, it not only means that your users can extend the application in a scripting language, but even in any dynamic language (scripting or otherwise) for which a DLR implementation exists: Ruby, Python, Smalltalk, Scheme, JavaScript, PHP, you name it. Biggest disadvantage: the DLR hasn't been released yet.
In C#, you can create any assemblies, link them as DLL files and then do whatever you want.
The usual case would be to define some kind of Plugin Interface which must be implemented by all the plugins.
Then you can load all plugins from the filesystem (by iterating over the plugin DLLs), find the class inside which implements the interface, instantiate it and work with it.
If you want to provide plugins with unloadability and security, you could create an application domain and load the plugins to that, increasing complexity, but also increasing stability (a bad plugin won't crash your app).
Please ask more specifically if you want a specific answer :-)
It's not too difficult to put hooks in place. You have to define in advance where the add-on features will appear. For example: when drawing a menu you can use reflection to search other dlls (with specific names and locations) for a "BuildMenu" function. You'll be defining the API for this function signature. It may have to return a list of items to be added to the base menu items collection.

Resources