Visual Studio: the best way to use multiple programming languages โ€‹โ€‹for one application

I often use several programming languages โ€‹โ€‹when creating .NET applications. Usually C ++ / CLI for interacting with legacy code and C # for the rest.

With the upcoming support for F # as a first-class language, I could see that I was mixing it too.

But the only way to use several more languages โ€‹โ€‹to configure the project in one language? Does Visual Studio 2010 have improved support for this? Are there any other solutions there?

+3
source share
3 answers

I do not believe that VS2010 supports several languages โ€‹โ€‹in one project, if that is what you ask. In my opinion, it would be quite difficult, to be honest. You may have cyclical dependencies between different languages, so you cannot just call one compiler after another - they will have to work together at a fairly deep level, I suspect. Although I dare say that it will be technically feasible, I think it will be more work than value added.

+7
source

I'm really curious what you actually get by mixing so many languages โ€‹โ€‹for one product. C # has some damn good interoperability, and in general C ++ is only needed for the most extreme cases. Beyond one instance in .NET 1.1 days, when I needed to use Windows XP themes in my application, I never had to use C ++ to interact.

As for F #, it's an awesome language, but I think it still has a niche. Over the years, C # has grown to encompass the best of all worlds, including functional and dynamic language features. If you do not need the raw functional power of F #, I think that from the point of view of general programming, C # provides sufficient functionality to meet your needs.

Make sure that you REALLY benefit from mixing multiple languages. An advantage that outweighs the cost of the increased complexity of the project, the requirement that developers understand all three languages, the additional cost of maintaining the use of three languages, etc. I think that overall it is rather difficult to sell. Use one language if you can, and resort to an alternative in extreme cases when C # really, really does not offer you a solution. If you are writing an application that really needs F #, write everything in F #.

As for VS2010, which supports multiple languages โ€‹โ€‹for each project, this is not a feature that I have heard about. I think it would be very difficult to maintain this in the user interface and confuse the download. I have not heard of any add-ons that offer this feature, and I used ReSharper, SlickEdit, etc.

+3
source

Here's the function request . Until this is implemented, the hack described by Scott Hanselman is worth considering. TL DR: you create separate projects per language, but then use ILMerge (via MSBuild) to merge them into a single assembly file.

+1
source

Source: https://habr.com/ru/post/1307350/


All Articles