I have a legacy Web Form application that runs on .NET Framework 4.8. I have created a build and release pipeline. The two pipelines run successfully and the application is deployed, but on loading the application, the runtime cannot find any of the dll files needed for the application to work.
The build uses these tasks:
The release
When I build the application on Visual Studio, a bin folder is generated as expected.
I’ve been stuck on this for some time now and i’ve searched extensively for solutions as to why the bin folder is not generating when the build or publish command is executed.
The packages for the DLLs are being restored and I am running the nuget restore command from the solution file
Further details:
The pipeline is using an agent job for the build and a deployment group job for the release using a virtual machine agent
I added a copy command to copy the files from the source directory to the staging directory
I am making use of a file share to publish the artifacts
The nuget restore command restores packages from nuget.org and a centralized artifact feed on Azure
Build log:
Build started 7/12/2023 12:16:28 PM.
Logging verbosity is set to: Detailed.Process = "H:Program FilesMicrosoft Visual Studio2019EnterpriseMSBuildCurrentBinmsbuild.exe"
MSBuild executable path = "H:Program FilesMicrosoft Visual Studio2019EnterpriseMSBuildCurrentBinmsbuild.exe"
Command line arguments = ""H:Program FilesMicrosoft Visual Studio2019EnterpriseMSBuildCurrentBinmsbuild.exe" "C:agents_work14sBPS.sln" /nologo /nr:false /fl /flp:"logfile=C:agents_work14sBPS.sln.log;verbosity=detailed" /dl:CentralLogger,"C:agents_work_tasksVSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda1.151.2ps_modulesMSBuildHelpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=a04548bd-5502-4326-80b0-1a4339df8a85|SolutionDir=C:agents_work14s"*ForwardingLogger,"C:agents_work_tasksVSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda1.151.2ps_modulesMSBuildHelpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="C:agents_work14a\" /p:platform="Any CPU" /p:configuration="Debug" /p:VisualStudioVersion="16.0" /p:_MSDeployUserAgent="TFS_7842cdc1-e646-44c6-9caa-e4fc5eaf2560_build_208_0""
Current directory = "C:agents_work_tasksVSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda1.151.2"
MSBuild version = "16.11.2+f32259642"
BPS: Defaulting .NET Framework v4.8 to the .NET Framework v4.0 version of aspnet_compiler.exe. To change the version of the tool used, please set the "ToolPath" parameter with the correct path to the tool.
BPS: Defaulting .NET Framework v4.8 to the .NET Framework v4.0 version of aspnet_compiler.exe. To change the version of the tool used, please set the "ToolPath" parameter with the correct path to the tool.
Project "C:agents_work14sBPS.sln" on node 1 (default targets).
Building with tools version "Current".
Target "ValidateSolutionConfiguration" in file "C:agents_work14sBPS.sln.metaproj" from project "C:agents_work14sBPS.sln" (entry point):
Task "Error" skipped, due to false condition; (('$(CurrentSolutionConfigurationContents)' == '') and ('$(SkipInvalidConfigurations)' != 'true')) was evaluated as (('<SolutionConfiguration>
<ProjectConfiguration Project="{5FA4972F-7390-4264-B5EC-083A69B2FD82}" AbsolutePath="C:agents_work14shttp://localhost/BPS" BuildProjectInSolution="True">Debug|AnyCPU</ProjectConfiguration>
</SolutionConfiguration>' == '') and ('true' != 'true')).
Task "Warning" skipped, due to false condition; (('$(CurrentSolutionConfigurationContents)' == '') and ('$(SkipInvalidConfigurations)' == 'true')) was evaluated as (('<SolutionConfiguration>
<ProjectConfiguration Project="{5FA4972F-7390-4264-B5EC-083A69B2FD82}" AbsolutePath="C:agents_work14shttp://localhost/BPS" BuildProjectInSolution="True">Debug|AnyCPU</ProjectConfiguration>
</SolutionConfiguration>' == '') and ('true' == 'true')).
Using "Message" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Message"
Building solution configuration "Debug|Any CPU".
Done executing task "Message".
Done building target "ValidateSolutionConfiguration" in project "BPS.sln".
Target "ValidateToolsVersions" in file "C:agents_work14sBPS.sln.metaproj" from project "C:agents_work14sBPS.sln" (entry point):
Task "Error" skipped, due to false condition; ('$(MSBuildToolsVersion)' == '2.0' and ('$(ProjectToolsVersion)' != '2.0' and '$(ProjectToolsVersion)' != '')) was evaluated as ('Current' == '2.0' and ('' != '2.0' and '' != '')).
Done building target "ValidateToolsVersions" in project "BPS.sln".
Target "ValidateProjects" in file "C:agents_work14sBPS.sln.metaproj" from project "C:agents_work14sBPS.sln" (entry point):
Task "Warning" skipped, due to false condition; ( ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') ) was evaluated as ( ('Debug' == 'Release') and ('Any CPU' == 'Any CPU') ).
Done building target "ValidateProjects" in project "BPS.sln".
Target "Build" in file "C:agents_work14sBPS.sln.metaproj" from project "C:agents_work14sBPS.sln" (entry point):
Using "MSBuild" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "MSBuild"
Global Properties:
BuildingSolutionFile=true
CurrentSolutionConfigurationContents=<SolutionConfiguration>
<ProjectConfiguration Project="{5FA4972F-7390-4264-B5EC-083A69B2FD82}" AbsolutePath="C:agents_work14shttp://localhost/BPS" BuildProjectInSolution="True">Debug|AnyCPU</ProjectConfiguration>
</SolutionConfiguration>
SolutionDir=C:agents_work14s
SolutionExt=.sln
SolutionFileName=BPS.sln
SolutionName=BPS
SolutionPath=C:agents_work14sBPS.sln
Additional Properties for project "C:agents_work14sBPS.metaproj":
Configuration=Debug
Platform=Any CPU
Project "C:agents_work14sBPS.sln" (1) is building "C:agents_work14sBPS.metaproj" (2) on node 1 (default targets).
Building with tools version "Current".
Target "GetFrameworkPathAndRedistList" in project "C:agents_work14sBPS.metaproj" (target "Build" depends on it):
Using "GetFrameworkPath" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "GetFrameworkPath"
Done executing task "GetFrameworkPath".
Using "CreateItem" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CreateItem"
Done executing task "CreateItem".
Done building target "GetFrameworkPathAndRedistList" in project "BPS.metaproj".
Target "Build" in project "C:agents_work14sBPS.metaproj" (entry point):
Task "MSBuild"
Done executing task "MSBuild".
Task "CreateItem"
Done executing task "CreateItem".
Task "ReadLinesFromFile" skipped, due to false condition; ( '%(Project_5FA4972F-7390-4264-B5EC-083A69B2FD82_References_RefreshFile.Identity)' != '' ) was evaluated as ( '' != '' ).
Using "CombinePath" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CombinePath"
Done executing task "CombinePath".
Using "Copy" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Copy"
Done executing task "Copy".
Using "GetReferenceAssemblyPaths" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "GetReferenceAssemblyPaths"
Done executing task "GetReferenceAssemblyPaths".
Task "ResolveAssemblyReference" skipped, due to false condition; (Exists('%(Project_5FA4972F-7390-4264-B5EC-083A69B2FD82_References.Identity)')) was evaluated as (Exists('')).
Task "Copy"
Done executing task "Copy".
Using "AspNetCompiler" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "AspNetCompiler"
C:WindowsMicrosoft.NETFrameworkv4.0.30319aspnet_compiler.exe -v /BPS -p ..........inetpubwwwrootBPS -u -f -d PrecompiledWebBPS
Microsoft (R) ASP.NET Compilation Tool version 4.8.3761.0
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
Done executing task "AspNetCompiler".
Task "Message" skipped, due to false condition; (!((false) or ('$(AspNetConfiguration)' == 'Debug') or ('$(AspNetConfiguration)' == 'Release'))) was evaluated as (!((false) or ('Debug' == 'Debug') or ('Debug' == 'Release'))).
Done building target "Build" in project "BPS.metaproj".
Done Building Project "C:agents_work14sBPS.metaproj" (default targets).
Done executing task "MSBuild".
Done building target "Build" in project "BPS.sln".
Done Building Project "C:agents_work14sBPS.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
2
Answers
Okay, so my problem is much deeper than I thought. On doing more research and checking the code (I am a DevOps engineer; this is not my code). I discovered that the application was created without a project file. Apart from that, the application is configured as a website, not a web application. I have to convert it, start a new project, and then add the code until it builds and works properly.
I tried building a >net app with 4.8 and the build was successful in Azure Release pipeline. In the copy task the bin folder was also copied successfully.
My Build logs creating bin folder correctly:-
Copy files task:-
Double check if the DLL files are available in the Build Artifacts. Try to build the application locally and in Visual studio inspect bin folder from Project Build in the properties tab of Visual studio. And check if the path is correctly set to /bin. Check if the build path is correctly set up with your application.
My Release pipeline tasks:-
Use Nuget 5.8:-
Nuget restore:-
**Build solution *sln
VsTest -testAssemblies:-
Copy Files to $(build.artifactsstagingdirectory):-
My repository:-