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

dotnet new generates incorrect project in case of - (dash) symbols in project name #4217

Closed
xtmq opened this issue Oct 4, 2020 · 3 comments
Labels
area/external Categorizes an issue or PR as being external to the Uno area/solution-templates Categorizes an issue or PR as relevant to the solution template difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding kind/bug Something isn't working project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools

Comments

@xtmq
Copy link

xtmq commented Oct 4, 2020

First of all the Stackoverflow question:
https://stackoverflow.com/questions/62676355/error-in-uno-platform-auto-generated-file-and-program-cs-only-on-mac/64200149#64200149

Steps to reproduce

  1. Create a new project via dotnet new:
dotnet new -i Uno.ProjectTemplates.Dotnet
dotnet new unoapp -o App-CrossPlatform
  1. Try to compile and observe errors in .g.cs files:
Error CS0826: No best type found for implicitly-typed array (CS0826)
Error CS1503: Argument 2: cannot convert from '?[]' to 'string[]' (CS1503)

Explanation

dotnet new expands project with the next files in that case (with dash - symbol):

App-CrossPlatform\App-CrossPlatform.Shared\App-CrossPlatform.Shared.shproj
App-CrossPlatform\App-CrossPlatform.Shared\App-CrossPlatform.Shared.projitems

But there are imports in other projects (with underscore _ symbol)

<Import Project="..\App_CrossPlatform.Shared\App_CrossPlatform.Shared.projitems" Label="Shared" Condition="Exists('..\App_CrossPlatform.Shared\App_CrossPlatform.Shared.projitems')" />

So MsBuild can not resolve imports and find projitems files.

@xtmq xtmq added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Oct 4, 2020
@jeromelaban jeromelaban added project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools area/solution-templates Categorizes an issue or PR as relevant to the solution template and removed triage/untriaged Indicates an issue requires triaging or verification labels Oct 5, 2020
@jeromelaban
Copy link
Member

Thanks for the report. Unfortunately, at this point, this seems like a limitation of the template engine: dotnet/templating#1920.

If the templating engine adds the ability to choose the proper expansion to handle those cases, we'll adjust to use it. If you want to create such a project, you can use the Visual Studio 2019 templates.

@jeromelaban jeromelaban added the area/external Categorizes an issue or PR as being external to the Uno label Oct 5, 2020
@dean-toolhound
Copy link

Happens even in Visual Studio using the template if your solution name has a space in it. Get the same error as mentioned in the Stack Overflow issue.

@jeromelaban jeromelaban added the difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. label Feb 15, 2021
@MartinZikmund MartinZikmund added difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jun 4, 2021
@MartinZikmund
Copy link
Member

Invalid characters in project name are now automatically prevented and user is informed when unsupported characters are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/external Categorizes an issue or PR as being external to the Uno area/solution-templates Categorizes an issue or PR as relevant to the solution template difficulty/challenging 🤯 Categorizes an issue for which the difficulty level is reachable with internals understanding kind/bug Something isn't working project/core-tools 🛠️ Categorizes an issue or PR as relevant to core and tools
Projects
None yet
Development

No branches or pull requests

4 participants