roslyn: Build fails on missing generated files
I’m getting such errors occasionally, when building in VS. Re-building once or twice resolves the issue. I’m still trying to get a binary log of this.
31>BasicCompilerTestUtilities -> C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Debug\Dlls\BasicCompilerTestUtilities\Roslyn.Compilers.VisualBasic.Test.Utilities.dll
32>CSC : error CS2001: Source file 'C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Obj\ServicesVisualStudioImpl\Debug\Options\GridOptionPreviewControl.g.cs' could not be found.
32>CSC : error CS2001: Source file 'C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Obj\ServicesVisualStudioImpl\Debug\Options\OptionPreviewControl.g.cs' could not be found.
32>CSC : error CS2001: Source file 'C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Obj\ServicesVisualStudioImpl\Debug\Options\Style\NamingPreferences\ManageNamingStylesInfoDialog.g.cs' could not be found.
32>CSC : error CS2001: Source file 'C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Obj\ServicesVisualStudioImpl\Debug\Options\Style\NamingPreferences\NamingStyles\NamingStyleDialog.g.cs' could not be found.
32>CSC : error CS2001: Source file 'C:\Users\jcouv\.babun\cygwin\home\jcouv\repos\roslyn\Binaries\Obj\ServicesVisualStudioImpl\Debug\Options\Style\NamingPreferences\NamingStyleOptionPageControl.g.cs' could not be found.
32>Done building project "ServicesVisualStudioImpl.csproj" -- FAILED.
Tagging @jasonmalinowski
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 4
- Comments: 18 (12 by maintainers)
Just go it again today:
I was able to overcome issue
.razor.g.cs could not be foundby shortening path toMyComponent.razorto make sure that complete path toMyComponent.razor.g.csis shorter than 255.I have experienced this issue with `Source file c:.…\very long path\obj\Debug\net5.0\RazorDeclaration\Pages\MyComponent.razor.g.cs could not be found’ and complete path was 262 chars, so I just renamed component for example to ‘Short.razor’ and the error is gone.
My team has been seeing this since porting our WPF app to .NET Core, I have found that using the “Play” button to build and run the app rarely if ever runs into this issue, but Rebuild Solution will often fail to generate the xaml .g.cs files.