【问题标题】:ASP.NET Web Application and AssemblyInfo.csASP.NET Web 应用程序和 AssemblyInfo.cs
【发布时间】:2016-04-23 01:16:08
【问题描述】:

我有一个 Web 应用程序,我使用 Visual Studio 2012 中的“发布网站”功能构建并发布它。预编译网站的设置如图所示

现在我想根据article 使用AssemblyInfo.cs 为最终程序集提供一个文件版本

问题是虽然我在AssemblyInfo.cs中设置了文件版本,但输出的汇编版本始终是1.0.0.0

事实上,编译器会在其他地方创建自己的AssemblyInfo.cs,如图所示并构建它,然后最终将其与应用程序程序集合并。

我不知道如何将“发布网站”功能的这种行为更改为复制提供的 AssemblyInfo.cs 而不是创建自己的方式。

感谢任何帮助

更新:

web.config 设置为此处所说的 (How to: Create Versioned Assemblies for Precompiled Web Site Projects)

我在web.configweb.debug.config 中设置了compilerOptions,但没有运气。

【问题讨论】:

    标签: c# asp.net visual-studio visual-studio-2012


    【解决方案1】:

    我不知道你的 AssemblyInfo.csWeb.config 文件是什么样的,因为你没有提供它们,但我认为你没有像上面所说的那样将代码添加到 Web.config 文件中在您提供的链接中执行。

    <system.codedom>
      <compilers>
        <compiler language="c#;cs;csharp" extension=".cs"
          type="Microsoft.CSharp.CSharpCodeProvider, System,
          Version=2.0.3600.0, Culture=neutral, 
          PublicKeyToken=b77a5c561934e089" warningLevel="1" 
          compilerOptions="path\AssemblyInfo.cs" />
      </compilers>
    </system.codedom>
    

    您可能没有将它添加到 Web.Debug.config 文件中,这可能是您在调试时它无法正常工作的原因。

    【讨论】:

      猜你喜欢
      • 2010-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-17
      • 2012-11-14
      • 2014-04-30
      相关资源
      最近更新 更多