microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.34k stars 1.14k forks source link

Couldn't create react windows app with existing react-native application if app name has a dash in it #6005

Open SireeshaThota opened 4 years ago

SireeshaThota commented 4 years ago

Can we create windows app with existing react-native application. I was trying to do the same. I am getting following errors. Issue

Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.18362.0\windows.ui.xaml.core.direct.xamldirectcontract\2.0.0.0\windows.ui.xaml.core.direct.xamldirectcontract.winmd 9>D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native\App.idl(1): error MIDL2025: [msg]syntax error [context]: expecting { near "-" [D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native\gvc-re act-native.vcxproj] 9>D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native\App.idl(2): error MIDL2026: [msg]cannot recover from earlier syntax errors; aborting compilation [D:\MCD\MCDSource\gvc-react-native\windows\gvc- react-native\gvc-react-native.vcxproj] 9>Done Building Project "D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native\gvc-react-native.vcxproj" (default targets) -- FAILED. 2>Done Building Project "D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native\gvc-react-native.vcxproj.metaproj" (default targets) -- FAILED. 1>Done Building Project "D:\MCD\MCDSource\gvc-react-native\windows\gvc-react-native.sln" (default targets) -- FAILED.

acoates-ms commented 4 years ago

I wonder if this is an issue with apps that have a - in the name? Maybe we need to sanitize the app name as part of app generation.

SireeshaThota commented 4 years ago

Yes i understood now. It is because of - in the name. When i change it, i could build it successfully.

SireeshaThota commented 4 years ago

If i remove "-" in the name of the project, project is building successfully. But i think it should be supported.

chrisglein commented 4 years ago

Agreed that "-" in app name should either be fixed to be supported or at the very least give better errors if that's unfixable (but it should be).

jonthysell commented 4 years ago

react-native init does not support dashes in the app name - it errors if you try.

We could protect ourselves against people that skirt that, but what is the exact sanitation that we want to apply?

The app name is used all over the template (file names, variables, namespaces, native and JS code) and doing the wrong thing means the app won't compile or won't load.

I'm currently fixing the new module templates (#6065) to follow the naming logic of create-react-native-module because that's the official way to create modules and it converts everything to PascalCase in the ios/android templates.

Roucoz commented 2 years ago

Hello @acoates-ms how did you manage to remove the "-" from the name.. Because app name is available in all the project already.