I am currently struggling with integrating existing .NET Framework 4.5.2 projects with a new ASP.NET Core project. I build using .NET Core SDK 1.1.1
What I have so far is a simple ASP scaffold, its running and able to load my old projects DLL but I am unable to debug it using VS Code, because the generated PDB seems to be ignored.
This is the csproj (I removed the package reference to my old project, but the issue persists)
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
</Project>
When I change the TargetFramework to netcoreapp1.1, a DLL is created instead of a EXE and debugging works. Any Idea why?
here is the output of dotnet --info
.NET Command Line Tools (1.0.1)
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: Windows
OS Version: 6.1.7601
OS Platform: Windows
RID: win7-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.1
UPDATE: C# extension 1.9.0 supports .NET Framework debugging. See https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.9.0
To do this, set the "type" to clr
and ensure your project produces portable PDBs. See https://github.com/OmniSharp/omnisharp-vscode/wiki/Portable-PDBs
csproj
<PropertyGroup>
<DebugType>portable</DebugType>
</PropertyGroup>
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Framework Launch (console)",
"type": "clr",
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/net461/sample.exe",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"console": "internalConsole"
}
]
}
Original
In .NET Core, an executable project produces a ".dll" file. To launch it, you run "dotnet.exe ./myapp.dll".
In .NET Framework, an executable project produces a ".exe" file. To launch it, you run that file directly: "myapp.exe".
At the time of writing (March 2017), VS Code only supports debugging .NET Core processes. You can track the feature request to debug .NET Framework here: https://github.com/OmniSharp/omnisharp-vscode/issues/813. In the meantime, you will need to use Visual Studio to debug a .NET Framework process.