Closed nojaf closed 5 years ago
Hmm good question... I have never tried that but this must be a dotnet templating issue then I believe...
Would be good to try the same with a non Giraffe template (e.g. MVC) and see how that works.
Yeah this is a dotnet templating issue. I've had similar issues with my other templates.
@nojaf Does this only happen when using a special character in the name like '_' or '-" or '.'?
So I've just tried the 0.16 version and this didn't work at all.
PS C:\temp> dotnet new giraffe -o SSReact
The template "Giraffe Web App" was created successfully.
PS C:\temp> cd .\SSReact\
PS C:\temp\SSReact> ls
Directory: C:\temp\SSReact
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/2/2018 10:39 PM src
-a---- 3/2/2018 10:39 PM 56 build.bat
-a---- 3/2/2018 10:39 PM 56 build.sh
-a---- 3/2/2018 10:39 PM 804 README.md
PS C:\temp\SSReact> .\build.bat
C:\temp\SSReact>dotnet restore src/SSReact
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/SSReact
C:\temp\SSReact>dotnet build src/SSReact
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/SSReact
The problem with hyphens is that Build.bat get the wrong path to the project file. Changing src/error_giraffe
to src/error-giraffe
is all that is needed.
The template engine correctly replaces all - with _ in sourceName (AppNamePlaceholder). Unfortunately the template for build.bat will pick up this change even though it's a path.
As far as I can see there is no elegant solution to this with the Template.Engine as the placeholder always is replaced with error_giraffe
in code and error-giraffe
in files & folders.
Things would be great if we could instruct Template.Engine to replace certain placeholders with sourceNameOriginal (unescaped). That way it would be a breeze to construct correct paths in code.
Even without any hyphens whatsoever there are still problems on Windows. The last name I tried was SSReact
.
That's strange. It works for me no matter how I install the template . To get a better picture of what's wrong.
dotnet --version
? Mine is 2.0.3I tested the following
dotnet new -i "giraffe-template::*"
dotnet new -i "giraffe-template::0.15.0"
dotnet new -i "giraffe-template::0.16.0"
PS C:\data> dotnet new giraffe -o SSReact The template "Giraffe Web App" was created successfully. PS C:\data> cd .\SSReact\ PS C:\data\SSReact> .\Build.bat
They all work for me
Hi, the issue with underscores and hyphens is not really something that I am in control of therefore I will close this issue as there's no action I can really take to help with it. It's a general .NET templating issue which applies to all .NET Core templates and there's nothing unique about giraffe-template
AFAIK.
Thanks for bringing it to attention though!
I've created new project using
dotnet new giraffe --UsePaket -o error-giraffe
and ran thebuild.bat
file.When I look into the
src
folder I see a folder namedAppNamePlaceholder
, while the bat file containsAre dashes a problem?