2016-01-15 42 views
0

對於我的一個項目,我需要將實體框架從7降級到6,爲了做到這一點,我需要使用dnx451而不是dnx50(我認爲無論如何,這是如何工作的,我認爲451是。淨值低於50?idk)。如何針對dnx451在我的dnx50項目上運行測試?

任何人,對於那個項目,我有這個依賴關係,我提取到它自己的項目,稱爲csharp_extensions,並且依賴關係是我想與dnx50和dnx451一起工作。

這裏是我的地方csharp_extensions我project.json:

{ 
    "version": "1.1.0", 
    "configurations": { 
     "Debug": { 
      "compilationOptions": { 
       "define": [ "DEBUG", "TRACE" ] 
      } 
     }, 
     "Release": { 
      "compilationOptions": { 
       "define": [ "RELEASE", "TRACE" ], 
       "optimize": true 
      } 
     } 
    }, 
    "dependencies": { 
     "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final", 
     "System.Reflection": "4.1.0-beta-*", 
     "xunit": "2.1.0-*", 
     "xunit.runner.dnx": "2.1.0-*" 
    }, 
    "commands": { 
     "run": "csharp_extensions", 
     "test": "xunit.runner.dnx" 
    }, 
    "frameworks": { 
     "dnx541": { 
      "dependencies": { 
       "Microsoft.CSharp": "4.0.1-beta-23516", 
       "System.Collections": "4.0.11-beta-23516", 
       "System.Linq": "4.0.1-beta-23516", 
       "System.Runtime": "4.0.21-beta-23516", 
       "System.Threading": "4.0.11-beta-23516" 
      } 
     }, 
     "dnxcore50": { 
      "_": "this is the recommended windows runtime", 
      "dependencies": { 
       "System.Console": "4.0.0-beta-*", 
       "System.Reflection.TypeExtensions": "4.1.0-beta-*", 
       "System.Runtime.Extensions": "(4.0,]", 
       "System.Dynamic.Runtime": "(4.0.0,]", 
       "Microsoft.CSharp": "(4.0.0,]", 
       "System.IO": "(4.0,]" 
      } 
     } 

    }, 
} 

這裏是工作(對於dnx50僅雖然)的project.json https://github.com/NullVoxPopuli/csharp-extensions/blob/master/project.json 是一樣的東西上面粘貼,但沒有進入dnx541。

與上述(粘貼)project.json,當我嘗試建立,它說一切成功,但測試運行時,我得到以下錯誤:

------ Discover test started ------ 
------ Test started: Project: csharp-extensions ------ 
Starting Microsoft.Dnx.TestHost [C:\Users\me\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin\dnx.exe --appbase "C:\Users\me\Development\csharp-extensions" Microsoft.Dnx.ApplicationHost --port 32182 Microsoft.Dnx.TestHost --port 36832 --parentProcessId 21136] 

System.InvalidOperationException: The current runtime target framework is not compatible with 'csharp-extensions'. 
Current runtime target framework: 'DNX,Version=v4.5.1 (dnx451)' 
Version:  1.0.0-rc1-16231 
Type:   Clr 
Architecture: x86 
OS Name:  Windows 
OS Version: 6.3 
Runtime Id: win81-x86 

Please make sure the runtime matches a framework specified in project.json 
    at Microsoft.Dnx.ApplicationHost.DefaultHost.GetEntryPoint(String applicationName) 
    at Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args) 
    at Microsoft.Dnx.ApplicationHost.Program.Main(String[] args) 
--- End of stack trace from previous location where exception was thrown --- 
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 
    at Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider) 
    at Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, String appBase, FrameworkName targetFramework) 
    at Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, BootstrapperContext bootstrapperContext) 
    at Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, BootstrapperContext bootstrapperContext) 
Unable to start Microsoft.Dnx.TestHost 
========== Discover test finished: 0 found (0:00:01.0852529) ========== 

我是很新,dnvm ,命令不作一大堆的意義,我就爲容易記憶(我已經習慣了RVM,從Ruby世界,雖然)

+0

如果我使用GitHub中的項目並將'project.json'更改爲上面的那個,那麼這就是你想要做的? – poke

+0

是的,我只是想讓該項目與dnx451兼容,所以我可以在我的其他項目 – NullVoxPopuli

回答

1
"frameworks": { 
    "dnx541": { 
     … 

您不小心拼錯的框架版本那裏。它應該是(正如你在你的問題中多次提到的那樣),而不是541.因此,由於你使用dnx451框架(如錯誤消息中指定的)運行此框架,因此DNX將在配置中查找該框架但找不到它。

+0

中使用EF6,這很令人尷尬。 – NullVoxPopuli

+0

如果它更好,我必須克隆項目,嘗試三次運行測試,並在我注意到它之前複製另一個'project.json'的部分...:S – poke

相關問題