以前,AssemblyInfo.cs文件由Visual Studio自动化,以包含程序集范围的属性,如AssemblyVersion,AssemblyName等.
在.NET Core和ASP.NET Core中,project.json负责保存大部分信息.
解决方法
project.json已经取代了AssemblyInfo.
AssemblyVersionAttribute由version属性替换
version Type: String The Semver version of the project,also used for the NuGet package.
AssemblyNameAttrinbute现在是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.
等等
更新:与宣布.NET Core Tools MSBuild一样,.csproj替换为project.json,再次有一个AssemblyInfo.cs文件,但是大多数设置已经被直接移动到.csproj.有关详细信息,请参阅相关SO问题:Equivalent to AssemblyInfo in dotnet core/csproj:
<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>