использовать версию C# в соответствии с фреймворком#1687
Conversation
📝 WalkthroughWalkthroughThis PR updates the default C# language version setting in the MSBuild project configuration file. The explicit ChangesBuild Configuration
🎯 1 (Trivial) | ⏱️ ~2 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/oscommon.targets`:
- Line 9: src/oscommon.targets sets <LangVersion>default with
<TargetFrameworkVersion>net8.0 which promotes all importing projects to C# 12
and may break or warn in many projects; build the solution and either fix C#
12-compatibility issues or explicitly pin LangVersion per-project for those that
must stay on an older compiler. Specifically: run a full build of
src/1Script.sln and all test projects, address any new C#12 errors/warnings (fix
syntax/API uses or adjust code), and for projects that must remain on earlier
versions override <LangVersion> in their .csproj (examples include
VSCode.DebugAdapter.csproj, DocumenterTests.csproj, OneScriptDocumenter.csproj,
OneScript.Dynamic.Tests.csproj, OneScript.Core.Tests.csproj,
OneScript.Web.Server.csproj) or change src/oscommon.targets to a conservative
default; ensure all fixes remove build failures and test regressions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| <Configuration Condition="'$(Configuration)' == ''">Release</Configuration> | ||
| <Platform Condition="'$(Platform)' == ''">x86</Platform> | ||
| <LangVersion>8.0</LangVersion> | ||
| <LangVersion>default</LangVersion> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find all .csproj files that import oscommon.targets
echo "=== Projects importing oscommon.targets ==="
rg -t xml '<Import.*oscommon\.targets' --glob '*.csproj' -n
echo ""
echo "=== Projects with explicit LangVersion (unaffected) ==="
rg -t xml '<LangVersion>' --glob '*.csproj' -n -C2Repository: EvilBeaver/OneScript
Length of output: 5406
🏁 Script executed:
#!/bin/bash
# Description: Attempt a full build to verify C# 12 compatibility
echo "=== Building solution to verify C# 12 compatibility ==="
# Find solution files
fd -e sln -x echo "Found solution: {}"
echo ""
echo "Note: Please run 'dotnet build' or your build command locally to verify all projects compile successfully with C# 12."Repository: EvilBeaver/OneScript
Length of output: 273
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== src/oscommon.targets (top 40 lines) ==="
nl -ba src/oscommon.targets | head -n 40Repository: EvilBeaver/OneScript
Length of output: 169
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "=== src/oscommon.targets (top 40 lines) ==="
awk '{printf "%4d\t%s\n", NR, $0}' src/oscommon.targets | head -n 40Repository: EvilBeaver/OneScript
Length of output: 2113
Major: oscommon.targets now uses LangVersion=default for net8.0 (C# 12) — verify downstream builds
src/oscommon.targets sets <LangVersion>default</LangVersion> with <TargetFrameworkVersion>net8.0</TargetFrameworkVersion>, which maps to C# 12 for net8.0. This will affect every project that imports oscommon.targets without overriding LangVersion.
Projects overriding LangVersion (so they won’t inherit the default):
src/VSCode.DebugAdapter/VSCode.DebugAdapter.csproj(7.3)src/Tests/DocumenterTests/DocumenterTests.csproj(8)src/OneScriptDocumenter/OneScriptDocumenter.csproj(8)src/Tests/OneScript.Dynamic.Tests/OneScript.Dynamic.Tests.csproj(10.0)src/Tests/OneScript.Core.Tests/OneScript.Core.Tests.csproj(10.0)src/OneScript.Web.Server/OneScript.Web.Server.csproj(10.0)
All other projects importing src/oscommon.targets will compile as C# 12, including (non-exhaustive) src/ScriptEngine/ScriptEngine.csproj, src/OneScript.Core/OneScript.Core.csproj, src/OneScript.Language/OneScript.Language.csproj, src/OneScript.StandardLibrary/OneScript.StandardLibrary.csproj, and src/oscript/oscript.csproj.
Request: ensure src/1Script.sln builds successfully with the new language version (no new C# 12 warnings/errors, and no syntax/behavior regressions).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/oscommon.targets` at line 9, src/oscommon.targets sets
<LangVersion>default with <TargetFrameworkVersion>net8.0 which promotes all
importing projects to C# 12 and may break or warn in many projects; build the
solution and either fix C# 12-compatibility issues or explicitly pin LangVersion
per-project for those that must stay on an older compiler. Specifically: run a
full build of src/1Script.sln and all test projects, address any new C#12
errors/warnings (fix syntax/API uses or adjust code), and for projects that must
remain on earlier versions override <LangVersion> in their .csproj (examples
include VSCode.DebugAdapter.csproj, DocumenterTests.csproj,
OneScriptDocumenter.csproj, OneScript.Dynamic.Tests.csproj,
OneScript.Core.Tests.csproj, OneScript.Web.Server.csproj) or change
src/oscommon.targets to a conservative default; ensure all fixes remove build
failures and test regressions.
Раз используется .NET 8.0, то почему не перейти к C#12?
Summary by CodeRabbit