使用"在构建"上生成输出在ASP.NET 5(vNext)中给出"路径中的非法字符"构建错误

时间:2015-09-01 15:47:09

标签: asp.net tfs visual-studio-2015 asp.net-core

我正在处理的项目最初是使用Visual Studio 2015 RC中的模板和vNext的Beta 4创建的。 (编辑 - 现在使用Beta 6和VS2015 RTM。)我正在学习Team Foundation Server以自动化构建。

但是,在TFS中,构建失败并出现以下错误

1>    Using Assembly dependency framework/fx/System.Security 4.0.0.0 (TaskId:28)
1>      Source: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Security.dll (TaskId:28)
1>  The following commands will not be exported for global install: web. (TaskId:28)
1>  Exported application command: gen (TaskId:28)
1>  Exported application command: ef (TaskId:28)
1>  System.ArgumentException: Illegal characters in path. (TaskId:28)
1>     at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) (TaskId:28)
1>     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) (TaskId:28)
1>     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) (TaskId:28)
1>     at System.IO.File.Create(String path, Int32 bufferSize) (TaskId:28)
1>     at Microsoft.Framework.PackageManager.BuildManager.BuildInternal(String projectPath) (TaskId:28)
1>     at Microsoft.Framework.PackageManager.BuildManager.Build() (TaskId:28)
1>     at Microsoft.Framework.PackageManager.PackConsoleCommand.<>c__DisplayClass0_0.<Register>b__1() (TaskId:28)
1>     at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args) (TaskId:28)
1>     at Microsoft.Framework.PackageManager.Program.Main(String[] args) (TaskId:28)
1>  --- End of stack trace from previous location where exception was thrown --- (TaskId:28)
1>     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() (TaskId:28)
1>     at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider) (TaskId:28)
1>     at dnx.host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework) (TaskId:28)
1>     at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework) (TaskId:28)
1>     at dnx.host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework) (TaskId:28)
1>Done executing task "Dnx" -- FAILED. (TaskId:28)
1>Done building target "CoreCompile" in project "Redacted.xproj" -- FAILED.: (TargetId:50)

我终于通过检查&#34;在构建&#34;上生成输出,在我的本地构建中重现了这个。在项目属性中。这让我排除了TFS,但没有解决问题。

根据我的理解,该选项会导致&#34; dnu pack&#34;命令被调用。这似乎是在创建一个我们项目不需要的NuGet包。

1)有没有办法不创建NuGet包,仍然得到我在项目中需要的依赖项(gulp,rimraf等...)?也就是说,我可以让TFS不尝试运行dnu pack吗?

2)有没有办法看到导致构建错误的字符串? (我已经在&#34;诊断&#34;冗长。)

3)有没有办法解决构建错误?

global.json:

{
    "projects": [ "src", "test" ],
    "sdk": {
        "version": "1.0.0-beta6"
    }
}

的package.json

{
   "name": "Redacted",
   "version": "1.0.0",
   "private": true,
   "devDependencies": {
      "gulp": "3.9.0",
      "rimraf": "2.4.3",
      "gulp-bower": "0.0.10",
      "gulp-jshint": "^1.11.2",
      "jshint-stylish": "^2.0.1"
   }
}

project.json

{
   "webroot": "wwwroot",
   "userSecretsId": "aspnet5-Redacted-bdc273d1-1032-4bbe-8278-f448c6d1d546",
   "version": "1.0.0-beta6*",

   "dependencies": {
      "EntityFramework": "6.1.3",
      "Microsoft.AspNet.Mvc": "6.0.0-beta6",
      "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta6",
      "Microsoft.AspNet.Diagnostics": "1.0.0-beta6",
      "Microsoft.AspNet.Server.IIS": "1.0.0-beta6",
      "Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
      "Microsoft.AspNet.Session": "1.0.0-beta6",
      "Microsoft.AspNet.StaticFiles": "1.0.0-beta6",
      "Microsoft.AspNet.Tooling.Razor": "1.0.0-beta6",
      "Microsoft.Framework.Configuration": "1.0.0-beta6",
      "Microsoft.Framework.Configuration.Json": "1.0.0-beta6",
      "Microsoft.Framework.Logging": "1.0.0-beta6",
      "Microsoft.Framework.Logging.Console": "1.0.0-beta6",
      "Microsoft.AspNet.Mvc.Core": "6.0.0-beta6",
      "Microsoft.AspNet.Antiforgery": "1.0.0-beta6",
      "AutoMapper": "4.0.4",
      "HtmlAgilityPack": "1.4.9",
      "evopdf": "6.0",
      "Vereyon.Web.HtmlSanitizer": "1.1.1"
   },

   "commands": {
      "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://redacted:80;https://redacted:443",
      "gen": "Microsoft.Framework.CodeGeneration",
      "ef": "EntityFramework.Commands"
   },

   "frameworks": {
      "dnx451": {
         "frameworkAssemblies": {
            "System.Diagnostics.Debug": "",
            "System.Data": "",
            "System.Data.Entity": ""
         }
      }
   },

   "exclude": [
      "wwwroot",
      "node_modules",
      "bower_components"
   ],
   "publishExclude": [
      "node_modules",
      "bower_components",
      "**.xproj",
      "**.user",
      "**.vspscc"
   ],
   "scripts": {
      "postrestore": [ "npm install", "bower install" ],
      "prepare": [ "gulp copy" ]
   }
}

2 个答案:

答案 0 :(得分:3)

我对第1部分和第2部分没有答案,但这是第3部分的答案:

project.json的第4行有:

"version": "1.0.0-beta6*",

“路径中的非法字符”是该行末尾的星号。我通过从头开始创建一个新项目并慢慢地从旧项目中复制设置直到出现问题来解决这个问题。

答案 1 :(得分:0)

如果项目文件夹中有空格(可能与项目名称本身不同),则会出现此错误。