SLE*_*LEO 7 c# version assemblyinfo visual-studio
我在 Visual Studio 中有一个解决方案,它有许多项目和 DLL 文件,如何在构建之前或之后更改解决方案中所有文件(dll 和 exe 文件)的版本?
[
[
可以通过编辑 Assemblyinfo.cs 文件来更改程序集信息,该文件可以在解决方案资源管理器中的项目属性下看到,在这里您可以更改程序集的版本
\n\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle("My App Title")]\n[assembly: AssemblyDescription("App Description")]\n[assembly: AssemblyCompany("My Company Name")]\n[assembly: AssemblyProduct("ConsoleApp")]\n[assembly: AssemblyCopyright("Copyright \xc2\xa9 2015")]\n[assembly: AssemblyTrademark("My Company Trademark")]\n[assembly: AssemblyCulture("")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components. If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid("513436d3-aa2f-407b-83d2-9268300cc373")]\n\n// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Minor Version \n// Build Number\n// Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n\n//*******Assembly Version can be changed here*********\n// by using the \'*\' as shown below:\n// [assembly: AssemblyVersion("1.0.*")]\n[assembly: AssemblyVersion("1.0.0.0")]\n[assembly: AssemblyFileVersion("1.0.0.0")]\nRun Code Online (Sandbox Code Playgroud)\n\n或者
\n\n单击“确定”,您的 AssemblyInfo.cs 文件就会自动更新\n
\n\n正如评论中AssemblyInfo.cs指出的那样,如果您要更改:
// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Minor Version \n// Build Number\n// Revision\n//\n// You can specify all the values or you can default the Revision and Build Numbers \n// by using the \'*\' as shown below:\n[assembly: AssemblyVersion("1.0.0.0")]\n[assembly: AssemblyFileVersion("1.0.0.0")]\nRun Code Online (Sandbox Code Playgroud)\n\n到:
\n\n// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Minor Version \n// Build Number\n// Revision\n//\n// You can specify all the values or you can default the Revision and Build Numbers \n// by using the \'*\' as shown below:\n[assembly: AssemblyVersion("1.0.*")]\nRun Code Online (Sandbox Code Playgroud)\n\n每次构建后,程序集将获得新的构建号/修订版。
\n\n来自MSDN:
\n\n\n\n\n您可以指定所有值,也可以使用星号 ( ) 接受默认内部版本号、修订号或两者。例如,[ assembly:AssemblyVersion("2.3.25.1")] 表示 2 为主版本,3 为次版本,25 为内部版本号,1 为修订号。版本号(例如 [ assembly:AssemblyVersion("1.2. ")] 指定 1 作为主要版本,2 作为次要版本,并接受默认的内部版本号和修订号。版本号(例如 [程序集:AssemblyVersion(“1.2.15.*”)] 指定 1 作为主要版本,2 作为次要版本,15 作为内部版本号,并接受默认修订号。默认内部版本号每日递增。默认修订号是自当地时间午夜以来的秒数(不考虑夏令时的时区调整)除以 2。
\n
共享程序集信息教程:
\n\nhttp://theburningmonk.com/2010/03/net-tips-use-a-shared- assemblyinfo-cs-for-your-solution/
\n\n