Home: Provide a way to set the project restore type

Created on 1 Dec 2016  路  2Comments  路  Source: NuGet/Home

NuGet.targets sets the _ProjectRestoreType property based on whether there is a project.json file in the project, whether the project has a PackageReference, and whether the project has a TargetFramework or TargetFrameworks property.

Projects using the .NET Sdk should always use the "NETCore" restore type. Right now, to do this, the .NET Sdk has to add a target that runs after _GetProjectRestoreType to set this property. It would be preferable for NuGet.targets to only set this property if it wasn't already set, so that the .NET Sdk could simply set this property in it's .props files.

Restore Xplat PackageReference Investigate

Most helpful comment

@dsplaisted I've moved this property to RestoreProjectStyle, if set NuGet will respect the existing value. It would be great if the SDK could set this so NuGet could use that instead of trying to determine the project type itself.

<PropertyGroup>
   <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>

All 2 comments

This sounds related to: https://github.com/NuGet/Home/issues/3504

@dsplaisted I could do that check to avoid overriding, but should this be a property such as ProjectRestoreType without the underscore? It would be awesome if the SDK could just tell NuGet which mode to use, the current flow is just because that was not available.

@dsplaisted I've moved this property to RestoreProjectStyle, if set NuGet will respect the existing value. It would be great if the SDK could set this so NuGet could use that instead of trying to determine the project type itself.

<PropertyGroup>
   <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
Was this page helpful?
0 / 5 - 0 ratings