开发者

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

开发者 https://www.devze.com 2023-04-01 02:19 出处:网络
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.

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 ot开发者_如何学JAVAher 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]


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消