johanclasson / vso-agent-tasks

Build and Release Tasks for Visual Studio Online and Team Foundation Server
MIT License
20 stars 16 forks source link

PathTooLongException #25

Closed perp1exed closed 6 years ago

perp1exed commented 7 years ago

Attempting to deploy scripts using VS database prodject. Script set to Not Build.

I get the error: System.IO.PathTooLongException: 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 longest file path is 108 chracters so not sure why this is occurring.

Here is the longest file path: E:\vstsagent_work\975ffc9f4\ITXDB.MAIN\Database_Scripts\1. UID Updates\MatterTypeCategoriesUpdateScript.sql

Any help appreciated.

thanks, KS

johanclasson commented 7 years ago

I have not been able to reproduce this. Can you link me to your solution (example or real one) so I can investigate?

perp1exed commented 7 years ago

ITX Database.zip

Attached is solution. Thank you.

johanclasson commented 7 years ago

The solution you provided contained scripts that depend on that there would already be some tables present...

But as a work around a cleared all *.sql-scripts from content, and ran them through the DbUpMigration task. And everything seamed to work.

In my case the paths were even longer than your example obove (129 chars at max).

...
C:\git\vso-agent-tasks\DbUpMigration\test\sql\long\ITXDatabaseUpdate_07052017\1. UID Updates\MatterStatusUpdateScript.sql
C:\git\vso-agent-tasks\DbUpMigration\test\sql\long\ITXDatabaseUpdate_07052017\1. UID Updates\MatterTypeCategoriesUpdateScript.sql
C:\git\vso-agent-tasks\DbUpMigration\test\sql\long\ITXDatabaseUpdate_07052017\1. UID Updates\MatterTypesUpdateScript.sql
C:\git\vso-agent-tasks\DbUpMigration\test\sql\long\ITXDatabaseUpdate_07052017\1. UID Updates\MediaActivitiesUpdateScript.sql
C:\git\vso-agent-tasks\DbUpMigration\test\sql\long\ITXDatabaseUpdate_07052017\1. UID Updates\NuancesUpdateScript.sql
...

I have a theory that something powershelly works different on your build server that runs the task than on my machine. Can you execute $PSVersionTable in a powershell-console and post its content for me?

Here is mine:

Name                           Value
----                           -----
PSVersion                      5.1.15063.502
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.502
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Or do you perhaps run the task on the VSTS Hosted Build Agents?

johanclasson commented 6 years ago

Since I have not heard any more about this error, or been able to reproduce it i will close this. Please reopen if you are still having this issue!