CLI: namespace error on fresh VB project
See original GitHub issue@jcouv commented on Fri Sep 22 2017
Repro:
mkdir 22227-cli-vb
cd 22227-cli-vb
dotnet new console --language=vb
dotnet build
produces the namespace error below
> dotnet --version
2.0.2-vspre-006949
> dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
vbc : error BC30113: '22227-cli-vb' is not a valid name and cannot be used as the root namespace name. [D:\issues\22227-cli-vb\22227-cli-vb.vbproj]
Build FAILED.
vbc : error BC30113: '22227-cli-vb' is not a valid name and cannot be used as the root namespace name. [D:\issues\22227-cli-vb\22227-cli-vb.vbproj]
0 Warning(s)
1 Error(s)
Relates to https://github.com/dotnet/roslyn/issues/22227
@am11 commented on Fri Sep 22 2017
Does vb.exe by design considers the directory name to be the root namespace unless we explicitly add normalized name in <RootNamespace>_22227_cli_vb</RootNamespace>
in vbproj?
csc doesn’t seem to rely on dirname, even when there is no namespace in the program.cs code, actual dirname has invalid (hyphen) character and <RootNamespace>
is set to 22227-cli-vb
(with same invalid chars) in csproj.
If it’s not a breaking change, would be cool if vb.exe and csc.exe behave the same way.
@jcouv commented on Fri Sep 22 2017
It looks like the problem is not with vbc.exe
, but with the arguments it receives. If the vbproj
file is named A, then there is a /rootnamespace:A
command-line option.
I’ll move the issue to the CLI repo.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (10 by maintainers)
That’s right. One thing I noticed that if we do something like:
It shows that namespace is set to sanitized dirname:
Could the same normalization be reused for VB root NS when setting the compiler arg in CLI?
fixed by https://github.com/dotnet/templating/pull/1337