|
1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | 2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 3 | + |
3 | 4 | <PropertyGroup> |
4 | 5 | <!-- Enable the restore command to run before builds --> |
5 | 6 | <RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages> |
6 | | - <!-- Download Paket.exe if it does not already exist --> |
7 | | - <DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket> |
8 | 7 | <PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath> |
9 | 8 | <PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath> |
10 | 9 | <MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath> |
11 | 10 | <MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath> |
12 | 11 | </PropertyGroup> |
| 12 | + |
13 | 13 | <PropertyGroup> |
14 | 14 | <!-- Paket command --> |
| 15 | + <PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath> |
15 | 16 | <PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath> |
16 | | - <PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath> |
17 | 17 | <PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand> |
18 | 18 | <PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand> |
19 | | - <PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)" $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand> |
20 | | - <PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 $(PaketBootStrapperExePath) $(PaketBootStrapperCommandArgs)</PaketBootStrapperCommand> |
21 | | - <!-- Commands --> |
22 | | - <PaketReferences Condition="!Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectDirectory)\paket.references</PaketReferences> |
| 19 | + </PropertyGroup> |
| 20 | + |
| 21 | + <Choose> <!-- MyProject.fsproj.paket.references has the highest precedence --> |
| 22 | + <When Condition="Exists('$(MSBuildProjectFullPath).paket.references')"> |
| 23 | + <PropertyGroup> |
| 24 | + <PaketReferences>$(MSBuildProjectFullPath).paket.references</PaketReferences> |
| 25 | + </PropertyGroup> |
| 26 | + </When> <!-- MyProject.paket.references --> |
| 27 | + <When Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references')"> |
| 28 | + <PropertyGroup> |
| 29 | + <PaketReferences>$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketReferences> |
| 30 | + </PropertyGroup> |
| 31 | + </When> <!-- paket.references --> |
| 32 | + <When Condition="Exists('$(MSBuildProjectDirectory)\paket.references')"> |
| 33 | + <PropertyGroup> |
| 34 | + <PaketReferences>$(MSBuildProjectDirectory)\paket.references</PaketReferences> |
| 35 | + </PropertyGroup> |
| 36 | + </When> <!-- Set to empty if a reference file isn't found matching one of the 3 format options --> |
| 37 | + <Otherwise> |
| 38 | + <PropertyGroup> |
| 39 | + <PaketReferences></PaketReferences> |
| 40 | + </PropertyGroup> |
| 41 | + </Otherwise> |
| 42 | + </Choose> |
| 43 | + |
| 44 | + <PropertyGroup> |
| 45 | + <!-- Commands --> |
| 46 | + <PaketReferences Condition="!Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketReferences> |
| 47 | + <PaketReferences Condition="!Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references')">$(MSBuildProjectDirectory)\paket.references</PaketReferences> |
23 | 48 | <PaketReferences Condition="!Exists('$(PaketReferences)')">$(MSBuildStartupDirectory)\paket.references</PaketReferences> |
24 | 49 | <PaketReferences Condition="Exists('$(MSBuildProjectFullPath).paket.references')">$(MSBuildProjectFullPath).paket.references</PaketReferences> |
25 | 50 | <RestoreCommand>$(PaketCommand) restore --references-files "$(PaketReferences)"</RestoreCommand> |
26 | | - <DownloadPaketCommand>$(PaketBootStrapperCommand)</DownloadPaketCommand> |
27 | 51 | <!-- We need to ensure packages are restored prior to assembly resolve --> |
28 | 52 | <BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn> |
29 | 53 | </PropertyGroup> |
30 | | - <Target Name="CheckPrerequisites"> |
31 | | - <!-- Raise an error if we're unable to locate paket.exe --> |
32 | | - <Error Condition="'$(DownloadPaket)' != 'true' AND !Exists('$(PaketExePath)')" Text="Unable to locate '$(PaketExePath)'" /> |
33 | | - <MsBuild Targets="DownloadPaket" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadPaket=$(DownloadPaket)" /> |
34 | | - </Target> |
35 | | - <Target Name="DownloadPaket"> |
36 | | - <Exec Command="$(DownloadPaketCommand)" IgnoreStandardErrorWarningFormat="true" Condition=" '$(DownloadPaket)' == 'true' AND !Exists('$(PaketExePath)')" /> |
37 | | - </Target> |
38 | | - <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites"> |
39 | | - <Exec Command="$(RestoreCommand)" IgnoreStandardErrorWarningFormat="true" WorkingDirectory="$(PaketRootPath)" Condition="Exists('$(PaketReferences)')" ContinueOnError="true" /> |
| 54 | + <Target Name="RestorePackages"> |
| 55 | + <Exec Command="$(RestoreCommand)" |
| 56 | + IgnoreStandardErrorWarningFormat="true" |
| 57 | + WorkingDirectory="$(PaketRootPath)" |
| 58 | + ContinueOnError="true" |
| 59 | + Condition=" Exists('$(PaketReferences)') AND '$(PaketReferences)' != '' " |
| 60 | + /> |
40 | 61 | </Target> |
41 | 62 | </Project> |
0 commit comments