I'm trying to convert my c# projects from old to new csproj style, but this breaks my Azure cloud service at runtime because the ReferenceAssembly of System.ValueTuple.dll
is copied instead of the implementing assembly.
This is the same problem as described in this closed/abandoned issue.
As my projects are currently targeting .NET 4.6.2, the problem is "solvable" by targeting .NET 4.7+, as that comes with System.ValueTuple
and hence does not need to reference it as a NuGet package.
I would like to avoid this situation, if possible, as:
- This requires an additional deploy step to install .net 4.7+ runtimes on the worker roles, as they come with .net 4.6.2 installed. https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-guestos-update-matrix#family-5-releases
- This seems as "the easy way out", and I would like to know if the problem can be solved otherwise.
Additional description of the issue:
I'll use:
refDLL
for:packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll
, andlibDLL
forpackages\system.valuetuple\4.5.0\lib\net461\System.ValueTuple.dll
.
They are easily distinguishable, as refDLL
is 40 kb and libDLL
is 78 kb.
The actual code and complete build log file is found here: https://www.dropbox.com/s/kquv5voa19jfonz/AzureCloudService1.zip?dl=0
I have a solution struture as follows:
- AzureCloudService1
- WorkerRole1 (old csproj)
- WorkerRole2 (new csproj)
After building the cloud service the
WorkerRole1\bin\Debug
haslibDLL
.WorkerRole2\bin\Debug\net461
haslibDLL
AzureCloudService1\obj\Debug\WorkerRole1
haslibDLL
AzureCloudService1\obj\Debug\WorkerRole2
hasrefDLL
From the logs, I noticed the following difference between WorkerRole1 and WorkerRole2.
WorkerRole1:
C:\Users\jonas\source\repos\AzureCloudService1\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
CopyLocal = true
FusionName = System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
HintPath = ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
ImageRuntime = v4.0.30319
MSBuildSourceProjectFile = C:\Users\jonas\source\repos\AzureCloudService1\WorkerRole1\WorkerRole1.csproj
MSBuildSourceTargetName = BuiltProjectOutputGroupDependencies
OriginalItemSpec = System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL
ReferenceAssembly = C:\Users\jonas\source\repos\AzureCloudService1\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
ReferenceSourceTarget = ResolveAssemblyReference
ResolvedFrom = {HintPathFromItem}
Version = 4.0.3.0
WorkerRole2:
C:\Users\jonas\.nuget\packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll
CopyLocal = false
ExternallyResolved = true
FusionName = System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
HintPath = C:\Users\jonas\.nuget\packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll
ImageRuntime = v4.0.30319
MSBuildSourceProjectFile = C:\Users\jonas\source\repos\AzureCloudService1\WorkerRole2\WorkerRole2.csproj
MSBuildSourceTargetName = BuiltProjectOutputGroupDependencies
NuGetPackageId = System.ValueTuple
NuGetPackageVersion = 4.5.0
NuGetSourceType = Package
OriginalItemSpec = C:\Users\jonas\.nuget\packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll
Private = false
ReferenceAssembly = C:\Users\jonas\.nuget\packages\system.valuetuple\4.5.0\ref\net461\System.ValueTuple.dll
ReferenceSourceTarget = ResolveAssemblyReference
ResolvedFrom = {HintPathFromItem}
Version = 4.0.3.0
After searching for other related issues on various Microsoft issue trackers, I found this one, which seems related: https://github.com/dotnet/sdk/issues/1738.