简体   繁体   中英

TeamCity WindowsAzure.targets causing errors in deployment

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:

  1. Making sure the latest Visual Studio Update is installed (for MSBuild)
  2. Running the install tool to repair Azure Tools 2.7 on the build server.
  3. Changing the debug configuration in the build.
  4. 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]
  5. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM