DotNET: Difference between revisions

DHCP (talk | contribs)
m update links
DHCP (talk | contribs)
m style fixes
 
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>