MarkPflug
MarkPflug
CC#
Created by ch0pstix 🥢 on 4/8/2025 in #help
✅ Modern T4 Replacement for Design Time Codegen
6 replies
CC#
Created by Wololo on 3/14/2025 in #help
NPOI vs ClosedXML
4 replies
CC#
Created by Wololo on 3/14/2025 in #help
NPOI vs ClosedXML
I maintain an excel reader library that I specifically designed for easy compatibility with database ingestion. https://github.com/MarkPflug/Sylvan.Data.Excel Here is an example that does SQL bulk import with my csv library, just replace "csv" with "excel" and it should work the same way. https://github.com/MarkPflug/Sylvan/blob/main/docs/Csv/Examples.md#bulk-load-csv-data-into-sqlserver It is an order of magnitude faster than the popular options. Maybe at least give it a try?
4 replies
CC#
Created by cypherpotato on 2/28/2025 in #help
Can I unpack some results from another IEnumerable into my iterator function?
I remember this originally as a proposed "yield foreach" keyword, but it would require incompatible library changes that made it impractical. Blog post from almost 2 decades ago (damn, I'm getting old): https://learn.microsoft.com/en-us/archive/blogs/wesdyer/all-about-iterators
6 replies
CC#
Created by Valdiralita on 10/2/2024 in #help
creating a nuget for a custom msbuild task
Task projects should be "netstandard2.0". Visual Studio builds using .net framework, not core, so it wouldn't be able to load a net8 library in msbuild
13 replies
CC#
Created by Valdiralita on 10/2/2024 in #help
creating a nuget for a custom msbuild task
Sounds like you got it figured out then?
13 replies
CC#
Created by Valdiralita on 10/2/2024 in #help
creating a nuget for a custom msbuild task
As the article you linked mentioned, you can't use normal nuget package dependencies in an msbuild package, since there is no "nuget restore" for the msbuild steps
13 replies
CC#
Created by Valdiralita on 10/2/2024 in #help
creating a nuget for a custom msbuild task
Here is a project I created that does what you're looking for: https://github.com/MarkPflug/Sylvan.BuildTools.Resources/blob/main/source/Sylvan.BuildTools.Resources/Sylvan.BuildTools.Resources.csproj This .csproj has all the settings needed to produce a correct package. However, this task has no third-partyh dependencies, which might complicate things a bit.
13 replies
CC#
Created by Valdiralita on 10/2/2024 in #help
creating a nuget for a custom msbuild task
You don't want your assemblies to end up in the lib folder, as that would cause the consuming project to use it at runtime. An MSBuild package should only be loaded at build time. So, you want to have your binaries in a different location, such as under your build folder where your .props/.targets files live. I think you can do this by setting <BuildOutputTargetFolder>build</BuildOutputTargetFolder> in the .csproj for your task.
13 replies
CC#
Created by Jasonnn on 9/9/2024 in #help
✅ Reading/Writing in Excel with C#
I'm the author of a library for reading Excel data. It has a pretty minimal API, and is very specifically for getting data out of Excel, ie it doesn't handle formatting, styles, charts, etc. It essentially provides a DbDataReader over Excel, so is ideal for reading rectangular/tabular data. Though, with a bit of work it can be used to read unusual datasets too. Open source, MIT license, extremely memory/CPU efficient, handles reading .xlsx, .xlsb, and .xls: https://github.com/MarkPflug/Sylvan.Data.Excel Might be too minimal for what you need.
43 replies
CC#
Created by Cryy on 7/25/2024 in #help
Performance question
But that doesn't answer why result is needed in the first example.
32 replies
CC#
Created by Cryy on 7/25/2024 in #help
Performance question
If you need result, why not just sum it in app memory, rather than summing query and avoid three roundtrips to db?
32 replies
CC#
Created by Cryy on 7/25/2024 in #help
Performance question
What are you doing with result? ToList will bring the entire query result back to your application. But, for what?
32 replies
CC#
Created by oJaime on 7/11/2024 in #help
Work with .resx Resource files on vscode
22 replies
CC#
Created by oJaime on 7/11/2024 in #help
Work with .resx Resource files on vscode
Unfortunately, I don't have a public project that uses it. Feel free to ask questions/submit issues on the repo if you need help or run into issues.
22 replies
CC#
Created by oJaime on 7/11/2024 in #help
Work with .resx Resource files on vscode
I've implemented a json-based alternative to .resx files that uses MSBuild code gen, instead of VS design-time code gen. Maybe it would work for you? https://github.com/MarkPflug/Sylvan.BuildTools.Resources
22 replies
CC#
Created by QuaKe on 6/28/2024 in #help
✅ "You must install or update .NET to run this application"
@QuaKe You might be able to make this work by adding/editing the *runtimeconfig.json for xstyler: https://learn.microsoft.com/en-us/dotnet/core/versions/selection#control-roll-forward-behavior You would need to set RollForward to Major, indicating that even though xstyler was built against .NET 6, that it should be allowed to run on .NET 8. I think the breaking changes since .NET 3.1 have been so minimal that it is extremely unlikely that there would be an incompatibility. In my opinion, all .NET tools should default to Rollforward=Major in the .csproj file, but it looks like xstyler doesn't do that.
6 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
FileStream will open with FileShare.Read, so other file handles can be opened to read the file. If you try to write to it however, I'd expect that to fail while the FileStream is open.
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
How long will your "search string" typically be? Your example uses "test", is that expected to be representative?
50 replies
CC#
Created by Jesse on 6/4/2024 in #help
Handling reading large files in C#
I would stay away from the complexity of MemoryMappedFile, unless you expect the files to exceed 2GB. Even then, you'd probably be better off adjusting your algorithm to work in a streaming/buffered approach
50 replies