3
votes

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...

3

3 Answers

1
votes

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>
0
votes

I tested with my visual studio 2019 enterprise, both <HintPath>$(ProgramFiles)\....\Mono.Android.dll</HintPath> and <HintPath>$(DevEnvDir) work for me.

You can go to the folder specified in the hintpath to make sure that the mono.android.dll truly exists. You can also try manually locating the mono.android.dll.

enter image description here