我在Visual Studio 2010 Ultimate Edition中创建了一个安装项目,如下所示
文件 -> 新建 -> 项目 ->Visual Studio 安装程序 -> 安装向导 -> ok
我没有获得AssemblyInfo.cs文件,不确定从哪里获得它。我需要这个文件来自动递增 MSI 版本。您能否告诉我如何获取此文件或如何为每个构建自动递增 MSI 版本。
我尝试了堆栈溢出的所有解决方案,但没有任何效果。请检查下面的屏幕截图
安装解决方案资源管理器
Edit
检查此答案:使用 MSI 安装版本设置程序集信息版本号
以下信息不适用于安装项目
下面是一个示例:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Title")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Product")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("12345678-aaaa-bbbb-cccc-123456789012")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
不要忘记,您必须生成唯一的 GUID(程序集:Guid(
应将其放在项目文件夹中并编辑 .csproj 文件。
应添加此代码块:
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
通常,此文件位于子文件夹"属性"中
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="PropertiesAssemblyInfo.cs" />
</ItemGroup>