Reputation: 43
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...
Upvotes: 4
Views: 1643
Reputation: 30353
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.
Upvotes: 0
Reputation: 1153
You will have to create a pipeline variable called DevEnvDir
Upvotes: 0
Reputation: 41755
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>
Upvotes: 1