Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps Pipeline build agent: how to use or replace $(DevEnvDir) in assembly reference HintPath?

I have Visual Studio 2019 Professional locally, Azure DevOps pipeline build agent has Enterprise.

How to reference the ReferenceAssemblies in the project file, that resolves both locally and in the build agent?

Projectfile: builds locally, but pipeline build fails because of wrong path:

<HintPath>$(ProgramFiles)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>

Projectfile: builds in azure devops pipeline, but local build fails because of wrong path:

<HintPath>$(ProgramFiles)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>

Projectfile: builds locally, but pipeline build fails, because $DevEnvDir is Undefined:

<HintPath>$(DevEnvDir)\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>

I feel like I'm missing something simple here...

like image 484
Aksel Stepsel Avatar asked Dec 02 '25 03:12

Aksel Stepsel


1 Answers

You can use Condition:

<Reference Include="Mono.Android.dll">
    <HintPath Condition="Exists('$(ProgramFiles)\Microsoft Visual Studio\2019\Professional')">$(ProgramFiles)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>
    <HintPath Condition="Exists('$(ProgramFiles)\Microsoft Visual Studio\2019\Enterprise')">$(ProgramFiles)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>
</Reference>
like image 171
Shayki Abramczyk Avatar answered Dec 04 '25 19:12

Shayki Abramczyk