简体   繁体   中英

Building VS2013 F# project on Heroku fails with “The required attribute ”Project“ In Import is empty”

I've created an F# project using one of the Nancy templates in VS2013. The code is basically just what the template created.

I can import the created .sln file into Xamarin studio and it all builds and runs without any errors or problems.

When I try to push the project up to Heroku though I get the error:

/tmp/build_b3e2706f-20c8-421e-a1ce-781831880466/NancyFirstProject/NancyFirstProject.fsproj: error : /tmp/build_b3e2706f-20c8-421e-a1ce-781831880466/NancyFirstProject/NancyFirstProject.fsproj: The required attribute "Project" in Import is empty

I've set the buildpack on Heroku as follows:

heroku config:set BUILDPACK_URL=https://github.com/aktowns/mono3-buildpack.git

I've read that a similar error can occur if you are upgrading a project via VS2013.

Is this the same error as I'm getting? Is there another buildpack I can use that resolves this issue?

I guess I can create the solution in Xamarin but I'd like to stick to vs2013 if possible.

EDIT: **

Just noticed this in the .fsproj file:

  <Choose>
    <When Condition="'$(VisualStudioVersion)' == '11.0'">
      <PropertyGroup>
        <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup>
        <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
      </PropertyGroup>
    </Otherwise>
  </Choose>
  <Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />

I'm not entirely sure why this does not work, but I had to get rid of the <Choose> tag in the F# project file in order to get F# Formatting project to work on Travis (building using Mono) and the change I had to do looks like this (GitHub diff) . Sorry for the lack of clarity - I probably copied this from some other project.

The diff replaces the <Choose> tag with:

<PropertyGroup>
  <FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0' Or $(OS) != 'Windows_NT'">
   <FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>

现在可以通过使用此处的buildpack并指定更高版本的.net框架来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM