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.

112 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    DennisDennis shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    Raymond TanRaymond Tan shared a merged idea: Coexist Code File in the Same Solution  ·   · 

    10 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Luis Francisco Ramirez Daza GonzalezLuis 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.

        Cases:
        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.

      • DennisDennis 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.

      • PhilippePhilippe 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 TolksdorfStephan 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.

      • H2oGuruH2oGuru 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 HMark 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.

      • DennisDennis 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 TeebayAndrew 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 JonesSimon 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