-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.WindowsAzure.targets in combination with PackageReference resolves ref target #3699
Comments
@danielmarbach I am not sure for what product you are reporting this bug. |
I think the issue is related to |
I closed this issue since it seems there is no interest in fixing it. |
Hello! |
Not sure because the library I was trying to use did drop the reference to the value tuple in the end. |
Hi all, AnalysisIn case of a NuGet package that provides both kinds of assemblies, the build-only reference assemblies from ref/ end up in a MSBuild property A target <Target
Name="BuiltProjectOutputGroupDependencies"
DependsOnTargets="$(BuiltProjectOutputGroupDependenciesDependsOn)"
Returns="@(BuiltProjectOutputGroupDependency)">
<ItemGroup>
<BuiltProjectOutputGroupDependency
Include="@(ReferencePath->'%(FullPath)');
@(ReferenceDependencyPaths->'%(FullPath)');
@(NativeReferenceFile->'%(FullPath)');
@(_DeploymentLooseManifestFile->'%(FullPath)');
@(ResolvedIsolatedComModules->'%(FullPath)')"/>
</ItemGroup>
</Target> As you can see, this includes SolutionApparently So the fix should happen in Microsoft.WindowsAzure.targets, which is unfortunately not a part of this open source Azure SDK for .NET project here on GitHub. It comes from what's called "Azure Cloud Services build tools" component of Visual Studio and developed internally at Microsoft (DevDiv/AT-OneSdk). I have no idea how to raise a bug against that, developercommunity.visualstudio.com maybe? WorkaroundAdding this at the end of the inner .csproj files (for the individual worker roles) fixed the issue for me. A side effect is that it resulted in including some auxiliary .xml files too, maybe it could be made less dumb. <!-- When the final Azure Cloud Service project is retrieving all binaries to include in the deployment package,
it mistakenly queries the BuiltProjectOutputGroupDependencies target in this project, which doesn't contain
the full runtime assemblies from NuGet packages that have both the lib/ and ref/ directories. So override
the target here to include ReferenceCopyLocalPaths as a workaround.
See also https://github.com/Azure/azure-sdk-for-net/issues/3699 -->
<Target
Name="BuiltProjectOutputGroupDependencies"
DependsOnTargets="$(BuiltProjectOutputGroupDependenciesDependsOn)"
Returns="@(BuiltProjectOutputGroupDependency)">
<ItemGroup>
<BuiltProjectOutputGroupDependency Include="@(ReferenceCopyLocalPaths->'%(FullPath)');
@(ReferenceDependencyPaths->'%(FullPath)');
@(NativeReferenceFile->'%(FullPath)');
@(_DeploymentLooseManifestFile->'%(FullPath)');
@(ResolvedIsolatedComModules->'%(FullPath)')"/>
</ItemGroup>
</Target |
@yirkha Great solution! I have one more problem. Do you know how to copy pdb files of all referenced projects so those can be included in Cloud Service deployment? |
@dejanberic Not really, sorry. Maybe there is some other predefined property to use for that. But all I learned about how this works was from running MS Build with verbose logs, reading those, inspecting the default build target definitions bundled with VS etc. – and I'll gladly leave that to someone who needs it. Good luck! |
If someone has missing COM wrapper assemblies when using above workaround: |
When Cloud Service Solution with
Microsoft.WindowsAzure.targets
is used in combination withPackageReference
(old csproj format with package reference interop mode) in combination with a reference assembly likeSystem.ValueTuple
the reference assembly is copied into the output path instead of the implementation assembly for the target framework.Prerequisites
Azure SDK 2.9
VS2017 15.3.3 or higher
Steps to reproduce
System.ValueTuple
from nuget via packages.configTrace.TraceInformation(Read().ToString());
csx\Debug\roles\WorkerRole1\approot
contains 78 kb size ValueTuple implemenation assemblypackages.config
System.ValueTuple
via package referencesTrace.TraceInformation(Read().ToString());
BadImageFormatException
csx\Debug\roles\WorkerRole2\approot
contains 40 kb size ValueTuple ref assembly without implemenationsRepro Solution https://github.com/danielmarbach/PackageRef.CloudServicesRepro
Expected behavior
Target copies implementation assembly instead of ref assembly to csx output path.
The text was updated successfully, but these errors were encountered: