I suggest you ...

Support more than one .NET language within a project

I would like to use C# or VB.NET along side F# within the same project without being forced to place that code in it's own project. The language of each code file would be determined by it's file extension as it is now. They all compile to IL, so it shouldn't be a problem to link them all together into one DLL.

For backwards compatibility with existing .csproj, .vbproj and .fsproj files, there would probably need to be a new project format -- something like .netproj that would support multiple language code files.

182 votes
Sign in
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Dennis shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Password icon
Signed in as (Sign out)
  • Benjamin Holland commented  ·   ·  Flag as inappropriate

    I'd love this. If you're working with interop having the ability to write in C++/cli instead of guessing at pinvoke function signatures would save thousands of hours on boilerplate and debugging. Sequential data processing is much easier to read in F# (Though LINQ is pretty good), and I'd love to be able to write certain parts of code in IronPython or javascript, especially if it's something that needs to be done quick and dirty. And for those performance bottlenecks, Pure IL or Inline IL would be amazing! Just...DO IT ALREADY.

  • Jonas N commented  ·   ·  Flag as inappropriate

    I would love this, especially to mix C# and F#. F# is perfect for some math-intensive scenarios, but unwieldy in others. I don't really understand why it hasn't become a feature already since, as you say, it all compiles to IL anyway, and the mixed code would reside within the same root namespace, etc.

  • Hyuntae commented  ·   ·  Flag as inappropriate

    I want this too. I want to use C++/CLI, C#, and F# in one project (not in multiple projects in one solution).

  • Luis Francisco Ramirez Daza Gonzalez commented  ·   ·  Flag as inappropriate

    "ONE ASP.NET" ??????
    So why don't we have a "ONE LANGUAGES"

    Please at least do it for C# + VB
    I think if you now have Roslyn it couldn't be so hard to do it.

    1- I have some T4 templates that want to use in my project, but some of them generate code in C# only and others generate code in VB.NET only, so I neeed to moce each T4 to a separated project and copile de DLL and then IL Merge it back or traslate C#->VB or viceversa.

    2- In ASP.NET we want to use VB.NET as the code behind language, but use C# for the Razor pages (because I think Razor was claerly designed with C# in mind as the deault language and using VB.NET in razor is more clumsy.

  • Dennis commented  ·   ·  Flag as inappropriate

    If this also supported partial class definitions across languages, then I would use it for those times when I just want to use VB.NET's XML Literals within a couple methods of a class that's in a C# project.

  • Philippe commented  ·   ·  Flag as inappropriate

    And it would be really nice if C++/CLI (safe or pure mode) could also be included. In that last scenario, it might be acceptable that not all C++ project options (properties) would be available.

  • Stephan Tolksdorf commented  ·   ·  Flag as inappropriate

    If supporting multiple languages within one project is too difficult, please consider improving the Visual Studio support for .netmodules and/or for merging multiple DLLs into one.

  • H2oGuru commented  ·   ·  Flag as inappropriate

    I think this would be a valuable addition to VS. As a developer that started with VS 6.0 and had to combine a lot of code written in Fortran with Visual C, this would allow us to move forward and now migrate those Console applications with .NET web apps without having to invest months or years in rewriting legacy code. In VS 6.0 there was no issue, we could just put ant CPP or.f code in the project and VS would compile it.

  • Mark H commented  ·   ·  Flag as inappropriate

    Should be noted that you would need to enforce a strict compile order for such feature - as F# requires files to be compiled in a specific order.

  • Dennis commented  ·   ·  Flag as inappropriate

    I mentioned this idea to a friend who is a Microsoft MVP in Client Application Development. He told me that MSBuild does support doing this. That's even more reason to support it within Visual Studio for all projects.

  • Andrew Teebay commented  ·   ·  Flag as inappropriate

    I've always thought this would be a godd idea, especially when getting examples of the internet. Often these are only in C# or VB and not both. Having to translate them is not that hard but why should I have to. It would seem to me that everything is in place to allow either in teh same project (and can infact be done in WebSite projects) so why not allow it in any project?

  • Simon Jones commented  ·   ·  Flag as inappropriate

    You can already have multiple projects in a solution, each project in a different language.

    Are you asking to mix languages within in one Project?

Feedback and Knowledge Base