2017-03-16 38 views
1

我目前正努力将现有的.NET Framework 4.5.2项目与新的ASP.NET Core项目集成。我使用.NET核心SDK 1.1.1构建VS代码加载没有为.NET Core编译的项目的PDB net452框架

我到目前为止是一个简单的ASP脚手架,它的运行和能够加载我的旧项目DLL,但我无法使用VS代码进行调试,因为生成的PDB似乎被忽略。

这是的csproj(我删除了我的老项目包参考,但问题依然存在)

<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> 

当我改变TargetFramework到netcoreapp1.1,创建一个EXE的DLL,而不是和调试工作。任何想法为什么?

这里是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 

回答

2

UPDATE: C#扩展1.9.0支持.NET框架调试。请参阅https://github.com/OmniSharp/omnisharp-vscode/releases/tag/v1.9.0

为此,请将“类型”设置为clr,并确保您的项目生成便携式PDB。见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" 
     } 
    ] 
} 

原始

在.NET中的核心,一个可执行的项目产生了 “为.dll” 文件。要启动它,你运行“dotnet.exe ./myapp.dll”。

在.NET Framework中,可执行项目会生成一个“.exe”文件。要启动它,请直接运行该文件:“myapp.exe”。

在撰写本文时(2017年3月),VS代码仅支持调试.NET Core进程。您可以在此处跟踪功能请求以调试.NET Framework:https://github.com/OmniSharp/omnisharp-vscode/issues/813。同时,您将需要使用Visual Studio来调试.NET Framework进程。

+0

这就是我担心的:)谢谢! – jbrekle

+0

已更新。 C#1.9.0现在支持这一点。 cc @jbrekle – natemcmaster

相关问题