Here is how to build, run, and debug your .NET Framework Web Application with
msbuild
,
iisexpress
, and VS Code.
From PowerShell, build your app with a portable Program Database (PDB) output.
msbuild `
/property:Configuration=Debug `
/property:Platform=x64 `
/property:DebugType=portable `
/t:Clean,Build `
/p:DeployOnBuild=true `
/p:WebPublishMethod=Package `
/p:PackageAsSingleFile=false `
C:\dev\MyApp
From PowerShell, start your web application with IIS Express.
appcmd add site `
/name:"MyApp" `
/bindings:https/*:1234:localhost `
/physicalPath:"C:\dev\MyApp\obj\x64\Debug\Package\PackageTmp"
iisexpress MyApp
In VSCode, Create
./.vscode/launch.config
with this content.
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Attach",
"type": "clr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
In VSCode, use
<CTRL>
+
<SHIFT>
+
<P>
to enter the command palette and choose
Start Debugging
. Then attach to
iisexpress.exe
for your particular app.
Now you will hit breakpoints in your web application.