2013-07-08 6 views
8

新しいF#プロジェクト私もこのプロジェクトファイルに基づいてビルドスクリプトを記述することはできませんのでVS2010/VS2013プレビューで同じように動作するF#プロジェクトを作成するには?

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

のMSBuildはそれで失敗が付属しています。

私のソリューション:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\FSharp\Microsoft.FSharp.Targets" /> 

VisualStudioVersionは私のMSBuildのための11ですので、私はv12.0代わりの$(VisualStudioVersion)を設定します。ですが、これにより、他のVisual Studioバージョンとの互換性が損なわれます。私は推測

は私が

<FSharpTargetsPath Condition="'$(VisualStudioVersion)' == '11.0'">$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath> 

<FSharpTargetsPath Condition="'$(VisualStudioVersion)' == '12.0'">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath> 

似て何かをする必要があるしかし、それにも似良い解決策を見ていません。適切な方法はありますか?

また、私は3.0 F#コンパイラfsc.exeとソフトウェア似FAKEを実行しているとの問題を抱えて:

ファイルまたはアセンブリFSharp.Coreをロードできませんでした、バージョン= 4.3.0.0、文化=中立、なPublicKeyToken = b03f5f7f11d50a3a」またはをその依存関係の1つ

3.0/msbuildと3.1と新しいVS2013プレビューの間の互換性を壊さないようにするにはどうすればいいですか?

+1

VS2013プロジェクトは[VS2012と下位互換性があるはずです](https://blogs.msdn.com/b/fsharpteam/archive/2013/06/27/announcing-a-pre-release-of-f VS2012プロジェクトでは、これを動作させるために1回のアップグレードが必要ですが、Redirected = true)。 VS2012プロジェクトをVS2013にアップグレードしたが、その後VS2012でビルドできない場合は、VS2013 RTMで修正できるように問題を報告する必要があります。 –

+0

VS2010はどうですか?この ''が動作するかどうかをテストするVS2012はありません。 – Cynede

+0

私は分かりません。 VS2013のプレビュー発表ではVS2010について何も言わなかったので、3つのバージョンすべてで動作するプロジェクトファイルを(簡単に)作成できないということを意味します。 –

答えて

2

より具体的な答えは次のとおりです。

<Choose> 
    <When Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#')"> 
     <PropertyGroup> 
     <FSharpSdkPathPrefix>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#</FSharpSdkPathPrefix> 
     </PropertyGroup> 
    </When> 
    <Otherwise> 
     <Choose> 
     <When Condition="Exists('$(MSBuildExtensionsPath32)\..\..\..\..\Microsoft SDKs\F#')"> 
      <PropertyGroup> 
      <FSharpSdkPathPrefix>$(MSBuildExtensionsPath32)\..\..\..\..\Microsoft SDKs\F#</FSharpSdkPathPrefix> 
      </PropertyGroup> 
     </When> 
     <Otherwise> 
      <PropertyGroup> 
      <FSharpSdkPathPrefix></FSharpSdkPathPrefix> 
      </PropertyGroup> 
     </Otherwise> 
     </Choose> 
    </Otherwise> 
    </Choose> 
    <PropertyGroup> 
    <FSharpSdkPathSuffix>Framework\v4.0\Microsoft.FSharp.Targets</FSharpSdkPathSuffix> 
    </PropertyGroup> 
    <Choose> 
    <When Condition="'$(FSharpSdkPathPrefix)' == ''"> 
     <PropertyGroup> 
     <FSharpTargetsPath></FSharpTargetsPath> 
     </PropertyGroup> 
    </When> 
    <Otherwise> 
     <Choose> 
     <When Condition="Exists('$(FSharpSdkPathPrefix)\4.0\$(FSharpSdkPathSuffix)')"> 
      <PropertyGroup> 
      <FSharpTargetsPath>$(FSharpSdkPathPrefix)\4.0\$(FSharpSdkPathSuffix)</FSharpTargetsPath> 
      </PropertyGroup> 
     </When> 
     <Otherwise> 
      <Choose> 
      <When Condition="Exists('$(FSharpSdkPathPrefix)\3.1\$(FSharpSdkPathSuffix)')"> 
       <PropertyGroup> 
       <FSharpTargetsPath>$(FSharpSdkPathPrefix)\3.1\$(FSharpSdkPathSuffix)</FSharpTargetsPath> 
       </PropertyGroup> 
      </When> 
      <Otherwise> 
       <Choose> 
       <When Condition="Exists('$(FSharpSdkPathPrefix)\3.0\$(FSharpSdkPathSuffix)')"> 
        <PropertyGroup> 
        <FSharpTargetsPath>$(FSharpSdkPathPrefix)\3.0\$(FSharpSdkPathSuffix)</FSharpTargetsPath> 
        </PropertyGroup> 
       </When> 
       <Otherwise> 
        <PropertyGroup> 
        <FSharpTargetsPath></FSharpTargetsPath> 
        </PropertyGroup> 
       </Otherwise> 
       </Choose> 
      </Otherwise> 
      </Choose> 
     </Otherwise> 
     </Choose> 
    </Otherwise> 
    </Choose> 
    <Import Condition="'$(FSharpTargetsPath)' != ''" Project="$(FSharpTargetsPath)" /> 
    <Target Name="BeforeBuild"> 
    <Message Condition="'$(FSharpTargetsPath)' == ''" Importance="High" Text="F# SDK path was not found!" /> 
    </Target> 

これは、すべてのバージョンで動作するはずです。

0

私は両方のバージョンでプロジェクトを作成し、プロジェクトファイルを比較することから始めます。適切なCondition属性を持つ両方のファイルのスーパーセットを含むプロジェクトファイルを作成して、各バージョンのVSが正しい部分を読み込むようにするには、理論上は動作するはずです。私はダニーが与えられている必要がありますね

+0

私はこの提案がうまくいくことを願っていますが、VS2013が廃止され、2012年ももうインストールされていないので、私はこの問題を自分で表現することさえできません。 – Cynede

関連する問題