A folder in a multi-root workspace is not being resolved to the actual folder. As such, the GetProjectProperties target fails when building with dotnet.
Environment: PopOS! 22.04
Expected Behavior
${workspaceFolder:[name]}/file is replaced with [path to folder]/file before executing command dotnet build /r:false ...
Actual result
The dotnet build command executes without substitution. The command executed is dotnet build r:/false ... ${workspaceFolder:[name]}/file.
Details
I'm using a .code-workspace file to share my debugging setup with my colleagues. I'm using this because our project is structured as a monorepo, and shared libraries are located a folder or two above the current working directory. I'm unable to kick off a debug task. I receive the following error:
Unable to determine project information for target 'GetProjectProperties on project ${workspaceFolder:web}/back-end/WebProject.csproj. Process exited with code 2.
Here's my setup. Note: folder paths and project names have been changed due to confidentiality.
I went down the rabbit hole and I think the issue lies in src/utils/resolveVariables.ts. In it, there's a hard-coded if condition that's replacing the string ${workspaceFolder} instead of using the workspace API. Reproduced here:
// Starting at Line 40...
// Replace workspace folder variables
if (folder) {
switch (variable) {
case '${workspaceFolder}':
case '${workspaceRoot}':
return path.normalize(folder.uri.fsPath);
case '${userHome}':
return os.homedir();
case '${relativeFile}':
return path.relative(path.normalize(folder.uri.fsPath), getActiveFilePath());
default:
}
}
Summary
A folder in a multi-root workspace is not being resolved to the actual folder. As such, the
GetProjectProperties
target fails when building with dotnet.Environment: PopOS! 22.04
Expected Behavior
${workspaceFolder:[name]}/file
is replaced with[path to folder]/file
before executing commanddotnet build /r:false ...
Actual result
The dotnet build command executes without substitution. The command executed is
dotnet build r:/false ... ${workspaceFolder:[name]}/file
.Details
I'm using a
.code-workspace
file to share my debugging setup with my colleagues. I'm using this because our project is structured as a monorepo, and shared libraries are located a folder or two above the current working directory. I'm unable to kick off a debug task. I receive the following error:Unable to determine project information for target 'GetProjectProperties
on project${workspaceFolder:web}/back-end/WebProject.csproj. Process exited with code 2.
Here's my setup. Note: folder paths and project names have been changed due to confidentiality.
I define the multi root workspace as:
I define a launch configuration as:
And I define my build and launch tasks:
I went down the rabbit hole and I think the issue lies in src/utils/resolveVariables.ts. In it, there's a hard-coded if condition that's replacing the string
${workspaceFolder}
instead of using the workspace API. Reproduced here: