# Generator expressions in VS\_DOTNET\_REFERENCE\_refname

**URL:** https://discourse.cmake.org/t/generator-expressions-in-vs-dotnet-reference-refname/15271
**Category:** Code
**Tags:** os:windows, lang:csharp
**Created:** [October 28, 2025, 12:31pm UTC](https://discourse.cmake.org/t/generator-expressions-in-vs-dotnet-reference-refname/15271 "2025-10-28T12:31:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![retif](https://discourse.cmake.org/user_avatar/discourse.cmake.org/retif/32/1776_2.png) [@retif](https://discourse.cmake.org/u/retif)
#### Post date: [October 28, 2025, 12:31pm UTC](https://discourse.cmake.org/t/generator-expressions-in-vs-dotnet-reference-refname/15271/1 "2025-10-28T12:31:43Z")

</div>

Are generator expressions supported for the [VS\_DOTNET\_REFERENCE\_refname](https://cmake.org/cmake/help/latest/prop_tgt/VS_DOTNET_REFERENCE_refname.html) target property?

This is how I tried to use it:

```cmake
# the `some` is a C# library which needs to refer to the DLL from the target `thing`
set_target_properties(some
    PROPERTIES
        VS_DOTNET_REFERENCE_thing "$<TARGET_FILE:thing>"
)

```

but that results in the following inside the generated `some.csproj`:

```xml
<ItemGroup>
    <Reference Include="thing">
      <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
      <Private>True</Private>
      <HintPath>E:\path\to\my\project\$&lt;TARGET_FILE:thing&gt;</HintPath>
    </Reference>
  </ItemGroup>

```

so it does not get evaluated (_but at least it gets “HTML-encoded”, so the project file is not “broken”_).

This apparently means that generator expressions are not supported for the `VS_DOTNET_REFERENCE_<refname>` target property? A follow-up question would be how can one know whether a particular target property supports generator expressions or not?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [October 28, 2025, 8:34pm UTC](https://discourse.cmake.org/t/generator-expressions-in-vs-dotnet-reference-refname/15271/2 "2025-10-28T20:34:02Z")

</div>

The general rule is that generator expressions are not supported unless the documentation explicitly says so. The only exception to that that I can think of is test properties, where all test properties support generator expressions and are not individually documented as so.
