我创建了一个示例应用程序来了解 .Net Core 与Web -> ConsoleApp(Package)
. 我已经解决了所有依赖问题,但是当我尝试使用本机编译时
dotnet-compile --native
它返回此错误:
dotnet compile --native
Compiling DemoApp for DNXCore,Version=v5.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:09.2220793
Input Assembly: ..\Visual Studio 2015\Projects\DemoApp\
src\DemoApp\bin\Debug\dnxcore50\DemoApp.dll
libcpmt.lib(nothrow.obj) : error LNK2038: mismatch detected for '_MSC_VER': valu
e '1700' doesn't match value '1900' in Runtime.lib(RuntimeInstance.obj)
libcpmt.lib(newaop.obj) : error LNK2038: mismatch detected for '_MSC_VER': value
'1700' doesn't match value '1900' in Runtime.lib(RuntimeInstance.obj)
Runtime.lib(objecthandle.obj) : error LNK2001: unresolved external symbol "void
__cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(stressLog.obj) : error LNK2001: unresolved external symbol "void __c
decl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(gcwks.obj) : error LNK2001: unresolved external symbol "void __cdecl
operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(handletablescan.obj) : error LNK2001: unresolved external symbol "vo
id __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(module.obj) : error LNK2001: unresolved external symbol "void __cdec
l operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(allocheap.obj) : error LNK2001: unresolved external symbol "void __c
decl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(gceewks.obj) : error LNK2001: unresolved external symbol "void __cde
cl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(RestrictedCallouts.obj) : error LNK2001: unresolved external symbol
"void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(RuntimeInstance.obj) : error LNK2001: unresolved external symbol "vo
id __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(CachedInterfaceDispatch.obj) : error LNK2001: unresolved external sy
mbol "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(threadstore.obj) : error LNK2001: unresolved external symbol "void _
_cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(PalRedhawkMinWin.obj) : error LNK2001: unresolved external symbol "v
oid __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z)
Runtime.lib(handletablecore.obj) : error LNK2001: unresolved external symbol __s
td_terminate
Runtime.lib(handletablecache.obj) : error LNK2001: unresolved external symbol __
std_terminate
Runtime.lib(handletablescan.obj) : error LNK2001: unresolved external symbol __s
td_terminate
Runtime.lib(RestrictedCallouts.obj) : error LNK2001: unresolved external symbol
__std_terminate
Runtime.lib(objecthandle.obj) : error LNK2001: unresolved external symbol __std_
terminate
Runtime.lib(stressLog.obj) : error LNK2001: unresolved external symbol __std_ter
minate
Runtime.lib(handletable.obj) : error LNK2001: unresolved external symbol __std_t
erminate
Runtime.lib(RuntimeInstance.obj) : error LNK2001: unresolved external symbol __s
td_terminate
Runtime.lib(CachedInterfaceDispatch.obj) : error LNK2001: unresolved external sy
mbol __std_terminate
Runtime.lib(startup.obj) : error LNK2001: unresolved external symbol __std_termi
nate
Runtime.lib(allocheap.obj) : error LNK2001: unresolved external symbol __std_ter
minate
Runtime.lib(gcwks.obj) : error LNK2019: unresolved external symbol __acrt_iob_fu
nc referenced in function printf
bootstrapper.lib(main.obj) : error LNK2001: unresolved external symbol __acrt_io
b_func
Runtime.lib(gcwks.obj) : error LNK2019: unresolved external symbol __stdio_commo
n_vfprintf referenced in function printf
bootstrapper.lib(main.obj) : error LNK2001: unresolved external symbol __stdio_c
ommon_vfprintf
bootstrapper.lib(main.obj) : error LNK2019: unresolved external symbol _Init_thr
ead_header referenced in function GetModuleSection
bootstrapper.lib(main.obj) : error LNK2019: unresolved external symbol _Init_thr
ead_footer referenced in function GetModuleSection
bootstrapper.lib(main.obj) : error LNK2019: unresolved external symbol __managed
__Main referenced in function main
bootstrapper.lib(main.obj) : error LNK2001: unresolved external symbol _Init_thr
ead_epoch
..\Visual Studio 2015\Projects\DemoApp\src\DemoApp\bin\
Debug\dnxcore50\native\DemoApp.exe : fatal error LNK1120: 8 unresolved externals
Linking of intermediate files failed.
预期是获取exe文件。即使是普通的dotnet publish也不能完全正常工作,因为我只获取 dll、pdb 文件。exe没有发布。
我可以将此应用程序转换为单个 .exe 文件吗?我正在尝试使用 x64 本机命令提示符来运行该命令。
请建议。
编辑:尝试安装新的安装程序,但没有运气。但是dnu publish工作正常。
我只希望输出为 exe 和 dll 或本机 exe,但遗憾的是失败了。