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.
Related
My build pipeline (Microsoft-hosted agent) has been running every morning for a couple of months but this morning it suddenly failed on the VSBuild task. The error is described as:
"##[error]ASPNETCOMPILER(0,0): Error ASPCONFIG: The CodeDom provider type "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" could not be located."
See image of failed build here
How do i fix this?
Not sure if you use private agent. As I know this error could result from the fact that PrecompileBeforePublish property is set to true somewhere in your project.(csproj or publish profile).
As one workaround you can pass /p:PrecompileBeforePublish=false as argument to your VSBuild Task. But this may make first response of your application slow.
Or you can register it into GAC using command like this:
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\xxxx\VSEditon\Common7\IDE\PublicAssemblies\CppCodeProvider.dll"
Cause after VS2017, the C++ project support for xsd.exe is deprecated, we need to manually add its assembly into GAC as described here.
I managed to solve this by just skipping build on the assets project that failed. This was done using the Configuration Manager in Visual Studio (found in Build->Configuration Manager). I just removed the check mark. See attached images for clarification.
Skip project build
Configuration Manager
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.
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.
We are currently trying to setup an Angular 2 project that also contains a Cloud Service project in its solution. We have set up numerous Angular 1 projects containing Cloud Service projects and have had no errors. When trying to run the MSBuild step for the Angular 2 project, we get the following error on the TeamCity build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.7\Microsoft.WindowsAzure.targets(2787, 5): error MSB3021: Unable to copy file "C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs" to "C:\SourceControlFolder\Apps\MyApp\MyApp.CloudDeployment\obj\Debug\Website\C:\TeamCityBuildAgent\temp\buildTmp\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs". The given path's format is not supported.
The main problem seems to be the build attempting to throw the full C:\TeamCityBuildAgent.. path into the obj\Debug\Website folder.
My current MSBuild parameters are:
/p:Configuration="Dev"
/p:platform="Any CPU"
/p:OctoPackEnforceAddingFiles=true
/p:OctoPackProjectName=MyApp_Dev
I've tried the following solutions:
Making sure the latest Visual Studio Update is installed (for MSBuild)
Running the install tool to repair Azure Tools 2.7 on the build server.
Changing the debug configuration in the build.
Ensuring TypeScript 1.7.6 is installed on the build server (even though it's an Azure.targets issue) [https://github.com/Microsoft/TypeScript/issues/6215]
Updated the project to Azure Tools 2.9. The same error remains except it's failing on the 2.9 folder instead now.
Curious if anyone else has experienced this error and knows a fix. I'll keep this post updated as I try other solutions.
Update
It appears that what is causing this issue is this line within the .csproj file:
<FilesToIncludeForPublish>AllFilesInProjectFolder</FilesToIncludeForPublish>
This is specified for our build configurations to copy all files generated by the ng build to the output directory of the publish. What I don't understand at the moment is how this works on all of the devs' local machines but does not work on our build server. Will keep this posted as I find more info or any kind of workaround.
This ended up being the fix:
Instead of targeting the .sln in MSBuild, we specifically targeted the .csproj file. This fixed the build errors and allowed us to keep the FilesToIncludeForPublish tag inside.
I am trying to setup the build integration between tfs and sharepoint.
We have a separate build server. We have followed these steps and checked them for correctness 3 times. However on sharepoint builds, we keep having this error. And yes the files exists on the build server.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (416): Could not load file or assembly 'Microsoft.VisualStudio.SharePoint.Designers.Models, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
Please advice.
Update 1:
1. When I remove the .SLN from the build definition and add the csproj one by one, the build completes but I get this warning for each project (10 times)
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets (610): The OutputPath property is not set for project 'Pwc.SP.DMS.CLF.CustomContentField.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Any CPU'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project
I set /p:IsPackaging=true however in the drop folder I only see log files, there are no wsps or dlls.
If I remove the csproj and add the .sln then I get this error again:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets (416): Could not load file or assembly 'Microsoft.VisualStudio.SharePoint.Designers.Models, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified
If you copied the assembly to the build server, you may not have copied all the assemblies that Microsoft.VisualStudio.SharePoint.Designers.Models depends on. I would use Reflector or some kind of disassembler to view the dependencies. Once you have them all there, you should stop seeing loading issues. Sometimes, the issue relates to the architecture of the process running on the build server.
I would manually build the solution or project using msbuild on the build server i.e.
msbuild a.sln /p:OutDir=e:\dir\ /p:Configuration=Release /p:Platform="Any CPU"
msbuild a.csproj /p:OutDir=e:\dir\ /p:Configuration=Release /p:Platform=AnyCPU