-
Notifications
You must be signed in to change notification settings - Fork 27.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add predefined variable ${fileDirBasename} #78316
Comments
/findDuplicates |
There might be already a feature request for this, unfortunetly I can not find it. |
for this project directory structure what is this variable different than |
consider this example: /home/username/dotnet-solution1/dir1/project1/Program.cs ${relativeFileDirname} will be dir1/project1, I won't get "${fileDirname}/${fileDirBasename}.csproj" using ${relativeFileDirname} |
@kzhui125 I have added this variable to the extension Command Variable v0.7.0. In case you have a project structure
And if your current file is Then you should use {
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${input:chooseFileBasename}/${input:chooseFileBasename}.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
],
"inputs": [
{
"id": "chooseFileBasename",
"type": "command",
"command": "extension.commandvariable.file.fileAsKey",
"args": {
"/project1/": "project1",
"/project2/": "project2"
}
}
]
} You need to make the key as specific as needed. |
Could you do |
@rioj7 thanks, I will have a try. for example: my expected launch.json: /Users/test/Documents/dotnet-solution1/dir1/project1/bin/Debug/netcoreapp2.0/project1.dll my expected tasks.json: /Users/test/Documents/dotnet-solution1/dir1/project1/project1.csproj ${fileDirname} will be /Users/test/Documents/dotnet-solution1/dir1/project1 so ${fileDirname}/${relativeFileDirname}/${fileBasenameNoExtension}.csproj will be: /Users/test/Documents/dotnet-solution1/dir1/project1/dir1/project1/Program.csproj It's not as expected. |
|
But |
Ok. The feature request here is for a variable the resolves to the second to last segment of the current file's path. |
The new variable is fileDirnameBasename |
Unable to locate closing commit in issue timeline. You can manually reference a commit by commenting |
\closedWith 551db7e |
This bug has been fixed in to the latest release of VS Code Insiders! @kzhui125, you can help us out by confirming things are working as expected in the latest Insiders release. If things look good, please leave a comment with the text Happy Coding! |
Verified with
|
Hello, I have some dotnet solutions opened as my root workspace.
For example:
${workspaceFolder}:
/home/username/dotnet-solution1
${file}:
/home/username/dotnet-solution1/project1/Program.cs
/home/username/dotnet-solution1/project2/Program.cs
/home/username/dotnet-solution1/project3/Program.cs
/home/username/dotnet-solution1/project4/Program.cs
When I open Program.cs or other cs file, I want press F5 to debug the corresponding project.
So I need this ${fileDirBasename} variable.
this is my expected lanunch config:
my expected build task:
The text was updated successfully, but these errors were encountered: