A dependency is not been resolved in InstallShield - visual-studio-2010

A dependency is not been resolved in InstallShield.
My environment is VS 2010 and InstallShield Limited Edition.
I have a project that I’m trying to deploy using an InstallShield Limited Edition project.
The project to deploy has several references added via NuGet:
<packages>
<package id="Common.Logging" version="2.0.0" />
<package id="CsvHelper" version="1.4.0" />
<package id="log4net" version="1.2.10" />
<package id="NServiceBus" version="3.2.1" />
<package id="NServiceBus.Host" version="3.2.1" />
<package id="Quartz" version="2.0.1" />
</packages>
In the Setup project I added the primary output of the project (Step 2 Specify Application Data / Files). All dependencies are added (right click on the primary output -> dependencies from scan at build) except one. The Quartz.dll is missing from that list and from the files that are installed.
How can I fix this so all dependencies are resolved and added to the setup?
I don’t want to add the Quartz.dll manually because its location will change when a new version is available via NuGet.
BTW: Quartz.dll is a project reference.

IMO, dependency analysis tools ( and other profiling tools ) are good for gaining datapoints in making your own analysis of how an application works and what it's runtime / deployment needs are.
Attempting to encapsulate this process with an automagical "easy" button isn't a good strategy.
If you know your code nees "quartz.dll" then confirm that:
1) It's redistributable
2) It's doesn't already have a deployment solution ( For example, System.Windows.Forms gets deployed by the .NET FRamework Install )
3) Author it into your install manually if needed.
4) Turn off dependency scanning and repeat this process for all of your dependencies.
Is it more work then asking a piece of software to figure it out for you? Of course. Will it be more deterministic and reliable? Absolutely... and that's why we get paid the big bucks.

Related

Package dependency ignored by Visual Studio 2019

Context
There are two .NET Core 3.1 projects a Visual Studio 2019 16.7.2 solution.
The class lib project has a package dependency on NuGet package AutoMapper 9.0.0
The web application project has a project dependency on the class lib.
Runtime I got the "Could not load assembly AutoMapper 9.0.0.0". My first thought was some version mismatch but all projects set to .NET Core 3.1.
I've investigated, and in the web application project /bin folder there is no AutoMapper assembly.
So I've investigated further, and it seems the web app project somehow ignores this implicit dependency, see picture.
What I've tried so far:
I've tried to clean all, then rebuild.
I've tried to exit, then restart Visual Studio
Question
What am I missing here?
For Kirk's comment:
<ItemGroup>
<ProjectReference Include="..\Benedetto.Abstractions\Benedetto.Abstractions.csproj" />
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="4.0.1" />
First, Glad to know that you have solved the issue. To add an answer here for other community members handle similar issues.
Solution
clean all nuget caches first or just delete all nuget caches under C:\Users\xxx(current user)\.nuget\packages
close VS Instance, delete bin and obj folder
use nuget xxx\xxx.sln command line to restore nuget packages
then restart project to fix the issue.

Installing SQLite NuGet Package installs the package but the reference is not available. VS2019 Community

I"m writing a c# application using SQLite and I need the the SQLite Reference. Using NuGet I locate the package and the output window shows a successful install.
Looking at the packages config file in the solution explorer it shows the version installed.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="SQLite" version="3.13.0" targetFramework="net472" />
</packages>
However under the project References in the Solution explorer SQLite is not there.
I have watched tutorials online where the same process is done on other machines and all is ok, all of the references pop up after NuGet finishes the installation.
I'm using VS2019 and from what I understand there were some changes on how NuGet operates, however I had VS2015 and VS2017 Community and had the same issues. I'm really at a standing point as I have no idea how to get the reference to show up so I can access it in my program.
SQLite has no Assembly reference so adding it there is not an option.
I have seen posts about a NuGet config file and Package Config File as well as the possibility of the package being installed outside of the Solution Folder but I don't know where. I have looked in the output location of the solution and none of the references are located in the debug folder anywhere.
I feel the Dll's are being installed outside of the solution folder but I don't know where and how to get Visual Studio to get them to the proper location or reference there existing location correctly.
Rebuild and Restore NuGet Packages provide no solution.
Any help would be greatly appreciated.
Installing SQLite NuGet Package installs the package but the reference
is not available. VS2019 Community
I assume you have installed sqlite version 3.13.0 nuget package.If so, it is the behavior of this nuget package. This package is very special in that it is a transactional SQL database engine that implements self-contained, serverless, zero-configuration.
In simple terms, it is a configuration function package that operates on related data when the project is running, rather than a package that provides a reference class library for the project.
Let me explain it in more detail:
This is the content of the nuget package sqlite version 3.13.0
Note that each folder provides specific functionality for the installation project.
And the function of the lib folder is to add its content(xxxx.dlls) as reference to a new project. In a word, Only the Dlls in lib folder can be recognized by nuget and added into Reference.
You can refer to this link for more detailed info about the function of the folders.
Second, there is a file called SQLite.props in the Build folder. The file will do some configuration to your project during build process.
In it, you can see these files:
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
<Link>x64\%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
</ItemGroup>
<ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x86'">
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\*">
<Link>%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
</ItemGroup>
<ItemGroup Condition=" (Exists('packages.config') Or Exists('packages.$(MSBuildProjectName).config')) And '$(Platform)' == 'x64'">
<Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\*">
<Link>%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>False</Visible>
</Content>
So when you build your project, the SQLite.props file will be executed and they will provide services during build or at the runtime.
All of these indicates it is a package for specific execution functions rather than a nuget package for adding reference libraries to the project.
Suggestion
As a suggestion, you could install System.Data.SQLite in your project. And this nuget package provides the dlls which you want in Reference.
Hope it could help you.

NuGet newbie mayhem

I'm really new to NuGet and having all kinds of trouble with it. So the latest problem is that I generated a bunch of .nupkg files and put them in a shared folder on the network and then set NuGet up to look there for updates. So let's say in the folder I have:
Author.library.2.1.0.nupkg
Author.library.2.2.0.nupkg
Author.library.2.2.1.nupkg
I then found out that the target framework (.net) is different for some of my projects (under the same solution), so I generated new packages for each target:
Author.library.net40.2.1.0.nupkg
Author.library.net40.2.2.0.nupkg
Author.library.net40.2.2.1.nupkg
Author.library.net45.2.1.0.nupkg
Author.library.net45.2.2.0.nupkg
Author.library.net45.2.2.1.nupkg
Next I right-clicked on the solution and chose Manage NuGet Packages for Solution and then went to Online, pointed to the Installed Packages and was able to install each package to the applicable projects (.csproj files). But now when I open the NuGet Package Manager for the solution and click on Installed Packages, all I see is once instance of library. If I click on it, on the right I can see that it's pointing to the Author.library.net45 package, but I have no way of seeing the .net40 version of the library. So I can't add it to the .40 projects.
And lastly, what if I want some of the projects to point at an older version of a package. I know that I am suppose to be able to specify that in the packages.config file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Author.Library" version="2.2.0" allowedVersions="
[2.0.0,2.3.0)" targetFramework="net45" />
</packages>
which should load anything above (and including) 2.0 through 2.3)
or
<package id="Author.Library" version="(,2.4.0" targetFramework="net45" />
which should load any version below 2.4.
So my main question is why can't I see the two versions of the package in the NuGet Package Manager? And also, how do I best limit the versions that will apply to a particular library.
It looks like you cannot see the different packages since they both have the same package id of Author.Library. This is based on what you have shown in your packages.config file.
Also I would not have separate NuGet packages just for assemblies that target different frameworks. Instead put them in a single NuGet package in their own lib directory (e.g. lib/net40 lib/net45). You can have multiple assemblies targeting different frameworks in the same NuGet package. NuGet will pick the best match when installing the NuGet package into the project. Also note that you can use a NuGet package that contains just .NET 4.0 assemblies with a .NET 4.5 project since the assembly is compatible.
The allowedVersions attribute in the packages.config file is the thing to use if you want to restrict the NuGet packages that a project can update to.

Yellow Caution Icon/Glyph on Assembly Reference in Solution Explorer

I am using NuGet to manage dependencies.
I created a fresh Git clone of my solution, and noticed assembly reference problems.
I have Enabled Package Restore and checked settings as suggested here, but I still have these yellow caution icons on various assembly references:
For example, I had previously added AutoMapper through NuGet, so why is it broken here, and why isn't it showing in my packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="bootstrap" version="3.0.0" targetFramework="net45" />
<package id="EntityFramework" version="6.1.1" targetFramework="net45" />
<package id="jQuery" version="1.10.2" targetFramework="net45" />
<package id="Modernizr" version="2.6.2" targetFramework="net45" />
</packages>
This usually means that the reference you have in your project refers to an assembly which cannot be found on disk. To correct this problem the most direct solution is to note which references exist, remove them, and then re-add them. Since you are using NuGet to manage dependencies your job is much easier, you simply need to:
Remove all NuGet Packages (using "Package Manager")
Remove any lingering broken assembly references throughout your solution
Re-Add NuGet Packages to all projects which need them (again using Package Manager)
Based on your description, it sounds as though some projects did not have NuGet packages added to them, and perhaps the assemblies were 'cross referenced' by a developer from the NuGet packages folder. This is a mistake. Instead the NuGet packages must be added to all projects which depend on the packages. (For example, you should never find yourself manually adding an assembly reference to AutoMapper, ever, because it is managed by NuGet for you.)
Sometimes there is a bug where these appear prior to a nuget fetch, and selecting the reference node in Solution Explorer will cause the overlay glyph (yellow caution symbol) to remove itself (meaning the reference was resolved post-load, usually by 'package restore'.)
This is most often caused by project authors creating incorrect/direct references to assemblies in non-standard locations, thus a package restore will not resolve the reference issues, and the references typically break after a package update.
HTH
I manually went and removed all references that had the yellow mark next to them and then added them back one by one. This way, they started showing up in packages.config too.
I think the reason they weren't showing in packages.config previously was because I turned on the [Restore nuget packages] option much later in development. Had I done this as soon as I started my porject, I believe they would have shown up in packages.config.
PS. I used the search on nuget's website to find out if the package was available on nuget, or if it was a framework assembly.
You need to reinstall all packages in a project using:
Update-Package -ProjectName MyProject -Reinstall
In Package Manager Console, select your Default Project
Then
Update-Package -reinstall

Can I reference intermediate nuget package versions without putting them into remote repository?

I have 2 solutions in Visual Studio 2012. One solution is a dll project and another one is a desktop app which is using that dll.
I have a NuGet repository set up and all release versions of my dll have been put there. So my desktop app does not reference dll directly - it references a corresponding NuGet package.
I want to modify my dll. My question is as follows. While working on dll modifications I'll have to have some intermediate versions of my dll and I don't want to put them into remote NuGet repository.
Is there a convenient way to make my intermediate dll versions visible for desktop app?
I'm looking for something similar how maven does things in Java world (it looks for a version first in a local repository and then in remote one).
Could anyone please advise?
You could edit your nuget.config file to include a local source like so:
<packageSources>
<add key="NuGet official package source" value="https://nuget.org/api/v2/" />
<add key="MyLocalSource" value="C:\MyLocalSource" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
Then, every time you update your dll, simply put it into the local source folder, and it will automatically be available to your desktop app.

Resources