Skip to content

.NET: Fix sample resource path resolution#3952

Open
westey-m wants to merge 1 commit intomicrosoft:mainfrom
westey-m:samples-resource-path-fix
Open

.NET: Fix sample resource path resolution#3952
westey-m wants to merge 1 commit intomicrosoft:mainfrom
westey-m:samples-resource-path-fix

Conversation

@westey-m
Copy link
Contributor

Motivation and Context

The samples were working when run from Visual Studio, but failing when using dotnet run due to the difference in the path from which they were executed.

Description

  • Change resource resolution to be relative to the executable's path.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings February 16, 2026 12:40
@github-actions github-actions bot changed the title Fix sample resource path resolution .NET: Fix sample resource path resolution Feb 16, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates .NET GettingStarted workflow samples to load text resources relative to the executable output directory (instead of the current working directory), fixing failures when running via dotnet run.

Changes:

  • Switch resource file loading from a relative path (Resources/...) to Path.Combine(AppContext.BaseDirectory, "Resources", ...) across affected samples.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
dotnet/samples/GettingStarted/Workflows/SharedStates/Resources.cs Reads resources from the app base directory to work under dotnet run.
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/Resources.cs Same base-directory resource resolution change for this sample.
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/Resources.cs Same base-directory resource resolution change for this sample.
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/Resources.cs Same base-directory resource resolution change for this sample.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants