DotNET: Difference between revisions

Add notice that MSBuild SDKs are problemaic.
DHCP (talk | contribs)
m style fixes
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:


From [https://en.wikipedia.org/wiki/.NET Wikipedia]
From [[Wikipedia:.NET|Wikipedia]]
<blockquote>
<blockquote>
The .NET platform (formerly named .NET Core) is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is a cross-platform successor to the .NET Framework. The project is mainly developed by Microsoft employees by way of the .NET Foundation and is today released under an MIT License.
The .NET platform (formerly named .NET Core) is a free and open-source, managed computer software framework for Windows, Linux, and macOS operating systems. It is a cross-platform successor to the .NET Framework. The project is mainly developed by Microsoft employees by way of the .NET Foundation and is today released under an MIT License.
Line 9: Line 9:
This is relevant for NixOS only.
This is relevant for NixOS only.


[https://github.com/Mic92/nix-ld nix-ld] is needed:
[https://github.com/nix-community/nix-ld nix-ld] is needed:
<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
{
{
Line 55: Line 55:
Note that Nix-packaged .NET tools use a special wrapper (toggled by <code>useDotnetFromEnv</code> option in <code>buildDotnetModule</code>) that automatically picks up .NET install from the user environment. If you want to use a
Note that Nix-packaged .NET tools use a special wrapper (toggled by <code>useDotnetFromEnv</code> option in <code>buildDotnetModule</code>) that automatically picks up .NET install from the user environment. If you want to use a
different SDK version with a Nix-packaged .NET tools than the default, make sure the <code>dotnet</code> CLI of your wanted SDK version is installed and available.
different SDK version with a Nix-packaged .NET tools than the default, make sure the <code>dotnet</code> CLI of your wanted SDK version is installed and available.


== Packaging ==
== Packaging ==
Line 64: Line 63:
Example build file:
Example build file:


<syntaxhighlight lang="nix" line="1" start="1">
<syntaxhighlight lang="nix">
{
{
   buildDotnetModule,
   buildDotnetModule,
Line 193: Line 192:
</syntaxhighlight>
</syntaxhighlight>


<syntaxhighlight lang="nix">
<syntaxhighlight lang="console">
nix-shell ./rider-fhs.nix
$ nix-shell ./rider-fhs.nix
</syntaxhighlight>
</syntaxhighlight>


Line 208: Line 207:


Please visit the [https://discourse.nixos.org/t/dotnet-maui-workload/20370/10 forum] for an example of a multi-SDK installation with workload changed to install to home directory.
Please visit the [https://discourse.nixos.org/t/dotnet-maui-workload/20370/10 forum] for an example of a multi-SDK installation with workload changed to install to home directory.


== Troubleshooting ==
== Troubleshooting ==
Line 246: Line 243:
The workaround is modifying the bits that generate nuget-deps.nix:
The workaround is modifying the bits that generate nuget-deps.nix:


<syntaxhighlight lang="sh">
<syntaxhighlight lang="console">
dotnet restore --packages=packageDir --use-current-runtime ./SomeProject.csproj
$ dotnet restore --packages=packageDir --use-current-runtime ./SomeProject.csproj
nuget-to-nix packageDir >deps.nix
$ nuget-to-nix packageDir >deps.nix
rm -r packageDir
$ rm -r packageDir
</syntaxhighlight>
</syntaxhighlight>


Line 263: Line 260:
* [https://www.reddit.com/r/NixOS_dotnet NixOS.NET community on Reddit]
* [https://www.reddit.com/r/NixOS_dotnet NixOS.NET community on Reddit]
* [https://discord.gg/pTpq7Qfs NixOS.NET community on Discord]
* [https://discord.gg/pTpq7Qfs NixOS.NET community on Discord]
* [https://sgt.hootr.club/molten-matter/dotnet-on-nix/ The journey of packaging a .NET app on Nix]
* [https://sgt.hootr.club/blog/dotnet-on-nix/ The journey of packaging a .NET app on Nix]
* https://en.wikipedia.org/wiki/.NET_Framework - The old, windows-only version of .NET. Newer versions (ie. .NET Core) are multiplatform.
* [[Wikipedia:.NET Framework|.NET Framework]] - The old, windows-only version of .NET. Newer versions (ie. .NET Core) are multiplatform.
** https://en.wikipedia.org/wiki/Mono_(software) is the open source reimplementation of .NET Framework. Its runtime/JIT has been merged into .NET Core, and now it only receives bugfixes.
** [[Wikipedia:Mono (software)|Mono]] is the open source reimplementation of .NET Framework. Its runtime/JIT has been merged into .NET Core, and now it only receives bugfixes.
* https://learn.microsoft.com/en-us/dotnet/core/introduction
* https://learn.microsoft.com/en-us/dotnet/core/introduction




[[Category:Languages]]
[[Category:Languages]]