使用dotnet发布时安装exe文件的版本 [英] Setup exe file version when publishing with dotnet

查看:251
本文介绍了使用dotnet发布时安装exe文件的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个净核心consoleapp项目,如下所示(VS 2017风格):

I have a net core consoleapp project, as follows (VS 2017 style):

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <Version>2.0.0</Version>
    <AssemblyVersion>3.0.0.0</AssemblyVersion>
    <FileVersion>4.0.0.0</FileVersion>
    <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
    <RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
  </PropertyGroup>
</Project>

我可以构建项目而没有任何问题,可以使用dotnet publish -r win10-x64发布它将与dll文件一起生成一个exe文件。我的问题是exe文件具有一些奇怪的FileVersion和ProductVersion字段(在我的情况下是FileVersion = 1.0.1.4500和ProductVersion 1.0.1.cee57 ...(有些Guid))。其余文件的详细信息(名称,版权)也都与dotnet有关,而不是与我自己的项目有关。

I can build the project without any issues, I can publish it using dotnet publish -r win10-x64 and it will generate an exe file together with the dll file. My problem is that the exe file has some strange FileVersion and ProductVersion fields (in my case FileVersion = 1.0.1.4500 and ProductVersion 1.0.1.cee57... (some guid)). Also the rest of the file details (name, copyrights) are related to dotnet instead of my own project.

发布时有什么方法可以控制exe详细信息吗?

Is there any way I can control the exe details when publishing?

推荐答案

不,项目的主要构建输出仍然是 .dll 文件,该.exe(或linux,mac可执行文件)文件已复制并重命名为 dotnet.exe (或者在即将推出的2.0版本中,该文件为 apphost.exe ,其dll名称将以嵌入式运行。)

No, the main build output of your project still is a .dll file, the .exe (or linux, mac executables) file is a copied and renamed dotnet.exe (or in case of upcoming 2.0 versions, apphost.exe with the dll name to run embedded).

exe文件只是引导运行时然后加载您的文件的帮助程序。 dll。但是,您可以尝试使用 editbin.exe (VS C ++工具)之类的二进制编辑工具在发布后修改文件。

The exe file is only a helper that boots the runtime and then loads your dll. However, you can try to use binary editing tools like editbin.exe (VS C++ Tools) to modify the file after publishing.

这篇关于使用dotnet发布时安装exe文件的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆