New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VS Package Management dialog for .NET Core SDK projects #4327

Merged
merged 4 commits into from Feb 13, 2018
Jump to file or symbol
Failed to load files and symbols.
+242 −14
Diff settings

Always

Just for now

View
@@ -63,6 +63,8 @@ scripts/*.patch
/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.dll
/tests/fsharpqa/Source/CodeGen/EmittedIL/StaticInit/StaticInit_Module01.pdb
/tests/Xnet40-fsharpqa-suite-failures.log.*
/tests/fsharp/typeProviders/splitAssemblyTools/provider.dll
/tests/fsharp/typeProviders/splitAssemblyTypeproviders/provider.dll
/vsintegration/src/service/FsPkgs/FSharp.Project/FS/FSharp.ProjectSystem.FSharp.fsi
/vsintegration/src/service/FsPkgs/FSharp.Project/FS/ctofiles/
/tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Utils.dll
View
@@ -65,6 +65,7 @@
<ItemGroup Condition="'$(TEST_NET40_FSHARP_SUITE)'=='1'" >
<ProjectsWithNet40 Include="tests/fsharp/FSharp.Tests.FSharpSuite.fsproj" />
<ProjectsWithNet40 Include="tests/fsharp/SDKTests/AllSdkTargetsTests.proj" />
</ItemGroup>
<ItemGroup Condition="'$(TEST_CORECLR_FSHARP_SUITE)'=='1'" >
@@ -32,6 +32,8 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<PropertyGroup>
<EnableDefaultCompileItems Condition=" '$(EnableDefaultCompileItems)' == '' ">false</EnableDefaultCompileItems> <!--- Do not glob F# source files -->
<EnableDefaultNoneItems Condition=" '$(EnableDefaultNoneItems)' == '' ">false</EnableDefaultNoneItems>
<DefaultValueTuplePackageVersion>4.3.1</DefaultValueTuplePackageVersion>
<DefaultFSharpPackageVersion>4.3.4</DefaultFSharpPackageVersion>
</PropertyGroup>
<PropertyGroup>
@@ -63,4 +65,15 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<FscToolPath Condition=" '$(FscToolPath)' == '' ">$(MSBuildThisFileDirectory)</FscToolPath>
<FscToolExe Condition="'$(OS)' == 'Unix' and '$(FscToolExe)' == ''">RunFsc.sh</FscToolExe>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="$(DefaultValueTuplePackageVersion)" >
<DefaultInclude>true</DefaultInclude>
</PackageReference>
<PackageReference Include="FSharp.Core" Version="$(DefaultFSharpPackageVersion)">

This comment has been minimized.

@enricosada

enricosada Feb 9, 2018

Contributor

is possibile to add here a condition to NOT create these?
like https://github.com/dotnet/sdk/blob/feca75bd43f6374715621024d930164de8bde67c/src/Tasks/Microsoft.NET.Build.Tasks/build/Microsoft.NET.Sdk.DefaultItems.props#L48 does

so same Condition=" '$(DisableImplicitFSharpCoreReference)' != 'true' " ?

i mean, why renamed from DisableImplicitFSharpCoreReference to DefaultValueTuplePackageVersion?
it will make a special case in other tools and program (paket but also customized existing fsproj)

i mean, can be FSharp.Core be added like NETStandard.Library (who allow disable that behaviour with DisableImplicitFrameworkReferences )?

so can be FSharp.Core be added like NETStandard.Library (who allow disable that behaviour with DisableImplicitFrameworkReferences )?

This comment has been minimized.

@KevinRansom

KevinRansom Feb 9, 2018

Contributor

@enricosada

the order that properties are set is:

  1. The props file
    
  2. The user project file
    
  3. The targets file
    

So if we want there to be an implicit reference, that the developer can amend by setting DisableImplicitFSharpCoreReference. We need to add it in props and remove it in targets.

The existing parameters DisableImplicitFSharpCoreReference and FSharpCoreImplicitPackageVersion should still work fine, unless I messed up, which I may have. The DefaultValueTuplePackageVersion and DefaultFSharpCorePackageVersion are just a way of parameterizing the 4.2.*.

So the complexity of add then remove, are primarily to support the old Disable and version setting mechanism.

I hope this clears some stuff up.

<DefaultInclude>true</DefaultInclude>
</PackageReference>
</ItemGroup>
</Project>
@@ -53,29 +53,59 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
<PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(FSharpCoreImplicitPackageVersion)' == '' ">
<FSharpCoreImplicitPackageVersion>4.3.*</FSharpCoreImplicitPackageVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(DisableImplicitSystemValueTupleReference)' != 'true' ">
<PropertyGroup>
<_FrameworkNeedsValueTupleReference Condition=" ('$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFrameworkIdentifier)' == '.NETCoreApp') and !('$(_TargetFrameworkVersionWithoutV)' >= '2.0') ">true</_FrameworkNeedsValueTupleReference>
<_FrameworkNeedsValueTupleReference Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' and
('$(_TargetFrameworkVersionWithoutV)' == '4.0' or
('$(_TargetFrameworkVersionWithoutV)' == '' or
'$(_TargetFrameworkVersionWithoutV)' == '4.0' or
'$(_TargetFrameworkVersionWithoutV)' == '4.5' or
'$(_TargetFrameworkVersionWithoutV)' == '4.6' or
'$(_TargetFrameworkVersionWithoutV)' == '4.6.1' or
'$(_TargetFrameworkVersionWithoutV)' == '4.6.2' or
'$(_TargetFrameworkVersionWithoutV)' == '4.7') ">true</_FrameworkNeedsValueTupleReference>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.*" Condition=" '$(DisableImplicitSystemValueTupleReference)' != 'true' and '$(_FrameworkNeedsValueTupleReference)' == 'true' "></PackageReference>
<PackageReference Include="FSharp.Core" Version="$(FSharpCoreImplicitPackageVersion)" Condition=" '$(DisableImplicitFSharpCoreReference)' != 'true' "></PackageReference>
</ItemGroup>
<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<PropertyGroup>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackageFSharpDesignTimeTools</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>
<Target Name="FSharpCorePackageReferences" BeforeTargets="CollectPackageReferences;">
<ItemGroup>
<FSharpCorePackages Include="@(PackageReference)" Condition=" '%(Identity)' == 'FSharp.Core' " />
<PackageReference Update="FSharp.Core" Version="$(FSharpCoreImplicitPackageVersion)"
Condition=" ('%(PackageReference.Identity)' == 'FSharp.Core')
and ('%(PackageReference.Version)' == '$(DefaultFSharpPackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true')
and ('$(DisableImplicitFSharpCoreReference)' != 'true')
and ('$(FSharpCoreImplicitPackageVersion)' != '')
and (@(FSharpCorePackages->Count()) == 1) " />
<PackageReference Remove="FSharp.Core"
Condition=" (('$(DisableImplicitFSharpCoreReference)' == 'true') or (@(FSharpCorePackages->Count()) &gt; 1))
and ('%(PackageReference.Identity)' == 'FSharp.Core')
and ('%(PackageReference.Version)' == '$(DefaultFSharpPackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true') " />
</ItemGroup>
</Target>
<Target Name="ValueTuplePackageReferences" BeforeTargets="CollectPackageReferences;">
<Message Text="PackageReferences: ValueTuplePackageReferences start : @(PackageReference)" />
<ItemGroup>
<ValueTuplePackages Include="@(PackageReference)" Condition=" '%(Identity)' == 'System.ValueTuple' " />
<PackageReference Update="System.ValueTuple" Version="$(ValueTupleImplicitPackageVersion)"
Condition=" ('%(PackageReference.Identity)' == 'System.ValueTuple')
and ('%(PackageReference.Version)' == '$(DefaultValueTuplePackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true')
and ('$(ValueTupleImplicitPackageVersion)' != '')
and ('$(DisableImplicitSystemValueTupleReference)' != 'true')
and ('$(_FrameworkNeedsValueTupleReference)' == 'true')
and (@(ValueTuplePackages->Count()) == 1) " />
<PackageReference Remove="System.ValueTuple"
Condition=" ( ('$(DisableImplicitSystemValueTupleReference)' == 'true') or ('$(_FrameworkNeedsValueTupleReference)' != 'true') or (@(ValueTuplePackages->Count()) &gt; 1) )
and ('%(PackageReference.Identity)' == 'System.ValueTuple')
and ('%(PackageReference.Version)' == '$(DefaultValueTuplePackageVersion)')
and ('%(PackageReference.DefaultInclude)' == 'true') " />
</ItemGroup>
</Target>
<Target Name="PackageFSharpDesignTimeTools" DependsOnTargets="_GetFrameworkAssemblyReferences">
<PropertyGroup>
@@ -52,7 +52,7 @@
<HintPath Condition="'$(TargetDotnetProfile)' == 'net40'">$(FsCheckLibDir)\net45\FsCheck.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple">
<HintPath>..\..\..\packages\System.ValueTuple.4.3.1\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
<HintPath>..\..\packages\System.ValueTuple.4.3.1\lib\portable-net40+sl4+win8+wp8\System.ValueTuple.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
@@ -0,0 +1,18 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">release</Configuration>
</PropertyGroup>
<ItemGroup>
<TestsToRun Include="tests\*.proj" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="@(TestsToRun)" Targets="Test" Properties="Configuration=$(Configuration)" />
</Target>
<Target Name="Rebuild" />
<Target Name="Clean" />
</Project>
@@ -0,0 +1,19 @@
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Test.props" />
<!-- if no FSharp.Core is specified, ensure the default is present -->
<!-- if no System.ValueTuple is specified, ensure the default is present -->
<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>$(DefaultFSharpPackageVersion)</ExpectedFSharpCorePackageVersion>
<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>$(DefaultValueTuplePackageVersion)</ExpectedValueTuplePackageVersion>
</PropertyGroup>
<Import Project="Test.targets" />
</Project>
@@ -0,0 +1,20 @@
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Test.props" />
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>
<!-- if $(DisableImplicitFSharpCoreReference) is set, ensure that FSharp.Core isn't present -->
<!-- if $(DisableImplicitValueTupleReference) is set, ensure that System.ValueTuple isn't present -->
<PropertyGroup>
<ExpectsFSharpCore>false</ExpectsFSharpCore>
<ExpectsValueTuple>false</ExpectsValueTuple>
</PropertyGroup>
<Import Project="Test.targets" />
</Project>
@@ -0,0 +1,28 @@
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Test.props" />
<PropertyGroup>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="99.99.99" />
<PackageReference Include="System.ValueTuple" Version="44.44.44" />
</ItemGroup>
<!-- if $(DisableImplicitFSharpCoreReference) is set and an explicit PackageReference is added, that version of FSharp.Core is present -->
<!-- if $(DisableImplicitValueTupleReference) is set and an explicit PackageReference is added, that version of System.ValueTuple is present -->
<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>
<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>
<Import Project="Test.targets" />
</Project>
@@ -0,0 +1,23 @@
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Test.props" />
<PropertyGroup>
<FSharpCoreImplicitPackageVersion>99.99.99</FSharpCoreImplicitPackageVersion>
<ValueTupleImplicitPackageVersion>44.44.44</ValueTupleImplicitPackageVersion>
</PropertyGroup>
<!-- if $(FSharpCoreImplicitPackgeVersion) is specified, ensure that's used -->
<!-- if $(ValueTupleImplicitPackageVersion) is specified, ensure that's used -->
<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>
<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>
<Import Project="Test.targets" />
</Project>
@@ -0,0 +1,15 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TargetFramework Condition="'$(TargetFramework)' == ''">net46</TargetFramework>
<Configuration Condition="'$(Configuration)' == ''">release</Configuration>
<BinariesDirectory>$(MSBuildThisFileDirectory)..\..\..\..\$(Configuration)\net40\bin</BinariesDirectory>
<!-- these properties don't really matter, but they're necessary to make MSBuild happy -->
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<OutputPath>$(MSBuildThisFileDirectory)</OutputPath>
</PropertyGroup>
<Import Project="$(BinariesDirectory)\Microsoft.FSharp.NetSdk.props" />
</Project>
@@ -0,0 +1,38 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(BinariesDirectory)\Microsoft.FSharp.NetSdk.targets" />
<Target Name="Test" DependsOnTargets="FSharpCorePackageReferences;ValueTuplePackageReferences">
<Message Importance="High" Text="Testing : $(MSBuildProjectName)" />
<ItemGroup>
<FoundFSharpCorePackages Include="@(PackageReference)" Condition="'%(Identity)' == 'FSharp.Core'" />
<FoundValueTuplePackages Include="@(PackageReference)" Condition="'%(Identity)' == 'System.ValueTuple'" />
</ItemGroup>
<Message Importance="High" Text="Diagnostic TestTarget PackageReference = '@(PackageReference)' " />
<Message Importance="High" Text="Diagnostic TestTarget FoundFSharpCorePackages = '@(FoundFSharpCorePackages)' " />
<Message Importance="High" Text="Diagnostic TestTarget FoundValueTuplePackages = '@(FoundValueTuplePackages)' " />
<!-- check for invalid test settings -->
<Error Condition="'$(ExpectsFSharpCore)' != 'true' and '$(ExpectedFSharpCorePackageVersion)' != ''" Text="A test cannot specify both ExepctsFSharpCore=false and provide a value for ExpectedFSharpCorePackageVersion." />
<!-- validate there is only ever 0 or 1 FSharp.Core present -->
<Error Condition="'$(ExpectsFSharpCore)' == 'true' and @(FoundFSharpCorePackages->Count()) == 0" Text="No FSharp.Core reference found. Expected version $(ExpectedFSharpCorePackageVersion)." />
<Error Condition="'$(ExpectsFSharpCore)' != 'true' and @(FoundFSharpCorePackages->Count()) &gt; 0" Text="Expected no FSharp.Core to be present, but found version %(FoundFSharpCorePackages.Version)." />
<Error Condition="@(FoundFSharpCorePackages->Count()) &gt; 1" Text="Found more than one version of FSharp.Core; this should never happen: version=%(FoundFSharpCorePackages.Version)." />
<!-- validate there is only ever 0 or 1 System.ValueTuple present -->
<Error Condition="'$(ExpectsValueTuple)' == 'true' and @(FoundValueTuplePackages->Count()) == 0" Text="No System.ValueTuple reference found. Expected version $(ExpectedValueTuplePackageVersion)." />
<Error Condition="'$(ExpectsValueTuple)' != 'true' and @(FoundValueTuplePackages->Count()) &gt; 0" Text="Expected no System.ValueTuple to be present, but found version %(FoundValueTuplePackages.Version)." />
<Error Condition="@(FoundValueTuplePackages->Count()) &gt; 1" Text="Found more than one version of ValueTuple; this should never happen: version=%(FoundValueTuplePackages.Version)." />
<!-- validate the version of the listed FSharp.Core -->
<Error Condition="'$(ExpectsFSharpCore)' == 'true' and '%(FoundFSharpCorePackages.Version)' != '$(ExpectedFSharpCorePackageVersion)'" Text="Expected FSharp.Core version $(ExpectedFSharpCorePackageVersion) but found %(FoundFSharpCorePackages.Version)." />
<!-- validate the version of the listed System.ValueTuple -->
<Error Condition="'$(ExpectsValueTuple)' == 'true' and '%(FoundValueTuplePackages.Version)' != '$(ExpectedValueTuplePackageVersion)'" Text="Expected System.ValueTuple version $(ExpectedValueTuplePackageVersion) but found %(FoundValueTuplePackages.Version)." />
</Target>
</Project>
@@ -0,0 +1,21 @@
<Project ToolsVersion="4.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="Test.props" />
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="99.99.99" />
<PackageReference Update="System.ValueTuple" Version="44.44.44" />
</ItemGroup>
<!-- honor updating the reference; this is what the NuGet package manager in Visual Studio does -->
<PropertyGroup>
<ExpectsFSharpCore>true</ExpectsFSharpCore>
<ExpectedFSharpCorePackageVersion>99.99.99</ExpectedFSharpCorePackageVersion>
<ExpectsValueTuple>true</ExpectsValueTuple>
<ExpectedValueTuplePackageVersion>44.44.44</ExpectedValueTuplePackageVersion>
</PropertyGroup>
<Import Project="Test.targets" />
</Project>
ProTip! Use n and p to navigate between commits in a pull request.