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
MSB3246 should say *which* file #3650
Comments
Talked with @shanselman who saw this on a machine where he'd also found several zero-byte files, which led to a nice repro: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="deliberately.zero.bytes.dll" />
</ItemGroup>
<Target Name="WriteZeroByteFile" BeforeTargets="ResolveAssemblyReferences">
<Touch Files="deliberately.zero.bytes.dll" AlwaysCreate="true" />
</Target>
</Project> Which leads to $ dotnet build /flp:v=diag
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 57.05 ms for S:\work\zero-byte-ref\zero-byte-ref.csproj.
C:\Program Files\dotnet\sdk\2.1.400\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Image is too small. [S:\work\zero-byte-ref\zero-byte-ref.csproj]
zero-byte-ref -> S:\work\zero-byte-ref\bin\Debug\netstandard2.0\zero-byte-ref.dll
Build succeeded.
C:\Program Files\dotnet\sdk\2.1.400\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Image is too small. [S:\work\zero-byte-ref\zero-byte-ref.csproj]
1 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.44 And in the diag log
So there's enough information to debug if you happened to up your logging level. |
fyi / other context - since @shanselman also found my SO answer while researching this live on youtube (https://stackoverflow.com/questions/48122173/warning-when-using-nuget-package-that-contains-native-dll) |
https://github.com/Microsoft/msbuild/blob/a8fba1ebd7b10ea68fcbdb8144a31496f8c37ce7/src/Tasks/Resources/Strings.resx#L1423-L1424
logged from
https://github.com/Microsoft/msbuild/blob/a8fba1ebd7b10ea68fcbdb8144a31496f8c37ce7/src/Tasks/AssemblyDependency/ResolveAssemblyReference.cs#L1523-L1528
Doesn't name a file, so you have to dig through more information to do anything about it.
Looks like everything in that block should list the reference in its error.
The text was updated successfully, but these errors were encountered: