What's the illegal character in this string ?

2019-06-27 05:30发布

问题:

I was creating some build definitions in TFS2010 without problem until now.

MSBUILD Command:


C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe /nologo /noconsolelogger "C:\Builds\Neptune\Sources\\Branches\v5.0-Ehub\EHub-5.0.sln" /m:1 /fl /flp:"logfile=C:\Builds\Neptune\Sources\\Branches\v5.0-Ehub\EHub-5.0.log;encoding=Unicode;verbosity=detailed" /p:SkipInvalidConfigurations=true /p:OutDir="C:\Builds\Neptune\Binaries\\" /p:Configuration="Site" /p:Platform="Mixed Platforms" /p:RunCodeAnalysis="False" /p:VCBuildOverride="C:\Builds\Neptune\Sources\\Branches\v5.0-Ehub\EHub-5.0.sln.Mixed Platforms.Site.vsprops" /dl:WorkflowCentralLogger,"C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;BuildUri=vstfs:///Build/Build/1222;InformationNodeId=2168680;TargetsNotLogged=GetNativeManifest,GetCopyToOutputDirectoryItems,GetTargetPath;TFSUrl=http://ldu01:8080/tfs/Nova.com;"*WorkflowForwardingLogger,"C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Microsoft.TeamFoundation.Build.Server.Logger.dll";"Verbosity=Detailed;"

I'm getting this error:


(Site target) -> MSBUILD : error MSB3095: Invalid argument. Illegal characters in path. [C:\Builds\Neptune\Sources\Branches\v5.0-EHub\EHub-5.0.sln]

Yet I don't see anything illegal in the path, it's just a plain path and it works. What is going on?


EDIT: Removed the double slashes, removed the extra dot, removed the minus sign, nothing worked.

EDIT: Let me be more specific. It builds part of the solution, but as soon as it gets to a point, it gives me this error and returns.

EDIT: Yet more details. the specific lines where it seems to fail:

Using "CombinePath" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CombinePath"
MSBUILD : error MSB3095: Invalid argument. Illegal characters in path. [C:\Builds\Pluto\Sources\Branches\v5.0-Ehub\EHub-5.0.sln]
Done executing task "CombinePath" -- FAILED.
Done building target "Site" in project "EHub-5.0.sln" -- FAILED.
Done executing task "CallTarget" -- FAILED.
Done building target "Build" in project "EHub-5.0.sln" -- FAILED.
Done Building Project "C:\Builds\Pluto\Sources\Branches\v5.0-Ehub\EHub-5.0.sln" (default targets) -- FAILED.

回答1:

Surprisingly (or not), it seems the problem had absolutely nothing to do with an Illegal Character, nor with the [C:\Builds\Neptune\Sources\Branches\v5.0-EHub\EHub-5.0.sln] string.

One of the projects in the solution had an invalid reference. Other one had an invalid dll.refresh path.

One of these two things caused the problem, but I'm out of time so I won't test which one did.

I fixed the references and the problem went away.


I'm still curious why I got the error error MSB3095: Invalid argument. Illegal characters in path., though.



回答2:

How about minus characters ('-') ? I'm not sure that the minus symbol is valid here.



回答3:

I encountered this error and found that several of the .refresh files were saved as ANSI file types. I loaded them in notepad and saved them back down as Unicode files and this fixed my problem.



回答4:

I had the same problem while migrating from VSS to TFS. I think that the error was caused by the asmx web services.

Resolution :

  1. Go to File, Source control, Change source control
  2. Select the project which generate the error
  3. Click unbind
  4. Reselect the project
  5. Click bind

It should work. If it doesn't, before the first step (Change source control) delete the web references and after the fifth step (click bind) right click on the prject then undo checkouts.



回答5:

I encountered this once. I was running msbuild from a command prompt and I needed to be running it from an elevated command prompt (i.e. as Administrator).

Totally misleading error message!