understanding of Visual Studio Workloads, Components and packages - visual-studio

when I'm examining some VS installer logs from different computers to check for differences
for example: dd_setup_2019123333.log:
there are some lines like:
> Package: Microsoft.Net.Core.SDK.MSBuildExtensions,version=15.9.28307.51,
> CurrentState: Absent, RequestedState: Present, DetectionState: Absent,
> PlannedAction: Install.
there will be also further entries and a dd_setup_201911312323_Microsoft.Net.Core.SDK.MSBuildExtensions.log file with more detailed steps.
How do I find the VS workload or components that depends on that package, so I am able to install it properly by defining VS components? Where else could I find the source of that package?
and if I want to check it vice versa:
> Property: InstallationWorkloads, value:
> Microsoft.VisualStudio.Workload.CoreEditor,Microsoft.VisualStudio.Workload.ManagedDesktop,Microsoft.VisualStudio.Workload.NetWeb
2nd question: where do I find, what's included in e.g. Microsoft.VisualStudio.Workload.NetWeb?
Edit:
Answer for 2nd Q is mostly here:

First of all, please let me introduce the relationship between packages, components and workloads.
If we install a workload, some components are required by that workload to install, some are recommended and others are optional.
And if we install a component, several packages will be installed for that component.
Eg: If I install a component "Microsoft.VisualStudio.Component.Unity", apart from the "Microsoft.VisualStudio.Component.Unity" package, some packages which have dependency with it also will be installed such as "SyntaxTree.VisualStudio.Unity.Msi,version=3.9.0.3" package.(We can find them in C:\ProgramData\Microsoft\VisualStudio\Packages)
How do I find the VS workload or components that depends on that
package?
For most packages, we can find which component and workload depends on it according to this document.
However, for the package" Microsoft.Net.Core.SDK.MSBuildExtensions", it seems a package which the component package depends on or in a sdk. So we can’t locate accurately which component the package belongs to because not only one component or workload depends on it.
As the picture below: We can find the workloads and components which depend on it by the log .
Where else could I find the source of that package?
In the log, you can check if there has a download url for you to manually install it. And I find a download url(for version=15.9.28307.272) :
https://download.visualstudio.microsoft.com/download/pr/b78321cf-2968-49be-a845-fb99347d436e/f938871be0a92ffda7bf6bb1f8c2015f/payload.vsix Hope it helps.
Where do I find, what's included in e.g.
Microsoft.VisualStudio.Workload.NetWeb?
You can find them here.

Related

Difference between cgal and cgal-cpp

I am currently trying to install some packages for colmap according to https://colmap.github.io/install.html. But as I work in a conda environment, I try to install cgal using conda.
To me it is not really clear however which is the correct pendant to libcgal-dev in conda.
I found that there is a package on the conda-forge channel called cgal and one called cgal-cpp.
Can anyone tell me what is the difference between those two packages?
Since I got conflicts for the former, I installed the second one and thus, I am not sure if that contains all files that the libcgal-dev contains or if I still miss some files.
I think cgal-cpp contains all the usual C++ headers, while cgal contains the Python bindings.

How to determine version of iTextSharp?

I'm using VS2022, and I received an old project, where iTextSharp was used, but I can't determine a specific version of the mentioned.
I've tried - Tools -> Nuget Package Manager -> Manage Nuget Packages for Solution...
But was unable to find iTextSharp.
Thanks in advance.
It sounds like the assembly has been included directly in the source control, as was common place before nuget. Take a look in your project's references and you should be able to locate the dll. Checking the file's properties in VS should show you the assembly's details in the properties panel and should also show you which version is being used, if not the path or filename may give you a clue as to the version being used.

Can the Yarn 2 Constraints feature block the installation of a package?

I have a deep dependency tree. Some of the packages depend on nodejs packages that I don't need. Is it possible for Yarn 2 (berry) to skip those packages, i.e. not install them?
Yarn has a Constraints feature, but I don't know what's possible with it. There are examples, but not for ignoring a package completely.
Is this possible? Thanks
Constraints allow you to enforce rules on the dependency your project (and workspaces) have. It's a tool for writing rules that are applied to what goes in your various package.json files, like "every workspace must have the same version of react" or "no workspace may depend on package X".
If you have a dependency that is depending on something that you believe is really an optional dependency, you can use .yarnrc to change that dependency into an optional one. Use yarn why <foo> find the package that is causing the unwanted deep dependency, and then add something like this to .yarnrc (specific example yoinked from here):
# Make `eslint-plugin-flowtype`'s peerDependency on `#babel/plugin-syntax-flow` optional.
# Use `dependenciesMeta` for non-peer deps, of course ;).
packageExtensions:
'eslint-plugin-flowtype#*':
peerDependenciesMeta:
'#babel/plugin-syntax-flow':
optional: true
Note that doing this is in general quite risky: you should probably be filing a bug upstream if you think a package is depending on something that should really be an optional dependency.
Lastly, note that it's very possible this whole thing is a non-problem: webpack (or whatever bundler is in fashion a week after I write this) is probably deleting the unwanted files at compile-time anyway? If you find the mere presence of the node packages you don't like is causing issues (eg. via typescript typings?) then that's a different problem that should be solved differently.

PackageReference version is ignored

In our project we're creating different NuGet packages (using suffixes) for different branches. In the .csproj file I'm trying to specify the specific version of a package that should be used.
Package names can be 1.2.3, 1.2.3-rc001, or 1.2.3-pr001.
First issue:
I tested using
<PackageReference Include="Package.Name" Version="[1.2.3,1.2.6)" /> where there was no 1.2.3. My understanding is it should use the next available version, but now it simply says the selected package is 1.2.3, with "Not available in this source". Updating NuGets also ignores this and simply updates to the latest release, 1.2.10. After that it overwrites the Version in .csproj, so the specified bounds are lost.
Second issue, that falls in with the first, is to specify to only use -pr* or -rc* versions. 1.2.*-pr* is not a valid option, so maybe our numbering scheme needs changing.
First issue: I tested using where there was no 1.2.3. My understanding
is it should use the next available version, but now it simply says
the selected package is 1.2.3, with "Not available in this source".
Actually, when you set different versions of a nuget package by floating versions(in your situation, 1.2.3<=version<1.2.6), NuGet chooses the package that's closest to the application and ignore the others. So it will choose 1.2.3 regardless of whether it exists in your current nuget caches.See this document.
So PackageReference will not reference the package based on the closest available version in your current cache and choose the newest version not matter whether it exits under your local machine.
Second issue, that falls in with the first, is to specify to only use
-pr* or -rc* versions. 1.2.-pr is not a valid option, so maybe our numbering scheme needs changing.
At the moment, prerelease versions cannot be used together with floating versions.It means that you cannot use any pre-release characters with floating versions . So -pr* and -rc* are illegal including 1.2.*-pr*.
During use, no characters about the pre-release version can appear.
Instead, you can use
1.2.*-*
Besides, the 1.2.*-beta1 is also illegal. Though it shows a version under Dependencies UI, you can not find it under Nuget Package Manager-->Installed which means that the package is missing and the project has lost it.
In addition, there is a similar issue which you can refer to.

Unable to install NuGet pck - Microsoft.Web.Infrastructure is not in my GAC

The error:
Failed to add reference. The package 'SimpleInjector.Integration.WebApi.WebHost.QuickStart' tried to add a framework reference to 'Microsoft.Web.Infrastructure' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Cannot find assembly 'Microsoft.Web.Infrastructure'.
First of all. Why the error when I have the dll and reference to it in my project?
Second. How do I fix this?
Obviously I've tried to add the assembly to my GAC with various guides from Mircosoft. None of them makes sense imo.
https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-install-an-assembly-into-the-gac
This results in "Failure adding assembly to the cache: The system cannot find the file specified." I guess that's because it's not a strongly typed name with a key pair or what ever. So I looked into this https://learn.microsoft.com/en-us/dotnet/framework/app-domains/how-to-sign-an-assembly-with-a-strong-name
which makes absolutely no sense. It says:
"In the Choose a strong name key file box, choose , and then navigate to the key file. To create a new key file, choose and enter its name in the Create Strong Name Key dialog box."
What key file? Create a new and just come up with a random name? Wtf? How is that related to a specific assembly?
I faced a similar issue with error "Unable to uninstall 'Ninject.3.2.2' because 'Ninject.Extensions.ChildKernel.3.2.0, Ninject.Extensions.Conventions.3.2.0, Ninject.Web.3.2.0, Ninject.Web.Common.3.2.0' depend on it.".
It was caused by multiple projects in the solution having a dependency on those DLLs and so package manager was not able to uninstall it.
The command with "uninstall package-name -RemoveDependency" too doesn't work here.
I removed the dependency one by one to fix it.
As #Schadensbegrenzer and #LeoLiu-MSFT pointed out, the Infrastrcuture assembly is not part of the .NET framework (anymore).
The issue has been reported as a bug on SimpleInjectors repo:
https://github.com/simpleinjector/SimpleInjector/issues/509
The package owners solution:
"I'll add this issue to the v4.1 backlog, and will fix the NuGet package (and that of SimpleInjector.Integation.MVC3 as well) with v4.1.
In the meantime, you can manually add the Microsoft.Web.Infrastructure NuGet package to your Web API project or don't add the SimpleInjector.Integration.WebApi.WebHost.QuickStart NuGet package to your project, but just the SimpleInjector.Integration.WebApi NuGet package and add the required code manually. The WebHost.QuickStart package is in fact nothing more than a reference to the integration package while injected some code into your application anyway.
The Web API integration page in the documentation describes how to set up a Web API project using Simple Injector."

Resources