发布MVC 4应用程序异常..,指定的路径,文件名或两者都太长

时间:2012-12-10 15:22:49

标签: visual-studio-2012 publish-subscribe

我正在尝试使用文件系统方法发布网站。我在visual studio 2010中使用了这种方法,并没有遇到很多问题。但是我在visual studio 2012中尝试时收到了上述错误。完整的错误在下面......

Error : Copying file Service References\ACOServiceReference\FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource to obj\Release\Package\PackageTmp\Service References\ACOServiceReference\FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource failed. 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.

我错过了什么或做错了什么?显然文件路径太长了,但有没有办法可以创建路径变量或缩短路径名?我该如何设置?

2 个答案:

答案 0 :(得分:6)

不,你不能缩短它,因为Windows将使用完全限定名称(C:\ aaa \ aaa ...)。

两种解决方案:

  1. 缩短命名空间(FocusedReadMissionsRedux.ACOServiceReference.searchPatientbyDemographicsResponse.datasource
  2. 更改项目的位置(即D:\ Code \ ProjectOne)

答案 1 :(得分:5)

我能够通过导航到Reference.svcmap下的服务引用下的文件来解决我的项目中的这个问题。选择其中每个并将构建操作从Content更改为none。应用程序通常不需要这些文件,因此不需要发布它们。