Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MSBuild-giving“;无效版本文件";论F#_F#_Msbuild - Fatal编程技术网

MSBuild-giving“;无效版本文件";论F#

MSBuild-giving“;无效版本文件";论F#,f#,msbuild,F#,Msbuild,我最近无法用MSBuild构建F。它给了我一个错误“无效版本文件”。下面生成的编译器选项显示添加了--versionfile:version.htm,我不知道为什么 我确实发现,如果我转到C:\ProgramFiles(x86)\Microsoft SDK\F\F\4.0\Framework\v4.0\Microsoft.FSharp.targets,并删除行VersionFile=“$(VersionFile)”,它将重新开始工作。但是,我不知道该文件来自何处,也不知道为什么会有这一行,我也不

我最近无法用MSBuild构建F。它给了我一个错误“无效版本文件”。下面生成的编译器选项显示添加了
--versionfile:version.htm
,我不知道为什么

我确实发现,如果我转到
C:\ProgramFiles(x86)\Microsoft SDK\F\F\4.0\Framework\v4.0\Microsoft.FSharp.targets
,并删除行
VersionFile=“$(VersionFile)”
,它将重新开始工作。但是,我不知道该文件来自何处,也不知道为什么会有这一行,我也不想使用非标准的dev box。有人能解释一下这里发生了什么吗

这是整个输出的转储

$ "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj"
Microsoft (R) Build Engine version 14.0.25420.1
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 5/4/2017 6:10:21 PM.
Project "C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj" on node 1 (default targets).
CoreCompile:
  C:\Program Files (x86)\Microsoft SDKs\F#\4.0\Framework\v4.0\fsc.exe -o:obj\Debug\Library1.dll -g --debug:full --noframework --define:DEBUG --define
  :TRACE --doc:bin\Debug\Library1.XML --optimize- --tailcalls- --versionfile:version.htm -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\FS
  harp\.NETFramework\v4.0\4.4.0.0\FSharp.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\mscorlib.dl
  l" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\System.Core.dll" -r:"C:\Program Files (x86)\Reference Ass
  emblies\Microsoft\Framework\.NETFramework\v4.6\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6\S
  ystem.Numerics.dll" --target:library --warn:3 --warnaserror:76 --fullpaths --flaterrors --subsystemversion:6.00 --highentropyva+ "C:\Users\dafohl\A
  ppData\Local\Temp\.NETFramework,Version=v4.6.AssemblyAttributes.fs" AssemblyInfo.fs Library1.fs

FSC : warning FS0075: The command-line option 'versionfile' is for test purposes only [C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1 \Library1\Library1.fsproj]

FSC : warning FS2015: The 'AssemblyVersionAttribute' has been ignored because a version was given using a command line option [C:\Users\dafohl\Docume nts\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj]

FSC : error FS0205: Invalid version file 'C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\version.htm' [C:\Users\dafohl\Docum ents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj]
Done Building Project "C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj" (default targets) -- FAILED.


Build FAILED.

"C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj" (default target) (1) ->
(CoreCompile target) ->
  FSC : warning FS0075: The command-line option 'versionfile' is for test purposes only [C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Librar y1\Library1\Library1.fsproj]
  FSC : warning FS2015: The 'AssemblyVersionAttribute' has been ignored because a version was given using a command line option [C:\Users\dafohl\Docu ments\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj]


"C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj" (default target) (1) ->
(CoreCompile target) ->
  FSC : error FS0205: Invalid version file 'C:\Users\dafohl\Documents\Visual Studio 2015\Projects\Library1\Library1\version.htm' [C:\Users\dafohl\Doc uments\Visual Studio 2015\Projects\Library1\Library1\Library1.fsproj]

    2 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.68
以下是Microsoft.FSharp.targets的原始内容:
WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

This file defines the steps in the standard build process specific for F# .NET projects.
For example, it contains the step that actually calls the F# compiler.  The remainder
of the build process is defined in Microsoft.Common.targets, which is imported by 
this file.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <UsingTask TaskName="Fsc" AssemblyFile="FSharp.Build.dll"/>
    <UsingTask TaskName="CreateFSharpManifestResourceName" AssemblyFile="FSharp.Build.dll"/>

    <PropertyGroup>
        <ImportByWildcardBeforeMicrosoftFSharpTargets Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == ''">true</ImportByWildcardBeforeMicrosoftFSharpTargets>
        <ImportByWildcardAfterMicrosoftFSharpTargets Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == ''">true</ImportByWildcardAfterMicrosoftFSharpTargets>
    </PropertyGroup>

    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore\*" Condition="'$(ImportByWildcardBeforeMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportBefore')"/>

    <PropertyGroup>
        <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
        <DefaultLanguageSourceExtension>.fs</DefaultLanguageSourceExtension>
        <Language>F#</Language>
        <TargetRuntime>Managed</TargetRuntime>
        <Tailcalls Condition="'$(Tailcalls)'==''">$(Optimize)</Tailcalls>
        <FrameworkRegistryBase Condition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
        <!-- Visual studio requires a non-empty RootNamespace value for "Add New Item" to work. -->
        <RootNamespace Condition="'$(RootNamespace)'==''">RootNamespace</RootNamespace>
        <Actual32Bit Condition="'$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0'">false</Actual32Bit>
        <Actual32Bit Condition="!('$(TargetFrameworkVersion)'=='v2.0' or '$(TargetFrameworkVersion)'=='v3.0' or '$(TargetFrameworkVersion)'=='v3.5' or '$(TargetFrameworkVersion)'=='v4.0')">$(Prefer32Bit)</Actual32Bit>    
    </PropertyGroup>

    <!--
      The CreateManifestResourceNames target create the manifest resource names from the .RESX
      files.

          [IN]
          @(EmbeddedResource) - The list of EmbeddedResource items that have been pre-processed to add metadata about resource type
                                Expected Metadata "Type" can either be "Resx" or "Non-Resx"

          [OUT]
          @(EmbeddedResource) - EmbeddedResource items with metadata         

      For F# applications the transformation is like:

          Resources1.resx => Resources1 => Build into main assembly
          SubFolder\Resources1.resx => SubFolder.Resources1 => Build into main assembly
          Resources1.fr.resx => Resources1.fr => Build into satellite assembly
          Resources1.notaculture.resx => Resources1.notaculture => Build into main assembly

      For other project systems, this transformation may be different.
      -->
    <PropertyGroup>
        <CreateManifestResourceNamesDependsOn></CreateManifestResourceNamesDependsOn>
    </PropertyGroup>
    <Target
        Name="CreateManifestResourceNames"
        Condition="'@(EmbeddedResource)' != ''"
        DependsOnTargets="$(CreateManifestResourceNamesDependsOn)"
    >

        <ItemGroup>
            <_Temporary Remove="@(_Temporary)" />
        </ItemGroup>

        <!-- Create manifest names for culture and non-culture Resx files, and for non-culture Non-Resx resources -->
        <CreateFSharpManifestResourceName
              ResourceFiles="@(EmbeddedResource)"
              RootNamespace="$(RootNamespace)"
              Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and ('%(EmbeddedResource.WithCulture)' == 'false' or '%(EmbeddedResource.Type)' == 'Resx')">

            <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />

        </CreateFSharpManifestResourceName>

        <!-- Create manifest names for all culture non-resx resources -->
        <CreateFSharpManifestResourceName
              ResourceFiles="@(EmbeddedResource)"
              RootNamespace="$(RootNamespace)"
              PrependCultureAsDirectory="false"
              Condition="'%(EmbeddedResource.ManifestResourceName)' == '' and '%(EmbeddedResource.WithCulture)' == 'true' and '%(EmbeddedResource.Type)' == 'Non-Resx'">

            <Output TaskParameter="ResourceFilesWithManifestResourceNames" ItemName="_Temporary" />

        </CreateFSharpManifestResourceName>

        <ItemGroup>
            <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(EmbeddedResource.ManifestResourceName)' == ''"/>
            <EmbeddedResource Include="@(_Temporary)" />
            <_Temporary Remove="@(_Temporary)" />
        </ItemGroup>
    </Target>

    <ItemGroup>
        <DocFileItem Include="$(DocumentationFile)" Condition="'$(DocumentationFile)'!=''"/>
    </ItemGroup>

    <ItemGroup Condition="'$(_DebugSymbolsProduced)' == 'true' and '$(PdbFile)' != ''">
        <_DebugSymbolsIntermediatePathTemporary Include="$(PdbFile)"/>
        <!-- Add any missing .pdb extension, as the compiler does -->
        <_DebugSymbolsIntermediatePath Include="@(_DebugSymbolsIntermediatePathTemporary->'%(RootDir)%(Directory)%(Filename).pdb')"/>
    </ItemGroup>

    <PropertyGroup>
        <CoreCompileDependsOn>_ComputeNonExistentFileProperty</CoreCompileDependsOn>
    </PropertyGroup>

    <Target
        Name="CoreCompile"
        Inputs="$(MSBuildAllProjects);
                @(CompileBefore);
                @(Compile);                               
                @(CompileAfter);
                @(_CoreCompileResourceInputs);
                $(ApplicationIcon);
                $(AssemblyOriginatorKeyFile);
                @(ReferencePath);
                @(CompiledLicenseFile);
                @(EmbeddedDocumentation); 
                $(Win32Resource);
                $(Win32Manifest);
                @(CustomAdditionalCompileInputs);
                $(VersionFile);
                $(KeyOriginatorFile)"
        Outputs="@(DocFileItem);
                 @(IntermediateAssembly);
                 @(_DebugSymbolsIntermediatePath);                 
                 $(NonExistentFile);
                 @(CustomAdditionalCompileOutputs)"
        Returns=""
        DependsOnTargets="$(CoreCompileDependsOn)"
    >

        <Error
            Condition="'$(SilverlightVersion)' != '' and '$(SilverlightVersion)' != 'v5.0'"
            Text="In this version of Visual Studio, F# for Silverlight can only target Silverlight v5.0. Use a prior version of Visual Studio to target previous versions of Silverlight with F#."
        />

        <Warning
            Condition="'$(Win32ResourceFile)' != '' "
            Text="The property &lt;Win32ResourceFile> has been renamed to &lt;Win32Resource>. Update your project file to ensure that the correct value is passed via the --win32res option to the F# compiler."
        />

        <!-- Condition is to filter out the _CoreCompileResourceInputs so that it doesn't pass in culture resources to the compiler -->
        <Fsc  Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
              BaseAddress="$(BaseAddress)"
              CodePage="$(CodePage)"
              DebugSymbols="$(DebugSymbols)"
              DebugType="$(DebugType)"
              DefineConstants="$(DefineConstants)"
              DisabledWarnings="$(NoWarn)"
              DocumentationFile="$(DocumentationFile)"
              GenerateInterfaceFile="$(GenerateInterfaceFile)"
              KeyFile="$(KeyOriginatorFile)"
              LCID="$(LCID)"
              NoFramework="true"
              Optimize="$(Optimize)"
              OtherFlags="$(OtherFlags)"
              OutputAssembly="@(IntermediateAssembly)"
              PdbFile="$(PdbFile)"
              Platform="$(PlatformTarget)"
              Prefer32Bit="$(Actual32Bit)"
              References="@(ReferencePath)"
              ReferencePath="$(ReferencePath)"
              Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile);@(AdditionalEmbeddedResource)"
              Sources="@(CompileBefore);@(Compile);@(CompileAfter)"
              Tailcalls="$(Tailcalls)"
              TargetType="$(OutputType)"
              ToolExe="$(FscToolExe)"
              ToolPath="$(FscToolPath)"
              TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
              Utf8Output="$(Utf8Output)"
              VersionFile="$(VersionFile)"
              VisualStudioStyleErrors="$(VisualStudioStyleErrors)"
              WarningLevel="$(WarningLevel)"
              WarningsAsErrors="$(WarningsAsErrors)"
              Win32ManifestFile="$(Win32Manifest)"
              Win32ResourceFile="$(Win32Resource)"
              SubsystemVersion="$(SubsystemVersion)"
              HighEntropyVA="$(HighEntropyVA)"
              TargetProfile="$(TargetProfile)"
              SqmSessionGuid="$(SqmSessionGuid)"
        />

        <ItemGroup>
            <_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
        </ItemGroup>

    </Target>


    <Import Project="$(MSBuildBinPath)\Microsoft.Common.targets"/>

  <!--
      ============================================================
                                          GenerateTargetFrameworkMonikerAttribute

      Emit the target framework moniker attribute as  a code fragment into a temporary source file for the compiler.

      ============================================================
      -->

    <Target Name="GenerateTargetFrameworkMonikerAttribute" BeforeTargets="BeforeCompile" DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths" Inputs="$(MSBuildThisFileFullPath)" Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)" Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">

        <PropertyGroup>
            <!-- This attribute is only available in mscorlib v4 and later -->
            <AdditionalSourcesText Condition="'$(TargetFrameworkMoniker)' != '' and '$(TargetingClr2Framework)' != 'true'">
                $(AdditionalSourcesText)
                namespace Microsoft.BuildSettings
                [&lt;System.Runtime.Versioning.TargetFrameworkAttribute(&quot;$(TargetFrameworkMoniker)&quot;, FrameworkDisplayName=&quot;$(TargetFrameworkMonikerDisplayName)&quot;)&gt;]
                do ()
            </AdditionalSourcesText>
        </PropertyGroup>

        <!-- This is a file shared between projects so we have to take care to handle simultaneous writes (by ContinueOnError)
             and a race between clean from one project and build from another (by not adding to FilesWritten so it doesn't clean) -->
        <WriteLinesToFile
            File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
            Lines="$(AdditionalSourcesText)"
            Condition="'$(AdditionalSourcesText)' != ''"
            ContinueOnError="true"
            Overwrite="true"/>

        <ItemGroup>
            <CompileBefore Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" Condition="'$(AdditionalSourcesText)' != ''"/>
        </ItemGroup>

    </Target>

    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftFSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>

</Project>
警告:除非您了解MSBuild并具有
创建了一个备份副本。对此文件的不正确更改将使其
无法从命令行或IDE加载或构建项目。
此文件定义了特定于F#.NET项目的标准生成过程中的步骤。
例如,它包含实际调用F#编译器的步骤。剩下的
生成过程的定义在Microsoft.Common.targets中,由导入
这个文件。
版权所有(C)微软公司。版权所有。
***********************************************************************************************
-->
真的
真的
美元(所有项目)$(MSBuildThisFileFullPath)
.fs
F#
管理
$(优化)
软件\Microsoft\Microsoft SDK\$(TargetFrameworkIdentifier)
根命名空间
假的
$(32位)
_ComputeNodeListenFileProperty
$(AdditionalSourcesText)
命名空间Microsoft.BuildSettings
[System.Runtime.Versioning.TargetFrameworkAttribute(“$(TargetFrameworkMoniker)”,FrameworkDisplayName=“$(TargetFrameworkMonikerDisplayName)”)]
do()

愚蠢的我,这是由我的工作环境中的某个CoreXT设置引起的,当时从加载CoreXT的命令行启动VS。从新命令行或“开始”菜单启动VS时,问题会消失


不知道CoreXT到底更改了什么设置,也不知道更改了什么位置,但这绝对是罪魁祸首。

我遇到了同样的问题,所以我对这个问题有很多疑问。但我不明白你的答案是什么。事实上,我在从Azure代理构建时遇到了问题。