I have a solution that contains five C# console application projects. I would like each project to target a different version of C#.
MyLearningSolution.sln
CSharp01.csproj
CSharp02.csproj
CSharp03.csproj
CSharp04.csproj
CSharp05.csproj
Is there a way to do this either via Visual Studio or via editing each csproj
file?
I have tried the following searches:
csproj target specific C# version, this talks about targeting a specific framework version
csproj choose c# version, doesn't answer the question
To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.
On the Build menu, click Configuration Manager. In the Active solution platform box, select the platform you want your solution to target, or select <New> to create a new platform.
This can be done by looking at the <LangVersion>
element of the csproj file. Possible values:
<LangVersion>default</LangVersion>
<LangVersion>ISO-1</LangVersion>
<LangVersion>ISO-2</LangVersion>
<LangVersion>3</LangVersion>
<LangVersion>4</LangVersion>
<LangVersion>5</LangVersion>
To do it via the UI, go to Project Properties => Build => Advanced... => Language Version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With