dotnet test app.cs
.NET 10 can run a C# file directly using dotnet run app.cs. But my .cs doesn't have a Main(). It's actually a small xunit test class for https://adventofcode.com/2024/day/N Can I get away with not creating a .csproj for test files?
6 Replies
probably not
it would need support for the test packages and sdk, i think
@Jan Jones, did you add
dotnet test support by chance?Not yet, but many modern test frameworks support 'dotnet run' too, so that works fine, I've tried
Here are some examples: https://github.com/DamianEdwards/runfile/pull/4/files
(they just use outdated syntax for #:property, need to replace space with = as the separator)
Feel free to file an issue at the dotnet/sdk repo for 'dotnet test app.cs', to show there's community demand for it 🙂
Unknown User•4w ago
Message Not Public
Sign In & Join Server To View
Will do. Thanks a lot!
IIUC, the new Microsoft.Testing.Platform builds .EXEs so it is compatible with dotnet run app.cs.
The old VSTest would require dotnet test app.cs support.
I'm using .NET 10 for advent of code to escape my job still stuck in .net fw, so I'm not a data point to measure community demand.
If you have no further questions, please use /close to mark the forum thread as answered