8776: Upgrade Microsoft.CodeDom.Providers.DotNetCompilerPlatform to latest version (#8777)

* Upgrading projects, code generation templates and Specflow app to use Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1.0 (latest)

* Updating csprojs not to define LangVersion separately in Release and Debug mode, setting it to "default" instead of "latest"

* Restricting C# language version to 7.3

* Downgrading SmtpMessageChannel.cs to C# 7.3

* Setting MvcBuildViews = false in the remaining csprojs that reference DotNetCompilerPlatform, like the others

* Setting RoslynCopyToOutDir = false in each csproj that references DotNetCompilerPlatform

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

* We don't actually need <MvcBuildViews>false</MvcBuildViews> in csprojs

* Orchard.Web: Copying Roslyn files to the output folder using the provided target (CopyRoslynCompilerFilesToOutputDirectory) instead of our custom one

* Orchard.proj: Factoring out a part of the Compile target into the DevCompile 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"

* Removing incorrect comment about Razor IntelliSense

* Removing VBCodeProvider configuration from Web.config files

* Getting rid of Microsoft.CodeDom.Providers.DotNetCompilerPlatform.targets imports and associated configuration except in Orchard.Web.csproj

* Adding VB compiler configuration to src/Orchard.Web/Web.config, because it would be readded on rebuild by the imported target anyway
This commit is contained in:
Benedek Farkas
2024-04-04 14:35:29 +00:00
committed by GitHub
parent 5aaf46bcde
commit fb1aa73475
218 changed files with 359 additions and 1056 deletions

View File

@@ -126,30 +126,26 @@
</Target>
<Target Name="Compile">
<CallTarget Targets="DevCompile"/>
<!-- Compile to "OutputFolder" -->
<MSBuild
Projects="$(Solution)"
Targets="Build"
Properties="Configuration=$(Configuration);OutputPath=$(CompileFolder);MvcBuildViews=false" />
Properties="Configuration=$(Configuration);OutputPath=$(CompileFolder)" />
</Target>
<Target Name="DevCompile">
<!-- To make sure that Roslyn tools are available, since it's included with Orchard.Web, which is not referenced by
other projects, so it will be built towards the end. -->
<MSBuild
Projects="$(OrchardWebFolder)\Orchard.Web.csproj"
Targets="CopyRoslynCompilerFilesToOutputDirectory" />
<!-- Compile to "regular" output folder for devs using VS locally -->
<MSBuild
Projects="$(Solution)"
Targets="Build"
Properties="Configuration=$(Configuration);MvcBuildViews=$(MvcBuildViews)" />
</Target>
<Target Name="BuildViews">
<!-- To make sure that Roslyn tools are available, even if the Compile task was not called before this. -->
<MSBuild
Projects="$(OrchardWebFolder)\Orchard.Web.csproj"
Targets="CopyRoslynFilesToOutputFolder"
Properties="Configuration=$(Configuration)" />
<!-- The actual compilation with views also compiled. -->
<MSBuild
Projects="$(Solution)"
Targets="Build"
Properties="Configuration=$(Configuration);MvcBuildViews=true" />
</Target>
<Target Name="CompileMsBuildTasks">
<MSBuild
@@ -212,7 +208,6 @@
<Stage-Media Include="$(SrcFolder)\Orchard.Web\Media\OrchardLogo.png" />
<Stage-PoFiles Include="$(SrcFolder)\Orchard.Web\**\*.po" />
<Stage-Core Include="$(WebSitesFolder)\Orchard.Core\**\*" Exclude="$(WebSitesFolder)\Orchard.Core\**\bin\**\*" />
<Stage-Roslyn Include="$(SrcFolder)\Orchard.Web\bin\roslyn\*" />
<!-- Get list of module names from the module definition files within ModulesSrcFolder -->
<Stage-Modules-Definitions Include="$(ModulesSrcFolder)\**\Module.txt" />
@@ -254,7 +249,7 @@
<!-- Copying module binaries is somewhat tricky: From a module "bin" directory, we
only want to include the files that are _not_ already present in
the "Orchard.Web\Bin" folder (except for "Orchard.Web\bin\roslyn"). -->
the "Orchard.Web\Bin" folder. -->
<FilterModuleBinaries
ModulesBinaries="@(Stage-Modules-Binaries)"
OrchardWebBinaries="@(Stage-Orchard-Web-Bins)">
@@ -284,7 +279,6 @@
<Copy SourceFiles="@(Stage-Themes-Custom)" DestinationFiles="@(Stage-Themes-Custom->'$(StageFolder)\Themes\%(ThemeName)\%(RecursiveDir)%(Filename)%(Extension)')"/>
<Copy SourceFiles="@(Stage-Themes-Binaries-Unique)" DestinationFiles="@(Stage-Themes-Binaries-Unique->'$(StageFolder)\Themes\%(ThemeName)\%(RecursiveDir)%(Filename)%(Extension)')"/>
<Copy SourceFiles="@(Stage-Themes-Sources)" DestinationFolder="$(StageFolder)\Themes\%(RecursiveDir)"/>
<Copy SourceFiles="@(Stage-Roslyn)" DestinationFolder="$(StageFolder)\bin\roslyn"/>
<MakeDir Directories="$(StageFolder)\App_Data"/>
<WriteLinesToFile File="$(StageFolder)\App_Data\_marker.txt" Lines="some_text" Overwrite="true"/>