Skip to content

Conversation

JoeRobich
Copy link
Member

@JoeRobich JoeRobich commented Sep 17, 2025

Related to dotnet/vscode-csharp#8626

Do not rely on TFMs and MSBuild properties that do not exist in older SDKs.

Do not rely on TFMs and MSBuild properties that do not exist in older SDKs.
<Project>
<PropertyGroup>
<IncludeProjectNameInArtifactsPaths>false</IncludeProjectNameInArtifactsPaths>
<ArtifactsPath>{SecurityElement.Escape(artifactsPath)}</ArtifactsPath>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArtifactsPath was added in .NET 8 but our BuildHost supports back to .NET 6.

var artifactsPath = GetArtifactsPath(documentFilePath);

var targetFramework = Environment.GetEnvironmentVariable("DOTNET_RUN_FILE_TFM") ?? "net10.0";
var targetFramework = Environment.GetEnvironmentVariable("DOTNET_RUN_FILE_TFM") ?? "net$(BundledNETCoreAppTargetFrameworkVersion)";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BundledNETCoreAppTargetFrameworkVersion is part of each SDK. For .NET 10 it is 10.0

@RikkiGibson
Copy link
Member

This looks good and I'm ok with closing my PR #80291. I'm going to try to manual test this solution today to get some sense of whether it will fix the user's scenario.

@RikkiGibson
Copy link
Member

I performed the following steps:

  • spun up a clean VM
  • installed the C# extension
  • downloaded the LS package from the CI run from this PR
  • installed .NET 6.0.321 SDK (from the bug report)

and I have rich misc files, and no unexpected bin/ or obj/ directories.

image

I am still a bit concerned about a potential maintenance burden here. It might turn out that the simple misc files behavior works out better for people on old SDKs, if spurious diagnostics pop up, or things are treated as FBPs instead of as members of projects in a way that is confusing for people, etc.

However, again, I am ok with sticking with this approach for now and getting this merged, particularly to address a bad behavior people are seeing with old SDKs.

@JoeRobich JoeRobich merged commit 990c727 into main Sep 18, 2025
26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Sep 18, 2025
333fred added a commit that referenced this pull request Sep 18, 2025
* upstream/main: (206 commits)
  Remove bogus xlf tag (#80357)
  Fix missing type argument checks
  Add tests
  Use dotnet run file for generating compiler code (#80248)
  Only restore based on assets file changes if the actual content changed (#80341)
  make expressionbody analyzer use semanticspananalysis (#80339)
  [EnC] Use ignoreAssemblyKey: false to resolve symbol keys (#80342)
  Properly populate ExportedType metadata table in presence of extension block. (#80311)
  Propagate `params` to lambdas and local functions (#79880)
  Change 17.15 to VS 2026 preview. (#80325)
  Improve virtualproject support for older .NET SDKs (#80324)
  Update dependencies from https://github.com/dotnet/dotnet build 283666 (#80344)
  Update dependencies from https://github.com/dotnet/arcade build 20250917.6 (#80343)
  Simplifying
  Fix tests
  Fix tests
  Fix introduce variable placement in top level statements
  move to immutable types in signature help
  move to immutable types in signature help
  Fix check
  ...
333fred added a commit to 333fred/roslyn that referenced this pull request Sep 18, 2025
* upstream/main: (31 commits)
  Remove bogus xlf tag (dotnet#80357)
  Fix missing type argument checks
  Add tests
  Use dotnet run file for generating compiler code (dotnet#80248)
  Only restore based on assets file changes if the actual content changed (dotnet#80341)
  make expressionbody analyzer use semanticspananalysis (dotnet#80339)
  [EnC] Use ignoreAssemblyKey: false to resolve symbol keys (dotnet#80342)
  Properly populate ExportedType metadata table in presence of extension block. (dotnet#80311)
  Propagate `params` to lambdas and local functions (dotnet#79880)
  Change 17.15 to VS 2026 preview. (dotnet#80325)
  Improve virtualproject support for older .NET SDKs (dotnet#80324)
  Update dependencies from https://github.com/dotnet/dotnet build 283666 (dotnet#80344)
  Update dependencies from https://github.com/dotnet/arcade build 20250917.6 (dotnet#80343)
  Simplifying
  Fix tests
  Fix tests
  Fix introduce variable placement in top level statements
  move to immutable types in signature help
  move to immutable types in signature help
  Fix check
  ...
@akhera99 akhera99 modified the milestones: Next, 18.0 P1, 18.0 P2 Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants