1

I have a solution in the visual studio with many projects consist of startup project and some libraries that libraries are used in the startup project. I have installed a package for one of the libraries but it does not work until I install that package for the startup project.

I want to know why I have to install libraries packages for the startup project.

Vahid Bahramian
  • 134
  • 1
  • 7
  • it would be very helpful to know _what_ package you are talking about, and how exactly it "does not work" without it... (and please provide _more_ information than the bare minimum, if possible.) – Franz Gleichmann Jun 28 '21 at 06:22
  • Are you using `PackageReference`? Can you show the contents of your project file that imports the package? Does it just specify the include and version, or other metadata too? – Drew Noakes Jun 28 '21 at 06:38
  • @FranzGleichmann I'm using microsoft.data.sqlite – Vahid Bahramian Jun 28 '21 at 06:59
  • @VahidBahramian i repeat. what package are you talking about, and **how exactly does it not work**? are you getting any errors - if so, please provide the error message and the code. (by editing your question). is it behaving differently from what you expect? then please describe how it behaves and how it should (by editing your question). please also read [how to ask a good question](https://stackoverflow.com/help/how-to-ask) – Franz Gleichmann Jun 28 '21 at 07:02
  • I am using microsoft.data.sqlite in one of my libraries to read a sqlite database while the solution builds successfully, I have a run time error at the open database method that says It can not find the needed assembly. I have to add microsoft.data.sqlite to the startup project to solve this problem. – Vahid Bahramian Jun 28 '21 at 07:44
  • @Vahid Bahramian.Your Microsoft.Data.Sqlite.dll may not have been copied to the startup project.You could check the Copy Local property of libraries.dll in the Main project's References (right-click Properties), the default value should be "True".(Try to set Copy Local to False, save the project and then reset it to True, then save again. This includes the Private node correctly, which MSBuild respects).It appears that the default for no included private node (Copy Local) in Visual Studio is True,while MSBuild reads that missing node as False. – Hui Liu-MSFT Jun 30 '21 at 02:22
  • And you can check if it can automatically add Microsoft.Data.Sqlite.dll to the main project. You could also refer to [here](https://stackoverflow.com/questions/1132243/msbuild-doesnt-copy-references-dll-files-if-using-project-dependencies-in-sol/21055664#21055664) to see if it fits your situation. – Hui Liu-MSFT Jun 30 '21 at 02:23

0 Answers0