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.
8 comments
-
Michael Siroen
commented
A different setup you could use is making multiple assemblies and stitch them together with ILMerge ( http://research.microsoft.com/en-us/people/mbarnett/ILMerge.aspx ).
Although you still have multiple 'working projects', the resulting assembly is just one DLL.
-
Philippe
commented
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
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
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
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
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
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
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?