【问题标题】:AssemblyInfo.cs file not found in visual studio 2010 setup project在 Visual Studio 2010 安装项目中找不到 AssemblyInfo.cs 文件
【发布时间】:2019-08-15 06:51:14
【问题描述】:

我在 Visual Studio 2010 终极版中创建了一个这样的设置项目

文件 -> 新建 -> 项目 -> Visual Studio 安装程序 -> 安装向导 -> 确定

我没有得到 AssemblyInfo.cs 文件,不知道从哪里得到它。我需要这个文件来自动增加 MSI 版本。您能否告诉我如何获取此文件或如何为每个构建自动增加 MSI 版本。

我尝试了 stackoverflow 的所有解决方案,但没有任何效果。请检查下面的截图

Setup Solution Explorer

【问题讨论】:

  • 这个文件通常会由 Visual Studio(不是 VS Code)自动创建。
  • 我只使用 Visual Studio,而不是 VS Code

标签: visual-studio visual-studio-2010 windows-installer


【解决方案1】:

编辑

检查这个答案:Set AssemblyInfo Version numbers with MSI setup version

以下信息不适用于设置项目

这是一个示例:

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="Properties\AssemblyInfo.cs" />
</ItemGroup>

【讨论】:

  • 如何添加这个文件?
  • 看我的回答,我已经添加了这个信息。
  • 没有 .csproj 文件,我有 .vdproj 文件。抱歉,我只是使用 Visual Studio 为我的可执行文件生成 msi。我是视觉工作室的新手
  • 抱歉,我没有安装项目的经验。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-01-25
  • 2011-02-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多