Closed bouchraRekhadda closed 3 weeks ago
This doesn't repro in 8.0.1xx but does in 8.0.2xx onwards - @333fred I don't see the RazorLangVersion parameter on the Csc Task bundled in the 8.0.2xx SDK at all - have you seen anything like this before?
@bouchraRekhadda can I ask why you set this property? Disabling this generation mechanism renders all of the Roslyn Analyzers and Source Generators in use in your project nonfunctional - they all rely on this mechanism to get data from the build. When you toggle this you fundamentally alter the code the compiler generates for your project in a way that is very hard (read: near impossible) to recreate.
This doesn't repro in 8.0.1xx but does in 8.0.2xx onwards
Ok thank you for info; my bad I haven't tested on 8.0.1xx.
can I ask why you set this property? Disabling this generation mechanism renders all of the Roslyn Analyzers and Source Generators in use in your project nonfunctional
As mentioned in web-sample#Description we have disabled this property as it fails our CI/CD builds because MSBuild is unable to generate the file : paths are too long exceeding 260 characters. We were OK with disabling this mainly because we have disabled Roslyn analyzers during build and more importantly we were (and still) unable to shorten our +800 projects paths in the repository (projects are structured under several folders following a business logic that would be hard to change).
Ok, so then the request here is for the Roslyn targets to create this file using a shorter name. We've got some prior art in MSBuild that the Roslyn team can ping us for, but I'll transfer this to Roslyn for followup there and that team can reach out if they'd like the pointers.
Ok, so then the request here is for the Roslyn targets to create this file using a shorter name
That and understanding why this wasn't an issue on .NET 6 or 8.0.1xx SDKs
@jjonescz may be able to shed some light on that - my guess is that this diagnostic changed or wasn't enabled on those versions. New generators and analyzers are changed with every release, it's not something I'd worry too much about.
my guess is that this diagnostic changed or wasn't enabled on those versions
Yes, this diagnostic was broken at some point and fixed in https://github.com/dotnet/razor/pull/9605.
Can I ask why you can't turn on long path support in your CI/CD? I'd need to see the specific paths involved here, but I don't think we can really change much about them here. I expect the file name is <project path>\.globalconfig
, and there's not exactly room for changing that.
I expect the file name is
.globalconfig, and there's not exactly room for changing that.
The path is <ci/cd_path>\.build\obj\net6.0-windows\<project>\x64\Release\net6.0-windows\<project>.GeneratedMSBuildEditorConfig.editorconfig
.
(PS: the obj\net6.0-windows
is something we have customized for another reason)
@bouchraRekhadda It's possible to control the output location of the generated config file via the <GeneratedMSBuildEditorConfigFile>
property. I would suggest you set it to something shorter, but ensure its unique per project so generated files don't overwrite each other. For example you might use something like
<GeneratedMSBuildEditorConfigFile>cipath\.build\$(MSBuildProjectName).gen.config</GeneratedMSBuildEditorConfigFile>
Completely disabling the file will cause the Razor generator to break in unexpected ways even if we didn't have the LangVersion error.
Going to close this out as by-design.
Building an ASP .NET Core project with
<GenerateMSBuildEditorConfigFile>false</GenerateMSBuildEditorConfigFile>
using .NET SDK produces the errorTo Reproduce
A reproduction sample is available at https://github.com/bouchraRekhadda/web-sample, to reproduce, make sure you build using .NET 8 SDK :
dotnet build WebProject.csproj
Excpected behavior
Actual behavior
Further technical details
dotnet --info