error BC32210: Multiple assemblies with equivalent identity have been imported - azure

I have an app that I'm trying to deploy to Azure using the Development Center. The app works great locally but when I check in my code and Azure starts the deployment process, it fails with the following message in reference to System.Xml.ReaderWriter.4.3.1:
error BC32210: Multiple assemblies with equivalent identity have been imported
The message is confusing because my packages.config only references the assembly once and the app builds fine locally.
How do I correct this problem?
Here's the full log entry:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0' from 'D:\Program Files (x86)\MSBuild\14.0\bin\amd64'.
Restoring NuGet package System.Xml.ReaderWriter.4.3.1.
GET https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.1/system.xml.readerwriter.4.3.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/system.xml.readerwriter/4.3.1/system.xml.readerwriter.4.3.1.nupkg 300ms
Installing System.Xml.ReaderWriter 4.3.1.
Adding package 'System.Xml.ReaderWriter.4.3.1' to folder 'D:\home\site\repository\packages'
Added package 'System.Xml.ReaderWriter.4.3.1' to folder 'D:\home\site\repository\packages'
NuGet Config files used:
C:\DWASFiles\Sites#1asdffdsa__fb6e\AppData\NuGet\NuGet.Config
Feeds used:
D:\home.nuget\
https://api.nuget.org/v3/index.json
Installed:
1 package(s) to packages.config projects
vbc : error BC32210: Multiple assemblies with equivalent identity have been imported: 'D:\home\site\repository\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll' and 'D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\System.Xml.ReaderWriter.dll'. Remove one of the duplicate references. [D:\home\site\repository\DiocesanClaims\DiocesanClaims.vbproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\DiocesanClaims\DiocesanClaims.vbproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d70fa465288676";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository.\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\82.10503.3890\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

I'm not sure exactly what the issue was or why it was a problem but luckily, I didn't need the assembly in question. I uninstalled it from the list of Nuget packages and I was able to deploy fine after that.

Related

error MSB4086: A numeric comparison was attempted on "$(MSBuildVersion)" that evaluates to "" instead of a number

Trying to deploy the project with Azure Kudu (reading from a BitBucket repo) I get the following error in Deployment Center within Azure Portal...
This error happened with all the latest versions of Microsoft.Net.Compilers NuGet package. The only version that worked was 3.0.0 from 5 months ago.
Anyone knows what's the cause of this? Is Azure Kudu not yet updated?
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Application deployment.
MSBuild auto-detection: using msbuild version '14.0.23107.0 built by: D14REL' from 'D:\Program Files (x86)\MSBuild\14.0\Bin'.
Restoring NuGet package Microsoft.Net.Compilers.3.1.1.
GET https://api.nuget.org/v3-flatcontainer/microsoft.net.compilers/3.1.1/microsoft.net.compilers.3.1.1.nupkg
OK https://api.nuget.org/v3-flatcontainer/microsoft.net.compilers/3.1.1/microsoft.net.compilers.3.1.1.nupkg 937ms
Installing Microsoft.Net.Compilers 3.1.1.
Adding package 'Microsoft.Net.Compilers.3.1.1' to folder 'D:\home\site\repository\packages'
Added package 'Microsoft.Net.Compilers.3.1.1' to folder 'D:\home\site\repository\packages'
NuGet Config files used:
D:\local\UserProfile\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
D:\home\.nuget\
https://api.nuget.org/v3/index.json
Installed:
1 package(s) to packages.config projects
D:\home\site\repository\packages\Microsoft.Net.Compilers.3.1.1\tools\Microsoft.Managed.Core.targets(63,60): error MSB4086: A numeric comparison was attempted on "$(MSBuildVersion)" that evaluates to "" instead of a number, in condition "$(MSBuildVersion) >= 16.1.0". [D:\home\site\repository\MyCompany\MyCompany.csproj]
Failed exitCode=1, command="D:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "D:\home\site\repository\MyCompany\MyCompany.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\8d727f56aa60788";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false /p:SolutionDir="D:\home\site\repository\.\\"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\84.10807.4030\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
### EDIT ###
I also opened an issue # Kudu GitHub repo.
I’ve had a similar issue with a kudu deployment and typescript versions. The basic issue seem to be that kudu is on its way out in favour of Azure DevOps so some dependencies of msbuild are becoming out of date. These are three options that might help you resolve the issue:
Switch to Azure DevOps - you’ll have access to various build agents and much more control over what they are capable of, but generally they’ll just be more up to date
Amend your build script - this is the script that kudu uses and you can customise it and then put it in source control, see this kudu doc for more info. Looks like you’re targeting msbuild 14 but I’m pretty sure 15 should be available and you can point your build script at this and/or make other tweaks
Process some of your build offline, ie before committing - this was my temporary solution with typescript, I was able to transpile to JavaScript and commit the js meaning I could disable typescript processing for kudu
It may also help to dig around in the targets file referenced in your log and trace back where the problem starts through the various msbuild conditions in that file. You can see all this by exploring via a command prompt in kudu.

GetServiceProjectReferences task could not From MSBuild

I am trying to build my Service Fabric application from powershell using "msbuild" command. I am getting the following exception.
I have the build components installed for VS 2017 at C:\Program Files
(x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin
I updated the ToolVersion in project to 15.0. But im still getting the same error.
Other than powershell any option to deploy service fabric application ( Not in azure)?
Project file contains ToolsVersion="14.0".
This toolset may be unknown or missing, in which case you may be able
to res olve this by installing the appropriate version of MSBuild, or
the build may have been forced to a particular ToolsVers ion for
policy reasons. Treating the project as if it had ToolsVersion="4.0".
For more information, please see http://g
o.microsoft.com/fwlink/?LinkId=291333.
C:\Directory\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.5\build\Microsoft.VisualStudio
.Azure.Fabric.Application.targets(94,5): error MSB4062: The
"GetServiceProjectReferences" task could not be loaded from the
assembly
C:\CodeBase\Directory\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.5\build\Microsof
t.VisualStudio.Azure.Fabric.BuildTasks.dll. Could not load file or
assembly 'Microsoft.Build.Utilities.Core, Version=14 .0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its
dependencies. The system cannot find the file s pecified. Confirm that
the declaration is correct, that the assembly and all its
dependencies are available , and that the task contains a public class
that implements Microsoft.Build.Framework.ITask.
[C:\CodeBase\Directory\Directory.sfproj] Done Building Project
"C:\CodeBase\Directory\Directory\Directory.sfproj" (default targets )
-- FAILED.

.net core azure deployment failing: Project file does not exist

I have an app-service app set up in Azure which is set to deploy upon commit into a team-services git repository. This has been working fine until now, and the deployment is failing with:
MSBUILD : error MSB1009: Project file does not exist.
However, If I open the azure console and CD to my project directory I can see that the project file (an asp.net core .xproj) does indeed exist. I know its in the correct directory from the output in the deployment log, showing that the packages are being restored:
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET Core Web Application deployment.
Restoring packages for D:\home\site\repository\IDPTest\src\IDPTest\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\home\site\repository\IDPTest\src\IDPTest\project.json...
Committing restore...
Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\IDPTest\src\IDPTest\project.lock.json
D:\home\site\repository\IDPTest\src\IDPTest\project.json
Restore completed in 10549ms.
Restoring packages for D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'BundlerMinifier.Core' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json...
Committing restore...
Lock file has not changed. Skipping lock file write. Path: D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.lock.json
D:\home\site\repository\IDPTest\src\IDPTest.MVCClient\project.json
Restore completed in 7119ms.
NuGet Config files used:
C:\DWASFiles\Sites\#1IDPTest\AppData\NuGet\NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Microsoft (R) Build Engine version 15.1.0.0
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: D:\home\site\repository\IDPTest\src\IDPTest.MVCClient
Failed exitCode=1, command=dotnet publish "D:\home\site\repository\IDPTest\src\IDPTest.MVCClient" --output "D:\local\Temp\8d40eb8007743fd" --configuration Release
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu\59.51109.2534\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd
"
Interestingly I have two app-service apps pointing at different projects in the same solution. Suddently they're both failing with the same error message even though they're deploying different projects...
Any help much appreciated.
Thanks
EDIT
I already had a global.json in my solution root (at the same level as my .sln file) but that was pointing at an older version of the SDK, so I updated this and it made no difference. I then tried getting rid of the 'test' project in the json file and that made no difference either. Still failing with the same error
Apparently you need to specify the SDK version explicitly in your global.json otherwise Kudu is using the latest which is now the preview3 one which is not compatible.
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}
Be careful, you global.json file should live at the root of your repository.
Details: https://social.msdn.microsoft.com/Forums/en-US/2a301f82-6a7a-4c03-ad4a-bd8714d72ba6/continious-deployment-of-aspnet-core-app-suddenly-starts-to-fail-today?forum=windowsazurewebsitespreview&prof=required

ASP.Net Core solution publishing wrong project

I created a new ASP.Net core project and set it up in source control which publishes to Azure when I do a check-in. I was able to get everything setup correctly and it was working fine.
However, I then added a class library project to the solution and now instead of publishing my website project the MSBuild task is attempting to publish my class library which of course fails.
The line in the deployment command is:
"%MSBUILD_PATH%" "%DEPLOYMENT_SOURCE%\MySolution.sln" /nologo /verbosity:m /p:deployOnBuild=True;AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release;UseSharedCompilation=false;publishUrl="%DEPLOYMENT_TEMP%"
And when that runs it first builds the models project which is fine:
D:\Program Files (x86)\dotnet\dotnet.exe build "D:\home\site\repository\MySolution.Models" --configuration Release --no-dependencies
But then it attempts to publish that project as well:
D:\Program Files (x86)\dotnet\dotnet.exe publish "D:\home\site\repository\MySolution.Models" --output "D:\local\Temp\PublishTemp\MySolution.Models71" --configuration Release --no-build
D:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): error : Can not find runtime target for framework '.NETStandard,Version=v1.6' compatible with one of the target runtimes: 'win8-x86, win7-x86'. Possible causes: [D:\home\site\repository\MySolution.Models\MySolution.Models.xproj]
Which is the wrong project (it should be the web project). I can't seem to find any files that contain the settings for this or the setting in the solution file itself.
What do I need to do for this to publish the correct project?
I was able to solve this by doing it in two steps.
First remove the deployOnBuild=True and the publishUrl=[snip] from the msbuild command. This means this step will build the project but doesn't do any publishing.
Next add a new step that does the publish.
To do this I first created a new variable to hold the location of the dotnet.exe:
IF DEFINED DOTNET_PATH goto DotNetPathDefined
SET DOTNET_PATH=%ProgramFiles(x86)%\dotnet\dotnet.exe
:DotNetPathDefined
Then add the following to do the publish of the web project:
call :ExecuteCmd "%DOTNET_PATH%" publish "%DEPLOYMENT_SOURCE%\MySolution.Web" --framework netcoreapp1.0 --output "%DEPLOYMENT_TEMP%" --configuration Release --no-build
IF !ERRORLEVEL! NEQ 0 goto error
This then publishes all the files to the deployment temp folder which then get deployed using the KuduSync step.

"Error: could not find a part of the path" during Azure web app deployment

I want to deploy an ASP.NET Core web app to Azure.
In my solution folder, I have 2 projects, both references Newtonsoft.Json library.
As I attempt to deploy through local Git repo, it shows an error at "Running deployment script", which results in the following activity log.
The error messages of the log hints that it tries to look for a bin folder within Newtonsoft.Json which doesn't exist. Any idea how to fix this and what is wrong?
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling ASP.NET 5 Web Application deployment.
'dnx-clr-win-x86.1.0.0-rc1-update1' is already installed in D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1.
Adding D:\local\UserProfile\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin to process PATH
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
CACHE https://api.nuget.org/v3/index.json
Restoring packages for D:\home\site\repository\src\NyxProjectGenerator\project.json
Writing lock file D:\home\site\repository\src\NyxProjectGenerator\project.lock.json
Restore complete, 2895ms elapsed
Restoring packages for D:\home\site\repository\wrap\Newtonsoft.Json\project.json
Writing lock file D:\home\site\repository\wrap\Newtonsoft.Json\project.lock.json
Restore complete, 18ms elapsed
Restoring packages for D:\home\site\repository\wrap\Xamasoft.JsonClassGenerator\project.json
Writing lock file D:\home\site\repository\wrap\Xamasoft.JsonClassGenerator\project.lock.json
Restore complete, 22ms elapsed
Total time 3330ms
Feeds used:
https://api.nuget.org/v3-flatcontainer/
Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16231
Copying to output path D:\local\Temp\8d34698522cd8f8
...
Using Package dependency System.Runtime.Extensions 4.0.0
Source D:\local\UserProfile\.dnx\packages\System.Runtime.Extensions\4.0.0
Error: Could not find a part of the path 'D:\home\site\repository\wrap\Newtonsoft.Json\bin\Debug\net451'.
Target D:\local\Temp\8d34698522cd8f8\approot\packages\System.Runtime.Extensions\4.0.0
...
Using Project dependency Newtonsoft.Json 1.0.0 for .NETFramework,Version=v4.5.1
Packing nupkg from Project dependency Newtonsoft.Json
Source D:\home\site\repository\wrap\Newtonsoft.Json\project.json
Target D:\local\Temp\8d34698522cd8f8\approot\packages\Newtonsoft.Json\1.0.0
Building Newtonsoft.Json for .NETFramework,Version=v4.5.1
Using Project dependency Newtonsoft.Json 1.0.0
Source: D:\home\site\repository\wrap\Newtonsoft.Json\project.json
Using Assembly dependency fx/mscorlib 4.0.0
Source: D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll
Using Assembly dependency fx/System 4.0.0
Source: D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll
Using Assembly dependency fx/System.Core 4.0.0
Source: D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Core.dll
Using Assembly dependency fx/Microsoft.CSharp 4.0.0
Source: D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Microsoft.CSharp.dll
An error has occurred during web site deployment.
Error: Could not find a part of the path 'D:\home\site\repository\wrap\Newtonsoft.Json\bin\Debug\net451'.\r\nc:\Program Files (x86)\SiteExtensions\Kudu\52.50302.2113\bin\scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"
This error message, which includes the "wrap" folder, suggests to me that you have added a ref to the Newtonsoft Assembly directly.
Error: Could not find a part of the path 'D:\home\site\repository\wrap\Newtonsoft.Json\bin\Debug\net451'
Instead you should reference Newtonsoft via a NuGet package ref in your project.json file
"dependencies": {
"Newtonsoft.Json": "8.0.2"
},

Resources