-
-
Notifications
You must be signed in to change notification settings - Fork 207
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
System.IO.FileNotFoundException : Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0 #692
Comments
Tests are running successfully under net6.0 and net7.0 with MsBuildStructuredLogger 2.1.815 |
2.18.820 throws an exception when tests are running on net6.0. See KirillOsenkov/MSBuildStructuredLog#692
We have the same error in our .NET 6 build after upgrading from 2.1.820 to 2.1.858 dnnsoftware/Dnn.Platform#5855 |
@bdukes are you able to reproduce this locally on your own machine? Try changing 820 to 858 locally as in the PR, then I did it using msbuild /r /m /bl build\Build.csproj and Microsoft.Build.Framework.dll does get copied to output: If I'm able to reproduce this locally I can certainly help. But right now I don't know which process fails, it's probably missing Microsoft.Build.Framework.dll in the output directory. To be able to investigate further, I need to have the exact local repro steps that I can try. I need to know which process is running, from what directory, and whether that directory contains Microsoft.Build.Framework.dll. I suspect that if you target |
I filed an issue here because I couldn't build Dnn: |
I got unblocked with Dnn, so I investigated some more. The build fails because That file is version 16.10, because of this set of PackageReferences: It is being copied from Cake.Issues.MSBuild: Although MSBuild.StructuredLogger does declare a dependency on Microsoft.Build.Framework 17.5.0, the layout of the package only includes the .dll for This means that Build.csproj is targeting I'll try to submit a workaround PR for this soonish. |
Oh, and the We probably need to bump Cake to both MSBuild 17.5 as well as the latest StructuredLogger, then bump Dnn to the latest Cake and StructuredLogger, then it'll all resolve itself. We'll still need a workaround to force the 17.5 version of Microsoft.Build.Framework.dll to get copied to output, because Dnn is still targeting net6.0. |
Thanks for the investigation @KirillOsenkov. I'm not sure I understand the issue correctly though. You mentioned the Cake.Issues.MsBuild version 3.0.0 which is used by DNN is built against MsBuildStructuredLogger 2.1.815. It also ships with the corresponding version of One issue I see here is that DNN additionally references @bdukes What's the reason you're referencing The reason why Cake.Issues.MsBuild ships with the dependencies instead of referencing them is for Cake Scripting runner to avoid versioning conflicts. In case of DNN Cake Frosting runner is used, wich is a standard .NET console application and where I could provide a different version of the assembly which would come with a reference to MsBuildStructuredLogger so that dependencies can be resolved at build time. Update of |
@pascalberger Thanks, I had forgotten that we'd manually added that reference and probably don't need it anymore. At one time, there was a mismatch between the version of the binary log that MSBuild produced and what Cake.Issues.MsBuild supported, so we were manually reading and reporting issues. Once Cake.Issues.MsBuild updated, we didn't remove the direct reference. |
@pascalberger I've made a sample of how to target <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSBuild.StructuredLogger" Version="2.1.858" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.5.0" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.5.0" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
</ItemGroup>
<ItemGroup>
<Reference Include="$(PkgMicrosoft_Build_Framework)\lib\net472\Microsoft.Build.Framework.dll" />
<Reference Include="$(PkgMicrosoft_Build_Utilities_Core)\lib\net472\Microsoft.Build.Utilities.Core.dll" />
</ItemGroup>
</Project> You only need this for net6.0, not for net7.0. It is unfortunate how the Microsoft.Build.Framework Nuget package is designed, it has the lib folder with Let me know if that helps. |
Is anyone here still blocked or needs any help? Otherwise I'll close the issue. The problem is that you need to make sure that the right Microsoft.Build.Framework.dll ends up in the same directory from where your assembly is. |
@KirillOsenkov Sorry, was still on my todo list to test your fix. Did it now and it indeed was the issue with the missing assemblies. The original issue I had reported has been resolved by this. Thank you very much ❤️ |
2.18.820 throws an exception when tests are running on net6.0. See KirillOsenkov/MSBuildStructuredLog#692
I'm referencing MSBuildStructuredLogger 2.1.820 in an assembly which is multi-targeted to net6.0 and net7.0. Unit tests on net.7.0 work fine, but tests on net6.0 fail with the following error:
Can be reproduced on the
release/3.0
branch of https://github.com/cake-contrib/Cake.Issues.MsBuild/tree/3.0.0Is there anything I can do to get the tests running under net6.0?
The text was updated successfully, but these errors were encountered: