-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8776: Upgrade Microsoft.CodeDom.Providers.DotNetCompilerPlatform to latest version #8777
Conversation
… Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1.0 (latest)
…Debug mode, setting it to "default" instead of "latest"
This reverts commit 143eefd.
I have two questions: |
@@ -7,7 +7,8 @@ | |||
<!-- Registering Roslyn as a compiler for Razor IntelliSense. --> | |||
<system.codedom> | |||
<compilers> | |||
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:latest" /> | |||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" compilerOptions="/langversion:7.3 /nowarn:1659;1699;1701;612;618" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> | |||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\"Web\" /optionInfer+" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add VB compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's added automatically when you install/update the package. We can remove it, but it doesn't do anything and leaving it there makes updating this package through VS NuGet package management easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will trust you. I feel like this was removed for a reason though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, you're right that it's unnecessary (but it doesn't affect anything), but it was easy to get rid of them, so it's better without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got rid of other stuff too from all the csprojs (other than Orchard.Web.csproj) that we don't actually need, but they will be re-added automatically when we update the package again through VS, so we can just not commit those changes.
On the other hand, I've re-added the VB compiler configuration to Orchard.Web's Web.config, because rebuilding the solution restores it, but that's OK, it doesn't do anything.
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 Package reference: This whole saga of adding
|
… DotNetCompilerPlatform, like the others
…NetCompilerPlatform See https://github.com/aspnet/RoslynCodeDomProvider?tab=readme-ov-file#build-time-options - We only need Orchard.Web to include the Roslyn tools in its bin folder, the other csprojs only need the DLL reference - We could simply remove the targets import in these csprojs, but it will be re-added when the package is updated, so this is cleaner/easier
…ided target (CopyRoslynCompilerFilesToOutputDirectory) instead of our custom one
…Compile target and removing BuildViews target - For a simple local build (just to validate that the solution builds), we don't actually need that second build that copies files to the output folder. - CI builds (Test, Spec, etc.) that operate on the build output folder are unaffected, because Compile calls DevCompile - The BuildViews target is not really necessary, just call any other target (Compile, DevCompile, Spec, etc.) with "/p:MvcBuildViews=true"
Made further changes and explained them in the PR description + added my previous answers there too, so they are all in one place. |
This reverts commit 8c45895.
…gets imports and associated configuration except in Orchard.Web.csproj
…se it would be readded on rebuild by the imported target anyway
…n 4.1.0 in dev-only extensions too Continuation of #8777
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 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.<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.