Paket restore silently fails when TargetFramework(s) are specified in Directory.Build.props and not csproj
See original GitHub issueDescription
When TargetFramework(s) are defined in Directory.Build.props Paket restore silently fails, it should be able to get it from msbuild at runtime.
Repro steps
Have Directory.Build.props in solution root folder e.g.:
<Project>
<Import Project=".\Versions.props"/>
<PropertyGroup>
<FullFrameworkVersion>net462</FullFrameworkVersion>
</PropertyGroup>
</Project>
and then use the property to define TargetFramework in underlying project files, e.g.:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(FullFrameworkVersion)</TargetFramework>
<AssemblyName>SomeAssembly</AssemblyName>
...
</PropertyGroup>
<Import Project="..\..\.paket\Paket.Restore.targets" />
</Project>
Expected behavior
Paket restore shouldn’t silently fail. Ideally it should be able to get Framework information from msbuild from runtime.
Actual behavior
Paket restore is not able to get TargetFramework(s) information from project file and silently fails.
Known workarounds
Don’t define TargetFramework in Directory.Build.props . #3013
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (18 by maintainers)
Top Results From Across the Web
Using Directory.Build.Props to change ...
So TargetFrameworkVersion is embedded in the net standard project as the value of net framework , so the build fails due to incompatibility. ......
Read more >release-notes
... restore silently failed when TargetFramework(s) are specified in Directory.Build.props and not csproj - https://github.com/fsprojects/Paket/pull/3013 ...
Read more >Target Framework defined in Directory.Build.props causes ...
I added the Directory.Build.props file to the ncrunch config to copy over as a needed file but still ncrunch gives me an error...
Read more >Paket
A dependency manager for .NET with support for NuGet packages and git repositories. Why Paket? NuGet did not separate out the concept of...
Read more >Paket 7.2.1
A dependency manager for .NET with support for NuGet packages and git repositories. Why Paket? NuGet did not separate out the concept of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@alfonsogarciacaro https://github.com/fsprojects/Paket/blob/7346d01d237ebe489a61bb699deb07ee8be8357b/src/Paket.Core/PaketConfigFiles/DependencyCache.fs#L34-L92
This basically is the implementation to get an order, implemented on package and on dll level. Basically all you need to have is a function getting dependencies. Here we use Mono.Cecil on dll-level and our own infos for package level
Copy pasting from slack, after discussing why generating dozen of
.paket.resolved
could be annoying if there was no detection (and that all supported framework were generated):A single XML file could be generated and read like this :
(Instead of the current
ReadLinesFromFile
)