cs-script: Error "Cannot parse "//css_import..."" when referencing an assembly
When having this line somewhere at the top of my script file:
//css_ref C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.dll
I get an error message:
Cannot parse “//css_import…”
Full stack trace:
System.ApplicationException: Cannot parse "//css_import..."
at csscript.CSharpParser.ImportInfo.InternalInit(String[] statementParts, Int32 startIndex)
at csscript.CSharpParser.ImportInfo.ResolveStatement(String statement, String parentScript, String[] probinghDirs)
at csscript.CSharpParser.Init(String code, String file, String[] directivesToSearch, String[] probingDirs)
at csscript.CSharpParser.Construct(String script, Boolean isFile, String[] directivesToSearch, String[] probingDirs)
at csscript.CSExecutor.Execute(String[] args, PrintDelegate printDelg, String primaryScript)
I’ve tried to escale the “(” and “)” like this:
//css_ref C:\Program Files ((x86))\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.dll
And also tried to enclose the path within single quotes or double quotes.
Still, I’m unable to get rid of the above error.
My question
How can I css_ref an assembly that is located inside a path with both spaces and round brackets?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- - Issue #189: Error "Cannot parse "//css_import..."" when referencing an assembly — committed to oleg-shilo/cs-script by deleted user 4 years ago
- Release: v3.30.2 - Issue #189: Error "Cannot parse "//css_import..."" when referencing an assembly - Issue #193: DirectoryNotFoundException(C:\ProgramData\CS-Script\ShellExtension) when fresh installi... — committed to oleg-shilo/cs-script by deleted user 4 years ago
- * RC: v3.30.2.1+ - Issue #189: Error "Cannot parse "//css_import..."" when referencing an assembly - Issue #193: DirectoryNotFoundException(C:\ProgramData\CS-Script\ShellExtension) when fresh installi... — committed to oleg-shilo/cs-script by lbs-contributor 4 years ago
- Release: v3.30.3.0 - Issue #189: Error "Cannot parse "//css_import..."" when referencing an assembly - Issue #193: DirectoryNotFoundException(C:\ProgramData\CS-Script\ShellExtension) when fresh instal... — committed to oleg-shilo/cs-script by lbs-contributor 4 years ago
Got it, Thank you!
Guys, please test the v3.30.2 release: https://github.com/oleg-shilo/cs-script/releases/edit/v3.30.2.1
It should fix the problem.
Hi Uwe. I cannot reproduce it. Seems to work for me:
in v3.28.9
Try to use envars:
//css_ref %PROGRAMFILES(X86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.dll