在.net核心库多目标项目中,visual studio 2015没有加载符号



我正在创建一个有2个项目的解决方案。一个类库和一个控制台应用程序来拥有XUnit项目。这两个应用程序都针对。net 451和。net core框架。

为我拥有的库"netstandard1.3"net451"

对于xunit项目,我有"netcoreapp1.0"net451"

我在调试Visual Studio 2015中的单元测试时遇到问题,使用测试资源管理器,当我尝试调试时,符号未加载。

是否有任何我错过的项目设置?Visual Studio 2015有什么限制吗?

我有这个项目和测试工作良好,只针对。net核心版本。这个问题是在引入net451目标后开始的。一切构建正常,测试也被正确发现。

提前感谢!

项目。Json from library project

"version": "1.0.4",   
"files": {
  "includeFiles": [
    "Content/ReleaseNotes.txt"
  ],
  "include": [
    "../../README"
  ]
},   
 "releaseNotes": "Review ReleaseNotes.txt for details.",
    "requireLicenseAcceptance": true
  },
 "buildOptions": {      
  },
  "frameworks": {
    "net451": {
      "frameworkAssemblies": {
        "System.ComponentModel.DataAnnotations": "",
        "System.Data": "",
        "System.Drawing": "",
        "System.Drawing.Design": "",
        "System.Transactions": "",
        "System.Configuration": "",
        "System.Configuration.Install": "",
        "System.Management": "",
        "System.Xml": "",
        "System.Runtime": {
          "type": "build"
        }
      },
      "dependencies": {
        "Google.Protobuf": "3.0.0-beta4"
      }
    },
    "netstandard1.3": {    
      "buildOptions": {
        "define": [ "NETCORE10" ],
        "warningsAsErrors": false,            
        "embed": [
          "keywords.txt",
          "Resources.resx"          
        ],
        "resource": [ "**/*.resx" ],
        "compile": {
          "exclude": [
            "Framework/Net451/**/*.*",          
          ],
          "includeFiles": [
            "Resources.Designer.cs"            
          ],
          "excludeFiles": [
            "Properties/VersionInfo.cs",               
          ]
        }   
      },
      "dependencies": {
        "Microsoft.Extensions.Configuration.Json": "1.0.0",
        "NETStandard.Library": "1.6.0",
        "System.Collections.NonGeneric": "4.0.1",
        "System.ComponentModel": "4.0.1",
        "System.ComponentModel.Annotations": "4.1.0",
        "System.ComponentModel.Primitives": "4.1.0",
        "System.ComponentModel.TypeConverter": "4.1.0",
        "System.Data.Common": "4.1.0",
        "System.Data.SqlClient": "4.1.0",
        "System.Diagnostics.Process": "4.1.0",
        "System.Diagnostics.TextWriterTraceListener": "4.0.0",
        "System.IO.Compression": "4.1.0",
        "System.IO.FileSystem.Primitives": "4.0.1",
        "System.IO.MemoryMappedFiles": "4.0.0",
        "System.IO.Pipes": "4.0.0",
        "System.Linq.Expressions": "4.1.0",
        "System.Net.NameResolution": "4.0.0",
        "System.Net.Security": "4.0.0",
        "System.Net.Sockets": "4.1.0",
        "System.Reflection": "4.1.0",
        "System.Reflection.TypeExtensions": "4.1.0",
        "System.Security.Principal.Windows": "4.0.0",
        "System.Text.Encoding.CodePages": "4.0.1",
        "System.Threading.Timer": "4.0.1",
        "System.Threading.ThreadPool": "4.0.10",
        "Google.Protobuf": "3.0.0-beta4"
      }
    }
  }
}

项目。来自xunit项目的Json

  {
  "version": "7.0.4",
  "description": "MyLibrary", 
  "packOptions": {  
    "requireLicenseAcceptance": true
  },
  "buildOptions": {   
  },
  "testRunner": "xunit",
  "dependencies": {
    "dotnet-test-xunit": "2.2.0-*",
    "xunit": "2.2.0-*",
    "MyLibrary": {
      "target": "project"
    }
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dnxcore50"
      ],
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0-*",
          "type": "platform"
        }
      },
      "buildOptions": {
        "define": [ "NETCORE10" ],
        "copyToOutput": [ "appsettings.json" ],
        "compile": {
          "include": [ "../*.cs" ],
          "exclude": [
            "**/._*",
            "Framework/Net451/**/*.*"
          ],
          "excludeFiles": [           
            "TestDataTable.cs"
          ]
        },
        "warningsAsErrors": false,
        "optimize": true      
      }
    },
    "net451": {
      "frameworkAssemblies": {
        "System.Collections": {
          "type": "build"
        },
        "System.Diagnostics.Debug": {
          "type": "build"
        },
        "System.Linq": {
          "type": "build"
        },
        "System.Reflection": {
          "type": "build"
        },
        "System.Reflection.Extensions": {
          "type": "build"
        },
        "System.Runtime": {
          "type": "build"
        },
        "System.Runtime.Extensions": {
          "type": "build"
        },
        "System.Threading.Tasks": {
          "type": "build"
        }
      },
      "buildOptions": {
        "compile": {
          "exclude": [
            "Framework/NetCore10/*.*"
          ],
          "excludeFiles": [
            "Framework/Net451/PerfMonTests.cs",
            "Framework/Net451/ReplicationTests.cs"
          ]
        }
      }
    }
  }
}

好吧,希望这能为别人节省一些时间。我对xproj项目有点陌生,还在学习新项目中的所有选项。json文件。到目前为止我还挺喜欢的。这就是这个问题的答案。

我在框架部分外有一个optimize = true,适用于项目中的所有配置。因此IDE永远不会生成可调试的代码。一个好的做法是在你的项目中有一个配置部分。Json文件,您可以在其中定义每种情况下构建的行为。这是我添加的配置部分。

"configurations": {
"Debug": {
  "buildOptions": {
    "define": [ "DEBUG" ],
    "optimize": false,
    "preserveCompilationContext": true
  }
},
"Release": {
  "buildOptions": {
    "define": [ "RELEASE" ],
    "optimize": true,
    "preserveCompilationContext": true,
    "xmlDoc": true
  }
}

就这样。

相关内容

  • 没有找到相关文章

最新更新