Skip to content
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

Running a debug/build of dotnet project when root with multiple projects #589

Closed
jrieken opened this issue Jun 21, 2016 · 6 comments
Closed
Assignees

Comments

@jrieken
Copy link
Contributor

jrieken commented Jun 21, 2016

From @eByte23 on June 12, 2016 7:29

  • VSCode Version: 1.3
  • OS Version: mac/windows

How does one setup vscode c# debugger to run and build projects when your workspace is root of git repo e.g.
/

  • src/
    • project1
    • project2
  • test
    • testproject1
      global.json

I want to be able to f5 and run which ever project i define but ever time in can't fine my project.json because it is running the build from the workspace dir, sort of like we like visual studio you set your startup project.

Could we also define workspace dir or pull workspace dir from where the current selected omnisharp project is?

I'm pretty sure this used to just work but now its a bit messy.

Possibly I am just being completely retarted but it is a little frustrating

Copied from original issue: microsoft/vscode#7572

@jrieken jrieken self-assigned this Jun 21, 2016
@jrieken jrieken added the debug label Jun 21, 2016
@jrieken
Copy link
Contributor Author

jrieken commented Jun 21, 2016

From @JimiC on June 12, 2016 13:50

launch.json has an option called cwd which sets the current working directory.

@jrieken
Copy link
Contributor Author

jrieken commented Jun 21, 2016

From @dbaeumer on June 20, 2016 19:41

@jrieken not sure if you or @isidorn @weinand

@jrieken
Copy link
Contributor Author

jrieken commented Jun 21, 2016

From @weinand on June 20, 2016 20:15

@dbaeumer C# and C# debugging are a separate extension. I suggest to always move this to https://github.com/OmniSharp/omnisharp-vscode/issues

@jrieken
Copy link
Contributor Author

jrieken commented Jun 21, 2016

From @JimiC on June 21, 2016 4:28

In VS Code you can't define the startup project for the debugger but you can set multiple configurations that correspond to each project.

Here's an example:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/src/myElectronApp/scripts/main.ts",
            "stopOnEntry": false,
            "args": [],
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "compile",
            "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
            "runtimeArgs": [
                "--enable-logging"
            ],
            "env": {},
            "externalConsole": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/src/myElectronApp/bin/resources/app",
            "windows": {
                "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
                "runtimeArgs": []
            },
            "osx": {
                "outDir": "${workspaceRoot}/src/myElectronApp/bin/Electron.app/Contents/Resources/app"
            }
        },        
        {
            "name": "Test",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/tests/myElectronApp/scripts/main.ts",
            "stopOnEntry": false,
            "cwd": "${workspaceRoot}",
            "preLaunchTask": "pretest",
            "externalConsole": false,
            "sourceMaps": true,
            "outDir": "${workspaceRoot}/tests/myElectronApp/bin"
        }
    ]
}

This is of course for an Electron app (Node.js) but you get the idea.

Then you have to select from the Debugger which configuration you want to execute from the dropdown selection option.

@jrieken
Copy link
Contributor Author

jrieken commented Jun 21, 2016

From @eByte23 on June 21, 2016 5:27

Its more a problem with the c# extension as it used to work if I have multiple projects I don't want to manually have to define every project. especially when I am building the project like that is just stupid.

I should just say build and it builds my entire .net app.
But for example if I only have one project with an entry point and I say run debugger it should automatically run the project with an entry point.

@DustinCampbell
Copy link
Contributor

This is going to get much better soon. We're about to ship 1.3.0 of the C# extension which improves generation of the tasks.json and launch.json files when you have a project structure with nested projects. Later, we're going to take a look at adding some "start up project" functionality that will update the tasks.json and launch.json files as needed to retarget build and the debugger. This is tracked by dotnet/vscode-csharp#310.

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

No branches or pull requests

2 participants