How to auto include dependencies in a VSIX project?

Cal Arabshahi 1 Reputation point
2020-09-03T01:56:56.64+00:00

I have the following References in my VSIX project

VSIX Project has a
Project-Reference to Proj-A and Proj-A has a
Package-Reference to Pkg-B and Pkg-B has
Package-References

Assemblies from Pkg-B are not added to the VSIX file.

Build output shows:

Primary reference "IdentityModel.OidcClient, Version=3.0.0.0, Culture=neutral, PublicKeyToken=5580d04c1b6c37c1". (TaskId:551)
Resolved file path is "C:\Users\ca120455.nuget\packages\identitymodel.oidcclient\3.1.2\lib\net461\IdentityModel.OidcClient.dll". (TaskId:551)
Reference found at search path location "{HintPathFromItem}". (TaskId:551)
This reference is not "CopyLocal" because at least one source item had "Private" set to "false" and no source items had "Private" set to "true". (TaskId:551)
The ImageRuntimeVersion for this reference is "v4.0.30319". (TaskId:551

Input to the CreateVsixSourceItemFromReferences task:

C:\Users\x.nuget\packages\identitymodel.oidcclient\3.1.2\lib\net461\IdentityModel.OidcClient.dll
AdditionalProperties=TargetFramework=net461
BuildReference=true
Configuration=Debug
CopyLocal=false
ExternallyResolved=true
FullConfiguration=Debug|AnyCPU
FusionName=IdentityModel.OidcClient, Version=3.0.0.0, Culture=neutral, PublicKeyToken=5580d04c1b6c37c1
HintPath=C:\Users\x.nuget\packages\identitymodel.oidcclient\3.1.2\lib\net461\IdentityModel.OidcClient.dll
ImageRuntime=v4.0.30319
IncludeOutputGroupsInVSIX=BuiltProjectOutputGroupDependencies
IncludeOutputGroupsInVSIXLocalOnly=DebugSymbolsProjectOutputGroup;
MSBuildSourceProjectFile=Y
MSBuildSourceTargetName=BuiltProjectOutputGroupDependencies
Name=Y
NuGetPackageId=IdentityModel.OidcClient
NuGetPackageVersion=3.1.2
NuGetSourceType=Package
OriginalItemSpec=C:\Users\x.nuget\packages\identitymodel.oidcclient\3.1.2\lib\net461\IdentityModel.OidcClient.dll
OutputItemType=
PackageName=IdentityModel.OidcClient
PackageVersion=3.1.2
PathInPackage=lib/net461/IdentityModel.OidcClient.dll
Platform=AnyCPU
Private=false
Project={016A250B-6311-4E65-ABB0-BBAC027C1F1E}
ReferenceOutputAssembly=true
ReferenceSourceTarget=ResolveAssemblyReference
ResolvedFrom={HintPathFromItem}
SetConfiguration=Configuration=Debug
SetPlatform=Platform=AnyCPU
Targets=
Version=3.0.0.0

Skipping item: C:\Users\ca120455.nuget\packages\identitymodel.oidcclient\3.1.2\lib\net461\IdentityModel.OidcClient.dll (TaskId:552)

Question: How to change the project settings to include the assemblies from Pkg-B in the VSIX file?

Community Center | Not monitored
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2020-09-03T09:22:12.87+00:00

    Hi CalArabshahi,

    You could follow the steps below:

    1. Open source.extension.vsixmanifest file
    2. Go to Asset, then click "New"
    3. Select Type to "Microsoft.VisualStudio.Assembly"
    4. Select Source to "File on filesystem"
    5. Select the library( though it is a absolute path, when you click "OK", the path will be auto changed to relative directory, and the assembly will be auto copied into relative path)
    6. Set the Embed in this folder you want, or you could also leave it empty.
    7. Set the Target Version, or you could also leave it empty.
    8. Click "OK" 22389-annotation-2020-09-03-1127203.jpg

    At last, you could re-build your project, the assembly will be included in the vsix.

    Best Regards,
    Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Cal Arabshahi 1 Reputation point
    2020-09-03T21:18:51.033+00:00

    Hi Dylan,

    Thanks for the response.

    The solution provided is not automatic; meaning that
    1- there is a chain of dependencies starting with IdentityModel.OidcClient; I do not want to manually add every assembly
    2- Proj-A had a package-reference to Pkg-B; therefore I expected the build process to automatically resolve the dependencies.

    At this point, my solution is to add the Nuget (for IdentityModel.OidcClient) to the VSIX project itself even-though Proj-A already depends on the Nuget package. So at this point the Tree of references is

    VSIX Project has a
    --Project-Reference to Proj-A and Proj-A has a
    ----Package-Reference to Pkg-B and Pkg-B has
    ------Package-References
    --Package-Reference to Pkg-B

    With this setup; the VSIX file has all direct and indirect referenced assemblies.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.