Comments (7)
I can add a .gitattributes file that will take care of that and any other potential issues?
from essentialcsharp.
I was trying to avoid that because the files should just be text. I was hoping it was caused by some errant encoding and we just had to re-write the file. Perhaps both? Your input is welcome.
from essentialcsharp.
I think both probably needs to be done.
Listing file that are "binary" (source) shows pretty much all of the csproj files.
Looking at the contents most (not all) csproj files have an xml declaration with an encoding of utf-16 specified. Digging a bit further, most (all?) of the csproj files appear to have a utf-16 LE BOM (0xFF 0xFE).
This is likely the cause of your git diff
troubles (2 byte encoding while git expects 1).
Though you can configure your local diff to convert the files I think it would be better to simply fix these files.
VS2017 for the new core csproj format (is there a fancy name for it?) generate the csproj without the XML declaration and with a UTF-8 BOM. Framework based csproj still generate the xml declaration with an encoding of utf-8 and a UTF-8 BOM.
It is probably best to:
- Fix all of the csproj files to be UTF-8. This will likely solve your diff issues.
- Also setup the .gitattributes to mark all .cs and .csproj files as text. Though not current necessary it is possible that at some point you will need to include fancy characters in a file. In these cases git might falsely detect file as binary rather than text. Most (all?) git tools respect the fact that the .gitattributes files has final say over whether a file is considered text or binary.
from essentialcsharp.
I submitted a pull request with all of the csproj files changed to UTF-8. This did indeed solve the diff issues.
I didn't touch the .gitattributes file. If it becomes necessary I figure it would be a quick fix.
from essentialcsharp.
Request pulled... thanks, Neal!!!
(Curious, how did you change all the files?)
from essentialcsharp.
By the way Neal, what specifically did you do change a file to UTF-8? Just curious.
from essentialcsharp.
There used to be an advanced option in VS that allowed you to change the encoding, but this was removed in VS17 due to uncommon use. The only method available now is to SAVE AS and select UTF-8 encoding and then overwrite the project. The UTF-8 BOM then will cause VS to maintain UTF-8 for future changes.
Removal of the UTF-16 declarations and overwriting the old projects was relatively smooth, but in 2 cases VS was not recognizing the new UTF-8 XML file, but a simple copy & paste operation nudged the IDE to recognize it.
from essentialcsharp.
Related Issues (20)
- Investigate why build failure is occurring only on mac HOT 2
- Run tests with different locales HOT 2
- TFM moved from Directory.Build.props to each csproj file
- Mitigating dotnet 6 failure on ubuntu HOT 1
- To go to new lang version of the book...
- Revisit 20.7 to make work properly HOT 1
- Delete ../src/Chapter01/Directory.Build.props HOT 1
- Update Directory.Build.props to use C# 11.0 for LangVersion element (once released) HOT 1
- Rename v9.0 Branch? HOT 2
- Testing 10.23 doesn't complete reliably especially
- Update Readme File
- Find an alternate location (or delete) Publishing a Stand-Alone Executable - Advanced Block
- Switch the CompileError class in CompilerAssert.cs to be a record HOT 1
- Switch expected strings from string literals to RAW literals in unit tests HOT 1
- Add support for method filtering to ...\src\Shared\Tests\CompilerAssert.cs HOT 1
- Write Unit Tests for Table.03.01 HOT 1
- Move Microsoft.VisualStudio.TestTools.UnitTesting using statement into Chapter.Tests.prop
- Create tests for Table03.01
- Create Table04.01.ControlFlowStatements.cs and accompanying tests
- Write test for Listing04.27.OutOfScope.cs using CompilerAssert.cs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from essentialcsharp.