@@ -98,13 +98,13 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila
For more detail about managing the `deps.nix` file, see [Generating and updating NuGet dependencies](#generating-and-updating-nuget-dependencies)
:::
*`packNupkg` is used to pack project as a `nupkg`, and installs it to `$out/share`. If set to `true`, the derivation can be used as a dependency for another dotnet project by adding it to `projectReferences`.
*`projectReferences` can be used to resolve `ProjectReference` project items. Referenced projects can be packed with `buildDotnetModule` by setting the `packNupkg = true` attribute and passing a list of derivations to `projectReferences`. Since we are sharing referenced projects as NuGets they must be added to csproj/fsproj files as `PackageReference` as well.
*`packNupkg` is used to pack project as a `nupkg`, and installs it to `$out/share`. If set to `true`, the derivation can be used as a dependency for another dotnet project by adding it to `buildInputs`.
*`buildInputs` can be used to resolve `ProjectReference` project items. Referenced projects can be packed with `buildDotnetModule` by setting the `packNupkg = true` attribute and passing a list of derivations to `buildInputs`. Since we are sharing referenced projects as NuGets they must be added to csproj/fsproj files as `PackageReference` as well.
For example, your project has a local dependency:
```xml
<ProjectReferenceInclude="../foo/bar.fsproj"/>
```
To enable discovery through `projectReferences` you would need to add:
To enable discovery through `buildInputs` you would need to add:
# Whether to use an alternative wrapper, that executes the application DLL using the dotnet runtime from the user environment. `dotnet-runtime` is provided as a default in case no .NET is installed
# This is useful for .NET tools and applications that may need to run under different .NET runtimes
,useDotnetFromEnv?false
# Whether to explicitly enable UseAppHost when building. This is redundant if useDotnetFromEnv is enabledz
# Whether to explicitly enable UseAppHost when building. This is redundant if useDotnetFromEnv is enabled
elsethrow"Defining the `nugetDeps` attribute is required, as to lock the NuGet dependencies. This file can be generated by running the `passthru.fetch-deps` script.";
# contains the actual package dependencies
dependenciesSource=mkNugetSource{
name="${name}-dependencies-source";
description="Nuget source with the dependencies for ${name}";
for project in${projectFiles[@]-}${testProjectFiles[@]-};do
dotnetRestore "$project""$rid"
done
done
# Second copy, makes sure packages restored by ie. paket are included
cp-r$HOME/.nuget/packages/*$tmp/nuget_pkgs ||true
echo"Succesfully restored project"
echo"Writing lockfile..."
excluded_sources=( @excludedSources@ )
for excluded_source in${excluded_sources[@]};do
ls"$excluded_source">>"$tmp/excluded_list"
done
tmpFile="$tmp"/deps.nix
echo-e"# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n">"$tmpFile"