简体   繁体   中英

Wrong --out in TFS 2015 dnu publish

When i try to publish my asp.net core webapplication in TFS 2015 it fails the build task with "DNU(0,0): Error : The specified path, file name, or both are too long". When troubleshooting i realized that the dnu.cmd publish had the following parameters:

C:\\Windows\\ServiceProfiles\\NetworkService.dnx\\runtimes\\dnx-clr-win-x86.1.0.0-rc1-update1\\bin\\dnu.cmd publish "D:\\TFSAgent_work\\19\\s\\code\\src\\WebsiteApp" --out "C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Local\\Temp\\PublishTemp\\WebsiteApp59" --configuration Release --runtime dnx-clr-win-x86.1.0.0-rc1-update1 --wwwroot "wwwroot" --wwwroot-out "wwwroot" --iis-command "web"

The MSBuild arguments in TFS is set to:

/P:PublishProfile=PubStaging /P:DeployOnBuild=True

So the build fails when copying files:

Using Package dependency Microsoft.AspNet.Http.Features 1.0.0-rc1-final Source C:\\Windows\\ServiceProfiles\\NetworkService.dnx\\packages\\Microsoft.AspNet.Http.Features\\1.0.0-rc1-final Target C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Local\\Temp\\PublishTemp\\WebsiteApp59\\approot\\packages\\Microsoft.AspNet.Http.Features\\1.0.0-rc1-final

DNU(0,0): Error : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

The TFS server is running under the NetworkService, but the output should go into "....\\artifacts\\PublishOutput" according to my publish profile.

Can anyone give me a hint how to proceed?

Check this case:

  1. Powershell script "prebuild.ps1" as per the previous answer and Microsoft deployment guidelines: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5

  2. Vanilla MSBuild build. no switches or special settings.

  3. Powershell script to run "dnu publish". This creates a directory of the entire web application's structure.

  4. "Windows File Copy" task to deploy the directory structure created in #4 to all of the target machines in the test environment.

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