如果我首先列出了netcoreapp,但我的测试没有运行,但如果我先列出net462,则会从Directory.GetCurrentDirectory()中得到错误的结果。 推荐的格式是什么,或者我应该选择什么样的东西。
“netcoreapp1.1”在project.json中首先列出: 汇编:System.IO.FileSystem,Version = 4.0.1.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a System.IO.Directory.GetCurrentDirectory():C:\ Temp \ ProjectManager \ ProjectManager \ ProjectManager \ src \ ProjectManager.Tests
'test-nunit'返回'-2147450749'。 没有测试会运行。
================================= “net462”在project.json中首先列出: 程序集mscorlib,版本= 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089 System.IO.Directory.GetCurrentDirectory():C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE 测试将运行
{
"version": "1.0.0-*",
"dependencies": {
"ProjectManager.Core": "1.0.0-*",
"ProjectManager.Domain": "1.0.0-*",
"ProjectManager.Gateway": "1.0.0-*",
"ProjectManager.Model": "1.0.0-*",
"ProjectManager.Services": "1.0.0-*",
"ProjectManager.Services.REST": "1.0.0-*",
"ProjectManager.Services.WCF": "1.0.0-*",
"NUnit": "3.5.0",
"dotnet-test-nunit": "3.4.0-beta-3",
"Moq": "4.6.38-alpha",
"Autofac": "4.2.1",
"Microsoft.Extensions.PlatformAbstractions": "1.1.0",
"NETStandard.Library": "1.6.1"
},
"runtimes": {
"win10-x64": {}
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"netcoreapp1.1",
"portable-net45+win8"
],
"dependencies": {
"Microsoft.NETCore.App": "1.1.0",
"System.ServiceModel.Duplex": "4.3.0",
"System.ServiceModel.Http": "4.3.0",
"System.ServiceModel.NetTcp": "4.3.0",
"System.ServiceModel.Security": "4.3.0",
"System.Xml.XmlSerializer": "4.3.0"
}
},
"net462": {
"frameworkAssemblies": {
"System.Runtime.Serialization": "4.0.0.0",
"System.ServiceModel": "4.0.0.0",
"System.Xml": "4.0.0.0"
},
"dependencies": {}
}
},
"testRunner": "nunit"
}
代码:
[Test]
public void CurrentDirTest()
{
string dir = System.IO.Directory.GetCurrentDirectory();
}