之前,AssemblyInfo.cs
文件是由 Visual Studio 自动创建的,用于包含程序集范围的属性,如 AssemblyVersion、AssemblyName 等。
在 .NET Core 和 ASP.NET Core 中,project.json
负责保存大部分信息。
所以问题是:我是否需要再用该属性标记我的程序集?
如果我不使用该属性标记程序集,我会陷入什么陷阱?
项目.json https://learn.microsoft.com/en-us/dotnet/articles/core/tools/project-json%20file已取代AssemblyInfo
.
AssemblyVersionAttribute
被替换为version
财产
version
Type: String
The Semver version of the project, also used for the NuGet package.
AssemblyNameAttribute
现在是name
财产
name
Type: String
The name of the project, used for the assembly name as well as the name of the package. The top level folder name is used if this property is not specified.
等等
Update:随着 .NET Core Tools MSBuild 的发布,.csproj
已取代project.json
. The AssemblyInfo.cs
文件回来了,但大部分设置已直接移至.csproj
。有关更多详细信息,请参阅相关的 SO 问题:相当于 dotnet core/csproj 中的 AssemblyInfo https://stackoverflow.com/q/42138418/2833802 :
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<Version>1.2.3.4</Version>
<Authors>Author 1</Authors>
<Company>Company XYZ</Company>
<Product>Product 2</Product>
<PackageId>MyApp</PackageId>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
<Description>Description here</Description>
<Copyright>Copyright</Copyright>
<PackageLicenseUrl>License URL</PackageLicenseUrl>
<PackageProjectUrl>Project URL</PackageProjectUrl>
<PackageIconUrl>Icon URL</PackageIconUrl>
<RepositoryUrl>Repo URL</RepositoryUrl>
<RepositoryType>Repo type</RepositoryType>
<PackageTags>Tags</PackageTags>
<PackageReleaseNotes>Release</PackageReleaseNotes>
</PropertyGroup>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)