I updated my dotnet cli yesterday and the version I got is 1.0.0-rc2-002464.
But today, when I wanted to create and build a project, it always failed.
The dependencies node in project.json.
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002464"
}
}
Is there a way to tell the dotnet cli only get the dependencies in the exactly same version which is declared in project.json instead of latest version?
Run the application after build without problem
Restore warning:
warn : Dependency specified was Microsoft.NETCore.App (>= 1.0.0-rc2-3002464) but ended up with Microsoft.NETCore.App 1.0.0-rc2-3002468.
Build warning:
warning NU1007: Dependency specified was Microsoft.NETCore.App >= 1.0.0-rc2-3002464 but ended up with Microsoft.NETCore.App 1.0.0-rc2-3002468.
Run error:
Expected to load libhostpolicy.dylib from [/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002468]
This may be because the targeted framework ["Microsoft.NETCore.App": "1.0.0-rc2-3002468"] was not found.
dotnet --info output:
.NET Command Line Tools (1.0.0-rc2-002464)
Product Information:
Version: 1.0.0-rc2-002464
Commit Sha: 8313400465
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
应该是服务器上没有对应版本,就取了一个比他略大的版本,试试把1.0.0-rc2-3002464 改得小一点 ,比如1.0.0-rc2-3002400,这样应该就能编译了
My local dotnet cli version is 1.0.0-rc2-302464, but cli restore always get the latest version of Microsoft.NETCore.App (1.0.0-rc2-3002468).
The compiling is ok but with only one warning I mentioned.
I found the workaround:
1) find the file "*.runtimeconfig.json" in bin directory;
2) update the version number to your local cli version;
{
"runtimeOptions": {
"framework": {
"name": "Microsoft.NETCore.App",
"version": "1.0.0-rc2-3002464"
}
}
}
But I cannot update it every time after build.
Is there a way to put the runtime options into the Project.json?
我之前试了试 ,如果改成2400 他就会下大于或等于 2400的, 如果改成2450就会下大于或等于2450的。
这个版本小于你安装的netcore版本 ,编译和运行都没问题 ,大于就不行了
Good point, thanks!
Probably I need update my CLI to a version which has released package in myget/nuget with matched version.
去掉"type": "platform" ,加上‘runtimes’,就没有framework的限制了
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
"debugType": "portable"
},
"dependencies": {
"Microsoft.NETCore.App": { "version": "1.0.0-rc2-3002464" }
},
"frameworks": {
"netcoreapp1.0": { "imports": "dnxcore50" }
},
"runtimes":{
"win10-x64":{},
"ubuntu14.04-x64":{}
}
}