我有一个非常大的ASP.NET
网络应用程序。我总是通过Visual Studio 2015发布到文件系统,右键单击我的Web项目并选择Publish...
。这很完美,但现在我试图自动化这个过程,并且我试图在命令行中进行这个发布过程。我正在运行的工作目录设置为.csproj
所在的目录:
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" MyProj.csproj /p:DeployOnBuild=true /p:PublishProfile="Properties\PublishProfiles\MCF New Arch.pubxml" /p:VisualStudioVersion=14.0
编译似乎在经过一些努力之后才有效,但在此之后我收到了这个错误:
"C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj" (default target) (1) ->
(CollectFilesFromProjectFolder target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProje
ctFolder.targets(135,5): error MSB4018: The "CollectFilesinFolder" task failed unexpectedly.\r [C:\Users\Andres Torti\G
it-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: System.IO.PathTooLongException: The specified path, file name, or both are too lo
ng. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 charac
ters.\r [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.PathHelper.GetFullPathName()\r [C:\Users\Andres Torti\Git-Repos\M
CF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 ma
xPathLength, Boolean expandShortPaths)\r [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathL
ength, Boolean expandShortPaths)\r [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.Path.GetFullPathInternal(String path)\r [C:\Users\Andres Torti\Gi
t-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String original
UserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r [C
:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption
searchOption)\r [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at System.IO.DirectoryInfo.GetFiles()\r [C:\Users\Andres Torti\Git-Repos\MCF\S
ur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.CollectAllFiles(String
rootPath, DirectoryInfo dirinfo, Boolean recursive, List`1 result, Boolean defaultInclude, Regex[] fullPathMatchs, Rege
x[] relativePathMatchs, Regex[] excludeFullPathMatchs, Regex[] excludeRelativePathMatchs)\r [C:\Users\Andres Torti\Git-
Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.CollectFilesinFolder.Execute()\r [C:\Users\A
ndres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExec
utionHost.Execute()\r [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\CollectFiles\Microsoft.Web.Publishing.AllFilesInProject
Folder.targets(135,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext
() [C:\Users\Andres Torti\Git-Repos\MCF\Sur3D.App\MyProj.csproj]
我认为在运行System.IO.PathTooLongException
时获得Microsoft.Web.Publishing.AllFilesInProjectFolder.targets
。我看到人们在SO中遇到这个问题但是从VS发布时。在我的情况下,VS发布工作完美但从命令行执行时失败。我错过了什么吗?