【问题标题】:FS0010: Incomplete structured construct when compiling AssemblyInfo.fsFS0010:编译 AssemblyInfo.fs 时结构化构造不完整
【发布时间】:2017-08-22 16:26:09
【问题描述】:

我正在尝试在 TeamCity 上构建一个 F# 项目。不幸的是,构建代理没有安装 F#,所以我已将 FSharp.Compiler.Tools nuget 包添加到我的项目中。

当 teamcity 尝试构建我的项目时,我收到以下错误(在从 Visual Studio 类库模板创建的全新项目上)。

[Fsc] Microsoft (R) F# Compiler version 4.1
[15:12:00][Fsc] Copyright (c) Microsoft Corporation. All Rights Reserved.
[15:12:02][Fsc] 
[15:12:02][Fsc] C:\TeamCity\work\3c40581f0aabd3be\Source\MyProject\AssemblyInfo.fs(43, 1): error FS0010: Incomplete structured construct at or before this point in definition
[15:12:03][Step 8/21] Error message is logged

项目在本地构建良好,无论是在 VS2017 中还是在命令提示符下使用 MSBuild。

有没有办法解决这个问题?我无权在构建代理上安装 F#。

编辑:这是 AssemblyInfo.fs 的内容: 命名空间 MyProject.AssemblyInfo

open System.Reflection
open System.Runtime.CompilerServices
open 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("MyProject")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("MyProject")>]
[<assembly: AssemblyCopyright("Copyright © 2017")>]
[<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("7a1189cf-d923-4367-991c-d95b1f045712")>]

// 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("1.0.0.0")>]
[<assembly: AssemblyFileVersion("1.0.0.0")>]

do
    ()

【问题讨论】:

  • 你能告诉我们C:\TeamCity\work\3c40581f0aabd3be\Source\MyProject\AssemblyInfo.fs的内容吗?尤其是第 43 行周围的行,比如第 35-50 行左右。这可能有助于我们弄清楚编译器认为文件的哪一部分是“不完整的结构化构造”。此外,如果 TeamCity 上该文件的版本与您在本地构建时生成的版本不同,这也是有用的数据,因此请告诉我们您的 AssemblyInfo.fs 文件在本地构建后的样子。

标签: f#


【解决方案1】:

好的,看来 GitVersion 在 teamcity 代理上被调用,并且在 AssemblyInfo.fs 的末尾附加了一个 AssemblyInformationalVersion 属性(在 do () 之后)。在do () 块上方添加一个空的AssemblyInformationalVersion 解决了这个问题:gitversion 然后修改了现有属性的值,而不是添加一个新属性。

【讨论】:

    猜你喜欢
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-04
    • 2014-04-29
    • 1970-01-01
    • 2020-03-30
    • 2022-01-04
    相关资源
    最近更新 更多