I am using Visual Studio 2019 preview 2.1. I have a .NET Framework 4.6.1 class library C# project which has some Azure references in the old csproj project format (ToolsVersion="15.0"). This old csproj currently builds and works just fine. I am attempting to migrate to the new project format. Everything is going well except for the fact that I have one reference which doesn't come from NuGet -- it comes from the GAC: Microsoft.WindowsAzure.ServiceRuntime. However, I haven't figured out how to get the new project format to find the assembly. For example here is the new project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.KeyVault" Version="2.3.2" />
<PackageReference Include="Microsoft.Azure.KeyVault.Core" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.KeyVault.WebKey" Version="2.0.7" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.1" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.8" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure" Version="3.3.7" />
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" Version="3.2.3" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
</Project>
In fact, that Microsoft.WindowsAzure.ServiceRuntime reference is the exact line from the old format. When loading this in VS it produces the following warning:
Warning MSB3245 Could not resolve this reference. Could not locate the assembly "Microsoft.WindowsAzure.ServiceRuntime, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. MyProject C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 2114
I attempted to remove the version:
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime" />
But that did not help. If I remove it and try to add the reference from the VS user interface, I see there are a bunch of Microsoft.* and System.* options in 'Framework' (the GAC), but Microsoft.WindowsAzure.ServiceRuntime is not one of them. Just to confirm I started up ILSpy and chose "Open From GAC..." and sure enough it is there along with a bunch of other assemblies which do not appear in the VS user interface.
How can I get VS to load this reference from the GAC?
Thanks