我正在尝试包含 Directory.build.props 文件,因为我想在一个地方更改所有项目的版本。
如果我使用 Visual Studio 构建解决方案,Director.build.props 文件中的属性会正确嵌入到构建的 exe 文件中。如果我使用dotnet build命令,exe 文件没有嵌入所需的属性。我观察到 dll 文件具有使用 CLI 命令以及使用 Visual Studio 嵌入的正确属性。
Directory.build.props 文件位于解决方案的根目录下(我尝试将它放在项目的根目录下,但同样的事情发生了)。这是我正在使用的 Directory.build.props 文件
<Project>
<PropertyGroup>
<Company>Company</Company>
<Copyright>Copyright</Copyright>
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
</PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
我想知道我是否缺少一些配置,为什么 dll 成功嵌入了属性而 exe 文件没有?