-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
VsCode's new C# DevKit fails to launch #71
Comments
Ok so this wasn't too painful. Got it working. Here is my VsCode config.
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "process",
"command": "dotnet",
"options": {
"cwd": "${workspaceFolder}/project/Payroll.Timesheets.Web"
},
"args": [
"build"
],
"problemMatcher": [
"$msCompile"
],
},
]
}
{
"configurations": [
{
"name": "IIS Express",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"program": "C:\\Program Files\\IIS Express\\iisexpress.exe",
"args": [
"/path:${workspaceFolder}\\project\\Payroll.Timesheets.Web",
"/port:51867"
],
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"cwd": "${workspaceFolder}/project/Payroll.Timesheets.Web",
"serverReadyAction": {
"pattern": "Successfully registered URL.* \"(https?://\\S+|[0-9]+)\"",
"uriFormat": "%s",
"action": "openExternally"
}
}
]
} As far as I can tell this is functionally equivalent to the Visual Studio |
Another tip for anyone attempting to use VsCode for legacy .NET, here is how to debug your tests. A few other important points:
At least that's the advice I got from microsoft/vstest#1835 & it's all working fine for me. {
"name": "VsTest",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"cwd": "${workspaceFolder}",
"program": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe",
"args": [
".\\path\\to\\tests.dll"
]
} |
@brad-jones Do you fancy converting this to a how-to and adding it to the docs in this repo? It would be good to have this information captured.
You might want to check out some of the comments #21 (comment) and #20 (comment) regarding publishing and building. |
Yeah I do have Visual Studio 2022 installed alongside so that's how those legacy dependencies are being resolved. I'm pretty sure the As it happens I'm in the process of writing up an internal company HowTo for all this, happy to modify it for public consumption & contribute here. |
@brad-jones Always happy to take documentation PRs, as that is the one big area I am aware that is lacking in this project. |
I guess it's just a personal preference thing, I spend my entire day in VsCode working on anything & everything from bash scripts to legacy .NET Framework code. Having to switch out to a different IDE for this one thing was enough of a pain for me to go down this path. The other thing I am working towards is to attempt to get something like https://coder.com/ working with this legacy stack. The problem with where I work (xero.com) is that we have a mix of both legacy & modern stacks. The legacy ones, while every attempt is being made to re-write them, the reality is that they will be with us for years to come. Getting ones local environment setup & configured for such a diverse technology landscape is such a pain so I want to put all that config into the cloud with IaC and then just dev in my browser, hell all I'd need is a Chromebook lol. I accept it's not a perfect experience but IMO it's good enough these days. Especially for the odd time that you need to make a change to some crusty piece of code covered in dust & cobwebs. You just want to get in there, do the change quickly & get out before returning back to the nice modern world where it's sunshine & rainbows haha |
I wasn't able to get that to work without adding an environment variable override for
I also prefer the And that path would have to be adjusted for the current system.
@brad-jones fyi, since you replied to this later on. |
Re: dotnet/project-system#2670 (comment)
Yes FWIW my project includes a
Properties/launchSettings.json
file & Visual Studio can launch the project just fine.But the new C# Dev Kit fails with the following.
I'm thinking I might be able to get this working with a VsCode task to manually start IISExpress & then a custom launch config to attach to the process. But it would obviously be nicer if it just worked out of the box like it does in Visual Studio.
The text was updated successfully, but these errors were encountered: