如何在 mac os 上执行 .net 核心控制台应用程序
how do I execute a .net core console app on mac os
我刚刚为 MAC 安装了 Visual studio,并在底部按下播放时创建了 hello world 控制台应用程序 window(应用程序输出),我可以看到 hello world。
但是,如何从 command/terminal 行执行该应用程序?
如果我尝试 ./myapp.dll 我的权限被拒绝,即使在 sudo su 之后也是如此。
所以,不确定如何 运行 它
这是我的json
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
}
}
},
"runtimes": {
"win10-x64": {},
"osx.10.10-x64": {}
}
}
更新
我有 运行 dotnet restore 和 dotnet运行,首先我得到这个错误:
找不到与目标之一兼容的框架“.NETCoreApp,Version=v1.0”的 运行 时间目标 运行 时间:'osx.10.12-x64'。可能的原因:
然后我把我的 project.json 改成了这样:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
}
}
},
"runtimes": {
"win10-x64": {},
"osx.10.12-x64": {}
}
}
然后我得到数百个这样的错误:
System.Threading.Tasks 4.0.11 为.NETCoreApp,Version=v1.0 上的System.Threading.Tasks 提供了编译时参考程序集,但没有运行-time 程序集与osx 兼容.10.12-x64。
System.Threading.Timer 4.0.1 为.NETCoreApp,Version=v1.0 上的System.Threading.Timer 提供了编译时参考程序集,但没有运行-time 程序集与osx 兼容.10.12-x64.
只是列举了几个J
我想我的 运行时间不正确 OSX,但我应该设置它吗?
您需要 运行 它与 dotnet
,例如:
dotnet myapp.dll
据我所知,该工具尚不支持 Ready to 运行(本机)二进制文件。
Then I get hundreds of errors like this: System.Threading.Tasks 4.0.11 provides a compile-time reference
您的 project.json 缺少框架的平台类型。它应该是这样的:
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
}
}
我刚刚为 MAC 安装了 Visual studio,并在底部按下播放时创建了 hello world 控制台应用程序 window(应用程序输出),我可以看到 hello world。
但是,如何从 command/terminal 行执行该应用程序?
如果我尝试 ./myapp.dll 我的权限被拒绝,即使在 sudo su 之后也是如此。
所以,不确定如何 运行 它
这是我的json
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
}
}
},
"runtimes": {
"win10-x64": {},
"osx.10.10-x64": {}
}
}
更新
我有 运行 dotnet restore 和 dotnet运行,首先我得到这个错误: 找不到与目标之一兼容的框架“.NETCoreApp,Version=v1.0”的 运行 时间目标 运行 时间:'osx.10.12-x64'。可能的原因:
然后我把我的 project.json 改成了这样:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
}
}
},
"runtimes": {
"win10-x64": {},
"osx.10.12-x64": {}
}
}
然后我得到数百个这样的错误: System.Threading.Tasks 4.0.11 为.NETCoreApp,Version=v1.0 上的System.Threading.Tasks 提供了编译时参考程序集,但没有运行-time 程序集与osx 兼容.10.12-x64。 System.Threading.Timer 4.0.1 为.NETCoreApp,Version=v1.0 上的System.Threading.Timer 提供了编译时参考程序集,但没有运行-time 程序集与osx 兼容.10.12-x64.
只是列举了几个J
我想我的 运行时间不正确 OSX,但我应该设置它吗?
您需要 运行 它与 dotnet
,例如:
dotnet myapp.dll
据我所知,该工具尚不支持 Ready to 运行(本机)二进制文件。
Then I get hundreds of errors like this: System.Threading.Tasks 4.0.11 provides a compile-time reference
您的 project.json 缺少框架的平台类型。它应该是这样的:
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
}
}