I've a .Net 4.7.6 solution with 400 projects. Some of those projects are referencing local DLL, some are using nugets packages.
Everything is building fine on our VS, everything is building fine on our build machine(with MSBuild), but once we pushed everything on Azure DevOps, we have a bunch of referenced DLL(not all) that doesn't load:
One example coming from package would be Log4Net:
##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2084,5): Warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'log4net.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
(and obviously, it fails after because not finding it:)
##[error]Src\External\NModbus\Modbus\Device\ModbusMasterTcpConnection.cs(20,7): Error CS0246: The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?)
Same errors for some locals DLL:
##[warning]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2084,5): Warning MSB3246: Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'Unme.Common.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
##[error]Src\External\NModbus\Modbus\Data\DataStore.cs(16,7): Error CS0246: The type or namespace name 'Unme' could not be found (are you missing a using directive or an assembly reference?)
Not sure what I'm missing? What could be different regarding the loadable DLL between our VS Studio of the whole team and azure?
Here is our current build definition:
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: 'Solution/SomeSolution.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
inputs:
versionSpec: '>=5.4'
checkLatest: true
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: Assembly-Info-NetFramework@2
inputs:
Path: '$(Build.SourcesDirectory)'
FileNames: |
**\AssemblyInfo.cs
InsertAttributes: false
FileEncoding: 'auto'
WriteBOM: false
VersionNumber: '5.1.0.*'
FileVersionNumber: '5.1.0.*'
LogLevel: 'verbose'
FailOnWarning: false
- task: MSBuild@1
inputs:
solution: '$(solution)'
msbuildVersion: latest
msbuildArchitecture: x86
platform: 'Any CPU'
configuration: 'Debug'
maximumCpuCount: true
- task: VSTest@2
inputs:
DisableTelemetry: false
testSelector: 'testAssemblies'
testAssemblyVer2: '$(solution)'
searchFolder: '$(System.DefaultWorkingDirectory)'
codeCoverageEnabled: true
platform: 'Any CPU'
configuration: 'Debug'
rerunFailedTests: false
it makes one day that I'm stuck on this, quite frustrating :'(