How can you control the file names for .NET Service References?
Asked Answered
C

2

16

Windows has a limitation of 259 characters in paths. Unfortunately, this is starting to cause problems for us due to some of our Service Reference names.

For example, we have our TFS branch with an already-long path, and then .NET service references nearly double this because they always use the fully-qualified namespace as the file name:

Some.Really.Long.Fully.Qualified.Namespace.Service.Reference.Name.datasource

AFAIK, you can't change the name of the service reference -- but Ihoping I'm wrong. Can this be done?

If not, are there any other possible workarounds to this annoying issue?

EDIT: Also, I know one obvious solution would be to shorten our namespaces and/or paths, but assume we can't do that in this case. :) I'm mainly trying to figure out how to control the file names for the service references.

UPDATE: The root issue I'm having is where TFS is not letting me get latest on a particular branch. Here is the exact error:

TF205022: The following path contains more than the allowed 259 characters: [C:\Some-really-long-259-character-path-here]

Copyread answered 1/9, 2011 at 14:50 Comment(0)
C
14

Turns out, these .datasource files can be deleted, as they are not needed to build the project. So we just did a sweep of all .datasource files in TFS, and deleted them.

This article talks more about this.

Copyread answered 3/10, 2011 at 20:52 Comment(0)
L
-3

259? in fact is 32 k by NTFS but Windows Explorer limits to "256", there are certain Windows APIs which allow to create and handle longer paths up to the real limit of NTFS ~32k, the proper power of 2, but most of the software does not really use those native apis...

see here: Maximum filename length in NTFS (Windows XP and Windows Vista)?.

A possibility would be to use junction tool from Sys Internals and junction your long branch path to something much shorter directly in C#, everything should then work because you would only use relative paths, I suppose.

Leverage answered 1/9, 2011 at 15:32 Comment(1)
Thanks for your response. You are correct, the limit is 256. I was mislead by the error I got from TFS (see the above update), as if it allowed up to 259 characters.Copyread

© 2022 - 2024 — McMap. All rights reserved.