I am upgrading an Asp.Net Website project to .net framework 4.8 from 4.7. After upgrading, the project builds successfully from visual studio and also running without any issue on local machine. When same project is published using MSBuild I am getting following error:
(AspNetMerge target) ->
aspnet_merge : error occurred: An error occurred when merging assemblies: Unresolved assembly reference not allowed: System.Net.Http.
MsBuild command used is:
msbuild.exe "D:\Enterprise\Enterprise.sln" /nologo /nr:false /t:Build /p:DeployOnBuild=true /p:Configuration=Release /p:PublishProfile=VSO
And VSO.pubxml file referenced here has following configuration:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>..\..\Publish\Web</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>MergedAssembly</SingleAssemblyName>
</PropertyGroup>
</Project>
You can see that <UseMerge>
is set to true
which will merge output to single assembly.
I tried by disabling merge altogether which fixed the issue, but I want to keep the merge option enabled as it was configured this way in the release pipeline earlier. Any help will be appreciated.