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

Update ProjectFile.GetTargetProfile to work with conditional nodes #1227

Merged
merged 7 commits into from Nov 16, 2015

Conversation

Projects
None yet
2 participants
@amazingant
Contributor

amazingant commented Nov 16, 2015

Working on #1221 (cc/ @theggelund and @forki), the contents of the test file I changed in 73e6f8c appear to work as of b905c75.

The output looks correct to me, but I'll need one of you to confirm, as I'm not sure what the output from the paket_bug project is supposed to be. Just testing from an fsx file like so:

#r @"bin\Paket.Core.dll"
let proj = Paket.ProjectFile.LoadFromFile @"tests\Paket.Tests\ProjectFile\TestData\ProjectWithConditions.fsprojtest"
let profile = proj.GetTargetProfile()

profile outputs as SinglePlatform (DotNetFramework V4_6). If I change the TargetFrameworkProfile node's condition to check for framework v4.6 instead, then I get SinglePlatform (DotNetFramework V4_Client). Doesn't make sense since there isn't a client profile for 4.6 (that I know of?), but shows that the condition on the node is being evaluated.

amazingant added some commits Nov 16, 2015

Add GetProperty member to ProjectFile type
Gets the specified property name from the project, evaluating
conditional PropertyGroup nodes as best it can and processing
MSBuild placeholder values, e.g. `$(Configuration)`
Adjust ProjectFile.GetProperty to not require default values
Did this by renaming the old member to GetPropertyWithDefaults, and
adding a new member with the old name; new member passes
Map.empty<string,string> to the WithDefaults member.
Use GetProperty from GetTargetProfile when a profile isn't explictly set
If a <TargetFrameworkProfile> value can be extracted from the project
file and it has a value, that value is used to determine the profile
here. If that node isn't specified, or its value is empty,
GetTargetProfile now tries to get the <TargetFrameworkVersion> node to
determine the correct profile from there.
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Nov 16, 2015

Member

this looks good to me. In debugger I see that the files are copiec twice - but the correct files. So it works as expected!

yay

Member

forki commented Nov 16, 2015

this looks good to me. In debugger I see that the files are copiec twice - but the correct files. So it works as expected!

yay

@forki forki merged commit 9ef7828 into fsprojects:master Nov 16, 2015

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

forki added a commit that referenced this pull request Nov 16, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment