1

在 VS2019 / .NET Core 3.0 中,项目元数据保存在项目文件中:

<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <UseWPF>true</UseWPF>
    <Authors>.....</Authors>
    <Description>.....</Description>
    <NeutralLanguage>.....</NeutralLanguage>
    <Copyright>.....</Copyright>
    <StartupObject>.....</StartupObject>
    <ApplicationIcon>.....</ApplicationIcon>
    <Company>.....</Company>
    <PackageTags>.....</PackageTags>
    <PackageReleaseNotes>.....</PackageReleaseNotes>
    <PackageProjectUrl>.....</PackageProjectUrl>
    <PackageIconUrl>.....</PackageIconUrl>
    <RepositoryUrl>.....</RepositoryUrl>
    <RepositoryType>.....</RepositoryType>
</PropertyGroup>

其中一些 vales 可以通过版本或自定义属性访问。但是一些新的值,如Authors, PackageTags, ... 还不是AssemblyInfo处理的一部分。

我的问题是:如何从我的应用程序中访问这些值?

4

1 回答 1

0

Those properties are related to the target NuGet package if you publish one. They won't be embedded into your application, so you cannot access them.

For more info, read the Additions to the csproj format for .NET Core documentation, especially the NuGet metadata properties topic.

The following is the list of properties that are used as inputs to the packing process when using the dotnet pack command or the Pack MSBuild target that is part of the SDK.

  • Authors
  • PackageTags
  • ...
于 2019-10-05T16:47:36.520 回答