0

I have uploaded a Xamarin Forms project in GitHub but it shows the language as asm and java instead of C# i have adde the below code in a .gitattributes file but it does not work it again shows asm and not C#

*.csharp linguist-detectable=true  
*.java linguist-detectable=false  
*.js linguist-detectable=false  
*.html linguist-detectable=false  
*.xml linguist-detectable=false 
*.asm linguist-detectable=false 
FreakyAli
  • 13,349
  • 3
  • 23
  • 63
user11640506
  • 57
  • 2
  • 8
  • Keep in mind that the repository language stats are only updated when you push changes, and the results are cached for the lifetime of your repository.Here is a similar thread which maybe can help you :) https://stackoverflow.com/questions/34713765/github-changes-repository-to-wrong-language – Lucas Zhang Apr 27 '20 at 10:49
  • Ok now what should I do to change it – user11640506 Apr 27 '20 at 11:24
  • Are you sure your `C#` files have an extension `.csharp`? Probably it is `.cs` – Saurabh P Bhandari Apr 27 '20 at 11:45
  • Yes I uploaded my project by using git bash after completing it using visual Studio – user11640506 Apr 27 '20 at 11:54

2 Answers2

0

Based on this Build your first Xamarin.Forms App, I believe you are dealing with .cs files and not .csharp files.

The updated .gitattributes file is as follows:

*.cs linguist-detectable=true  
*.java linguist-detectable=false  
*.js linguist-detectable=false  
*.html linguist-detectable=false  
*.xml linguist-detectable=false 
*.asm linguist-detectable=false 

As noted in Detectable section in this Readme for Linguist library (used by GitHub to detect the languages), languages are defined in languages.yml which states the following for C# :

C#:
  type: programming
  ace_mode: csharp
  codemirror_mode: clike
  codemirror_mime_type: text/x-csharp
  tm_scope: source.cs
  color: "#178600"
  aliases:
  - csharp
  extensions:
  - ".cs"
  - ".cake"
  - ".csx"
  language_id: 42

As highlighted, the extensions allowed are .cs, .cake and .csx.

Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50
  • I just tested it , it works fine for me : [repo-link](https://github.com/Saurabh702/tempforlingtest), but I did notice an issue. When you first click on the link you might see different languages but when you reload it you will only see `C#` – Saurabh P Bhandari Apr 27 '20 at 12:29
0

Now it works i removed the obj and debug folder from Android, UWP and Forms folder and again added the files in a new repo now it works fine.

user11640506
  • 57
  • 2
  • 8