Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppNamePlaceholder not being set #9

Closed
nojaf opened this issue Jan 29, 2018 · 9 comments
Closed

AppNamePlaceholder not being set #9

nojaf opened this issue Jan 29, 2018 · 9 comments

Comments

@nojaf
Copy link

nojaf commented Jan 29, 2018

I've created new project using dotnet new giraffe --UsePaket -o error-giraffe and ran the build.bat file.

C:\temp\error-giraffe>dotnet build src/error_giraffe
MSBUILD : error MSB1009: Project file does not exist.
Switch: src/error_giraffe

When I look into the src folder I see a folder named AppNamePlaceholder, while the bat file contains

IF NOT EXIST paket.lock (
    START /WAIT .paket/paket.exe install
)
dotnet restore src/error_giraffe
dotnet build src/error_giraffe

Are dashes a problem?

@dustinmoris
Copy link
Member

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.

@TheAngryByrd
Copy link
Member

Yeah this is a dotnet templating issue. I've had similar issues with my other templates.

@TheAngryByrd
Copy link
Member

Related: dotnet/templating#1168

@dburriss
Copy link
Contributor

@nojaf Does this only happen when using a special character in the name like '_' or '-" or '.'?

@nojaf
Copy link
Author

nojaf commented Mar 2, 2018

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

@magnushammar
Copy link

magnushammar commented Mar 8, 2018

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.

@nojaf
Copy link
Author

nojaf commented Mar 9, 2018

Even without any hyphens whatsoever there are still problems on Windows. The last name I tried was SSReact.

@magnushammar
Copy link

That's strange. It works for me no matter how I install the template . To get a better picture of what's wrong.

  • What is your dotnet --version? Mine is 2.0.3
  • What is the actual path and fsproj filename?
  • What is the path in build.bat

I 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

@dustinmoris
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants