Search code examples
dependenciesproject

creating setup.msi for a solution that has 2 projects and the second one depends on the first


I've developed two projects. (1) is a Windows service and the (2) is an ASP .NET simple app that has just one page displaying a SELECT from a SQL database that (1) maintains. The (2) Project depends on the (1) [it has reference to (1) in the dependency its section] as it also uses log4net.Config and System.Data.SqlClient.

Inside (2) I call a static class from (1) and it works without any issues when (2) project runs on Visual Studio 2022.

Next, with Microsoft Visual Studio Installer Projects 2022, I've created a .msi for (2) as described here (just published items were added) https://learn.microsoft.com/en-us/visualstudio/deployment/installer-projects-net-core?view=vs-2022 Now, (2) builds, and I can install it and run.

Here what things become weird. The style of web page is different, binding is not as specified in the Properties\launchSettings.json file and the reference to log4net static class doesn't work. At the moment where my app tries accessing it the following error is displayed at the console fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware1 An unhandled exception has occurred while executing the request. System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.

I guess, that Setup Project did not add many of the things necessary for the app to run properly. But I just don't understand what are those things and how to add them (again in Visual Studio it runs and behaves as expected) and to my understanding those should’ve been added automatically the “dependencies” section specifies

Someone, please give me a hand here…


Solution

  • I had to add not just PublishedItems but the whole nine yards (html pages, css, etc.) to the output .msi Now it works