[BUG] $(SolutionDir) is not set when building or debugging a project from Solution Explorer #1105
Labels
area-dotnet-debugging
Issues around .NET Debugging with console, ASP.NET, or Aspire
area-project-cps
bug
Something isn't working
Milestone
Describe the Issue
Running a single project from the solution explorer does not set the
SolutionDir
property for the built project.The term 'Solution Explorer' implies that a solution file is present.
So when building or running a project from the solution explorer,
SolutionDir
should be set for the built project.Steps To Reproduce
Open Visual Studio Code in an empty folder
Create a solution
Create a project
Add the project to the solution
Create
./Demo/DemoImport.props
with the following contentImport
./Demo/DemoImport.props
into the project by adding the following lineRight click
DemoProject
in the Solution Explorer and selectDebug
->Start New Instance
The build then fails with MSB4019 stating that
X:/DemoImport.props
could not be found.This is because
$(SolutionDir)
evaluates to an empty string which leads to the remaining path/DemoImport.props
being interpreted as an absolute path.The same happens when you right click the solution and select
Clean
and then right click the project and selectBuild
.This does not occur when right clicking the project and selecting
Rebuild
.Selecting
Build
orRebuild
on the solution works as well.Expected Behavior
DemoProject builds and then runs.
During the build it prints
Hello, Demo!
.When running it prints
Hello, World!
.Environment Information
The text was updated successfully, but these errors were encountered: