Closed BenedekFarkas closed 3 months ago
I have two questions: Why is this pinning the LangVersion? Do we need this package in so many projects?
I have two questions: Why is this pinning the LangVersion? Do we need this package in so many projects?
Version pinning: The officially supported C# language version since .NET Framework 4.8 is 7.3 (and it probably won't go higher than that due to netstandard2.1
). It is possible to build a project using a higher version (because it depends on which version your VS supports), but according to Microsoft it's not recommended to go higher than that due to potential runtime issues.
Package reference: This whole saga of adding Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider
to the solution/projects serves 3 purposes - the necessary configuration has some overlap between them.
MvcBuildViews=true
, Razor files are compiled in-memory as an extra validation step (but they remain as .cshtml files, so they aren't compiled into a DLL like in ASP.NET Core). This is the pickiest out of these 3 features and every project that has Razor files needs this DLL reference (and some configuration).Made further changes and explained them in the PR description + added my previous answers there too, so they are all in one place.
Fixes #8776
Why do we need this package at all:
MvcBuildViews=true
, Razor files are compiled in-memory as an extra validation step (but they remain as .cshtml files, so they aren't compiled into a DLL like in ASP.NET Core). This is the pickiest out of these 3 features and every project that has Razor files needs this DLL reference (and some configuration).Further changes and details besides package update:
/langversion:default
that comes from the NuGet package upgrade in web.configs and set it to 7.3. The officially supported C# language version since .NET Framework 4.8 is 7.3 (and it probably won't go higher than that due tonetstandard2.1
). It is possible to build a project using a higher version (because it depends on which version your VS supports), but according to Microsoft it's not recommended to go higher than that due to potential runtime issues.<LangVersion>latest</LangVersion>
in csprojs for both the Release and Debug configuration,<LangVersion>7.3</LangVersion>
is set just once regardless of configuration.src\Orchard.Web\Modules\Orchard.Email\Services\SmtpMessageChannel.cs
to C# 7.3.<MvcBuildViews>false</MvcBuildViews>
in the csprojs that use this package until now, we don't need it anymore.CopyRoslynFilesToOutputFolder
target fromOrchard.Web.csproj
is removed, because we're using the target with the same purpose (CopyRoslynCompilerFilesToOutputDirectory
) supplied by the package.Orchard.Web
also definesRoslynToolPath
explicitly (= where the tools are copied from). Without it the tools are only copied on the 2nd-3rd rebuild for some reason.Orchard.proj
: Factored out a part of theCompile
target into theDevCompile
target and removed theBuildViews
target.DevCompile
instead ofCompile
.Compile
callsDevCompile
.BuildViews
target is not really necessary, just call any other target (Compile, DevCompile, Spec, etc.) with/p:MvcBuildViews=true
instead.