程序在我移动.exe文件后没有更新。

huangapple go评论63阅读模式
英文:

Programs not updating after I move .exe file

问题

I make program and compile that to arbitrage2 directory.

When things work well I copy the .exe file to arbitrage4 directory.

Before going to .net 7 it works fine.

However, I was surprised that the code running on arbitrage 4 directory must be an obsolete code.

I finally compile the program straight into arbitrage 4 directory and it works fine.

I wonder if my codes are not really in .exe file but in some other files?

I wonder if after .net 7 the .exe file is just a front that calls something else. If so that would explain it.

英文:

I make program and compile that to arbitrage2 directory.

When things work well I copy the .exe file to arbitrage4 directory.

Before going to .net 7 it works fine.

However, I was surprised that the code running on arbitrage 4 directory must be an obsolete code.

I finally compile the program straight into arbitrage 4 directory and it works fine.

I wonder if my codes are not really in .exe file but in some other files?

I wonder if after .net 7 the .exe file is just a front that call something else. If so that would explain it.

答案1

得分: 2

如在链接答案这里中所述,.NET 6.0+应用程序的exe仅仅是一个存根加载程序(基本上是dotnet.exe的修补版本),本身不执行任何操作,只是加载运行时。代码存储在独立于平台的applicationname.dll文件中。要运行应用程序,需要同时使用exe和dll,以及在其中生成的任何.json文件(它们用于查找正确的引用库)。当然,输出文件夹中的任何其他dll也需要才能成功运行应用程序。因此,一般的经验法则是:如果希望在其他地方(不同目录或不同PC上)运行它,就复制输出文件夹中的所有内容。

有两个例外情况:.pdb文件仅用于调试,因此无需分发这些文件。而与.dll文件同名的.xml文件用于智能感知,因此仅对开发人员有用。它们应该与库一起分发,但不应与完整的应用程序一起分发。

英文:

As stated in the linked answer here, the exe of a .NET 6.0+ application is only a stub loader (it's basically a patched copy of dotnet.exe) and in itself does nothing except loading the runtime. The code resides in the platform-independent applicationname.dll file. To run an application, both the exe and the dll are required, as well as any .json files that are generated there (they're used to find the correct referenced libraries). Of course, any other dlls in the output folder are also required to successfully run your application. So the general rule of thumb is: Copy everything in the output folder if you want it to be runnable somewhere else (in a different directory, or on a different PC).

There are two exceptions: The .pdb files are only used for debugging. So you don't need to distribute these. And the .xml files with the same name as .dll files are for intellisense, so they're only helpful for developers. They should be distributed with a library, but not with a full application.

答案2

得分: 1

我建议查看单文件部署,它会将所有引用捆绑到一个单独的EXE文件中。这样,无论您将EXE文件放在哪里,它都会具备一切所需。

英文:

I would suggest looking into Single-file deployment which would bundle all your references into a single EXE. That way wherever you put your EXE it will have all it needs.

huangapple
  • 本文由 发表于 2023年4月4日 14:21:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926070.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定