Open circusboy opened 2 years ago
Welcome to the FAKE community! Thank you so much for creating your first issue and therefore improving the project!
Had the same issue on the GitHub action for the build. It seems due to the release of .NET 7. The dependency resolution in the script uses the newer versions of build packages that are released with .NET 7. We fixed it in FAKE by pinning the packages in the build script:
nuget Microsoft.Build 17.3.2
nuget Microsoft.Build.Framework 17.3.2
nuget Microsoft.Build.Tasks.Core 17.3.2
nuget Microsoft.Build.Utilities.Core 17.3.2
Just ran into it and had a quick workaround thanks to your comments here :)
Should fake.dotnet.msbuild list the nuget dependency to prevent this or did i miss something? at least it it not listed here https://www.nuget.org/packages/Fake.DotNet.MSBuild/5.23.1#dependencies-body-tab
There's a related part of this - components that want to use the version of MSBuild shipped with the .NET SDK should not actually copy the MSBuild dlls to the application directory. This can be done via the use of ExcludeAssets="runtime"
or copy_local: false
. Then, MSBuildLocator can be used to discover and load the SDK MSBuild assemblies. This is how projects like Ionide.ProjInfo and Buildalyzer work, and IMO it's how all MSbuild-using utilities should work. Unfortunately, NuGet doesn't allow marking these dependencies in a way that would make the ExcludeAssets="runtime"
happen automatically.
when I use dotnet fake build
to run run my csharp project, I also got the similar issue as follow:
Resolving dependency graph...
- FSharp.Core is pinned to 6.0.0
Could not detect any platforms from 'net7.0' in System.Collections.Immutable 7.0.0, please tell the package authors
Could not detect any platforms from 'net7.0' in Microsoft.Build.Framework 17.5.0, please tell the package authors
Could not detect any platforms from 'net7.0' in Microsoft.Build.Utilities.Core 17.5.0, please tell the package authors
Could not detect any platforms from 'net7.0' in Microsoft.NET.StringTools 17.5.0, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Security.Permissions 7.0.0, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Configuration.ConfigurationManager 7.0.0, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Text.Encoding.CodePages 7.0.0, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Security.Cryptography.Pkcs 7.0.1, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Security.Cryptography.ProtectedData 7.0.1, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Formats.Asn1 7.0.0, please tell the package authors
Could not detect any platforms from 'net7.0' in System.Windows.Extensions 7.0.0, please tell the package authors
my local env just installed .net6.0
SDKs and have installed fake-cli
with 5.23.1
, but I don't know that it always to find net7.0
.
Feel free if you have any idea about this error ?
Had the same issue on the GitHub action for the build. It seems due to the release of .NET 7. The dependency resolution in the script uses the newer versions of build packages that are released with .NET 7. We fixed it in FAKE by pinning the packages in the build script:
nuget Microsoft.Build 17.3.2 nuget Microsoft.Build.Framework 17.3.2 nuget Microsoft.Build.Tasks.Core 17.3.2 nuget Microsoft.Build.Utilities.Core 17.3.2
Meanwhile this works for this issue, it opens another problem:
More recent versions of MSBuild.StructuredLogger have dependency to Microsoft.Build >= 17.5
.
If you try to use old version of MSBuild.StructuredLogger then you'll get this another error:
Unsupported log file format. Latest supported version is 14, the log file has version 18.
...which is listed e.g. here
Could FAKE do somehow copylocal=true for this dependency to .fake folder?
There's a related part of this - components that want to use the version of MSBuild shipped with the .NET SDK should not actually copy the MSBuild dlls to the application directory. This can be done via the use of
ExcludeAssets="runtime"
orcopy_local: false
. Then, MSBuildLocator can be used to discover and load the SDK MSBuild assemblies. This is how projects like Ionide.ProjInfo and Buildalyzer work, and IMO it's how all MSbuild-using utilities should work. Unfortunately, NuGet doesn't allow marking these dependencies in a way that would make theExcludeAssets="runtime"
happen automatically.
fwiw I was having a poke about at the build in https://github.com/fsprojects/FAKE/pull/2825 whilst seeing how some things work, and it looks to me like the Microsoft.Build.*
dlls being in the build for fake-cli is an artifact of how the libraries are arranged, and that it should be possible to remove the transitive dependencies by shuffling things about a bit.
Description
FAKE throws a
BuildFailedException
when runningDotNet.publish
. An inner exception indicates that FAKE is trying to loadMicrosoft.Build.Framework, Version=15.1.0.0
, which doesn't seem to exist on my machine.I encountered this problem on a colleague's machine. I couldn't reproduce it on my own machine (which has been using this build script for several years now) until I removed the lockfile and the
.fake
folder before running the build script.Repro steps
Create a build target containing something like the following:
Run the task with something like
fake -v run build.fsx -t BuildTestBE
Expected behavior
I expect the task to succeed, and the project to be published to the target folder.
Actual behavior
The build fails at
DotNet:publish
:Known workarounds
Following the steps suggested in the error above didn't help, but disabling the internal binlog solved the problem:
Related information
OS Name: Microsoft Windows 10 Enterprise OS Version: 10.0.19044 N/A Build 19044
FAKE 5 - F# Make (5.23.1) (this line is written to standard error, see https://github.com/fsharp/FAKE/issues/2066) FakePath: C:\Users\user.dotnet\tools.store\fake-cli\5.23.1\fake-cli\5.23.1\tools\net6.0\any\Fake.Runtime.dll Paket.Core: 6.2.1
Microsoft Visual Studio Enterprise 2022 Version 17.3.5 Installed Version: Enterprise