# Unexpected/incomplete \`install\` of CSharp library/executable/NuGet

**URL:** https://discourse.cmake.org/t/unexpected-incomplete-install-of-csharp-library-executable-nuget/15708
**Category:** Usage
**Tags:** lang:csharp
**Created:** [June 11, 2026, 4:38am UTC](https://discourse.cmake.org/t/unexpected-incomplete-install-of-csharp-library-executable-nuget/15708 "2026-06-11T04:38:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![kevinyee](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/cdc98d/32.png) [@kevinyee](https://discourse.cmake.org/u/kevinyee)
#### Post date: [June 11, 2026, 4:38am UTC](https://discourse.cmake.org/t/unexpected-incomplete-install-of-csharp-library-executable-nuget/15708/1 "2026-06-11T04:38:56Z")

</div>

In the example below, I would expect the everything (`MyExecutable.exe`, `CommandLine.dll`, `MyLibrary.dll` and `Newtonsoft.Json.dll`) to be installed to `bin` (i.e. `CMAKE_INSTALL_BINDIR`). I observe the following (output pasted below the example):

- Correct:
  - `MyExecutable.exe` is installed to `bin`
  - `MyLibrary.dll` is installed to `bin`

- Unexpected:
  - `MyLibrary.dll` additionally installed to `lib`. Not sure if it is intended for `*.pdb` is supposed to be installed or not
  - `Newtonsoft.Json.dll` installed to `lib` instead of `bin`
  - `CommandLine.dll` not installed at all

I recognize that I would work around by setting the install `DESTINATION` and use `install(FILES)` for the missing things. I posted this as an issue [here](https://gitlab.kitware.com/cmake/cmake/-/work_items/27825), but it was not conclusively accepted so I ask this forum to weigh in. Thanks

```auto
# Top Level CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(InstallDemo LANGUAGES CSharp)

add_subdirectory(bin)
add_subdirectory(lib)

```

```auto
# lib/CMakeLists.txt

# Library with NuGet dependency
add_library(MyLibrary SHARED)
target_sources(MyLibrary PRIVATE
  Library.cs
)
set_target_properties(MyLibrary PROPERTIES
  VS_PACKAGE_REFERENCES "Newtonsoft.Json_13.0.3"
)

install(TARGETS MyLibrary)

```

```auto
# bin/CMakeLists.txt

# Executable that depends on the library AND has its own NuGet dependency
add_executable(MyApp)
target_sources(MyApp PRIVATE
  Program.cs
)
target_link_libraries(MyApp PRIVATE MyLibrary)
set_target_properties(MyApp PROPERTIES
  VS_PACKAGE_REFERENCES "CommandLineParser_2.9.1"
)

install(TARGETS MyApp)

```

> **Example console output**
>
> ```auto
> kevinyee@NM0107 MINGW64 ~/csharp_install
> $ cmake -B build
> -- Building for: Visual Studio 16 2019
> -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.26200.
> -- The CSharp compiler identification is Microsoft Visual Studio 2019
> -- The CSharp compiler version is 3.11.0
> -- Check for working C# compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/Roslyn/csc.exe
> -- Check for working C# compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/Roslyn/csc.exe - works
> -- Configuring done (2.1s)
> -- Generating done (0.1s)
> -- Build files have been written to: C:/Users/kevinyee/csharp_install/build
> 
> kevinyee@NM0107 MINGW64 ~/csharp_install
> $ cmake --build build
> Microsoft (R) Build Engine version 16.11.6+a918ceb31 for .NET Framework
> Copyright (C) Microsoft Corporation. All rights reserved.
> 
> Determining projects to restore...
> Restored C:\Users\kevinyee\csharp_install\build\lib\MyLibrary.csproj (in 382 ms).
> Restored C:\Users\kevinyee\csharp_install\build\bin\MyApp.csproj (in 382 ms).
> 1>Checking Build System
> MyLibrary -> C:\Users\kevinyee\csharp_install\build\lib\Debug\MyLibrary.dll
> MyApp -> C:\Users\kevinyee\csharp_install\build\bin\Debug\MyApp.exe
> Building Custom Rule C:/Users/kevinyee/csharp_install/CMakeLists.txt
> 
> kevinyee@NM0107 MINGW64 ~/csharp_install
> $ cmake --install build --prefix install --config Debug
> -- Installing: C:/Users/kevinyee/csharp_install/install/bin/MyApp.exe
> -- Up-to-date: C:/Users/kevinyee/csharp_install/install/lib
> -- Installing: C:/Users/kevinyee/csharp_install/install/lib/MyLibrary.dll
> -- Installing: C:/Users/kevinyee/csharp_install/install/lib/MyLibrary.pdb
> -- Installing: C:/Users/kevinyee/csharp_install/install/lib/Newtonsoft.Json.dll
> -- Installing: C:/Users/kevinyee/csharp_install/install/bin/MyLibrary.dll
> 
> ```
