Visual Studio - 使用System.Data.SQLite在项目中安装InstallShield

时间:2023-01-16 15:39:08

I have a C# class library that references System.Data.SQLite (from nuget). This is the structure of my bin folder after build:

我有一个引用System.Data.SQLite(来自nuget)的C#类库。这是构建后我的bin文件夹的结构:

  • MyProject.dll
  • MyProject.dll
  • System.Data.SQLite.dll
  • System.Data.SQLite.dll
  • x86/SQLite.Interop.dll
  • 86 / SQLite.Interop.dll
  • x64/SQLite.Interop.dll
  • X64 / SQLite.Interop.dll

System.Data.SQLite needs the SQLite.Interop to run and the correct dll is found at run time. However, when I generate a setup with InstallShield that includes the project primary output, the x86 and x64 folders are not copied and my application fails to run.

System.Data.SQLite需要运行SQLite.Interop并在运行时找到正确的dll。但是,当我使用包含项目主输出的InstallShield生成设置时,不会复制x86和x64文件夹,并且我的应用程序无法运行。

There is any way to force Visual Studio to include x86 and x64 folders in the primary output?

有什么方法可以强制Visual Studio在主输出中包含x86和x64文件夹?

There is any way to include the folders manually in the InstallShield with relative path?

有没有办法在InstallShield中手动包含文件夹和相对路径?

My environment:

我的环境:

  • Visual Studio 2012 Professional
  • Visual Studio 2012专业版
  • Install Shield 2013 Limited Edition (Free)
  • 安装Shield 2013限量版(免费)
  • System.Data.SQLite 1.0.96
  • System.Data.SQLite 1.0.96

2 个解决方案

#1


0  

Yes, there is a way to add/deploy folders through InstallShield. Under the Files tabs you can add the files/folder. While adding these files you can set relative path as well in this. Just set a property with the path and use that property in your relative path. So where do want to copy these files (reference locations for DLL), you can add that folder structure through InstallShield and you can add files in that.

是的,有一种方法可以通过InstallShield添加/部署文件夹。在“文件”选项卡下,您可以添加文件/文件夹。添加这些文件时,您也可以在此设置相对路径。只需使用路径设置属性,并在相对路径中使用该属性。那么在哪里想要复制这些文件(DLL的引用位置),您可以通过InstallShield添加该文件夹结构,并且可以在其中添加文件。

#2


0  

I just ran across the same problem using VS2013 / Installshield LE; I ended up opting for changing the NuGet package on my machine to NOT create the x86 folder for the SQLite.interop.dll under the build folder.

我刚刚使用VS2013 / Installshield LE遇到了同样的问题;我最终选择更改我的机器上的NuGet包,而不是在build文件夹下为SQLite.interop.dll创建x86文件夹。

To do that, look in the "packages\System.Data.SQLite.Core.1.0.104.0\build" folder under your project directory. Then pick the subfolder pertinent to the version of .NET you're targeting, and open the "System.Data.SQLite.Core.targets" file in a text editor. You'll want to delete all references to "%(RecursiveDir)" EXCEPT in the "SQLite Interop Library Content Items" section. Save, clean, and rebuild - the interop dll should now be in the same folder as the main executable/etc, and Installshield should be able to automatically include it as a dependency.

为此,请查看项目目录下的“packages \ System.Data.SQLite.Core.1.0.104.0 \ build”文件夹。然后选择与您要定位的.NET版本相关的子文件夹,并在文本编辑器中打开“System.Data.SQLite.Core.targets”文件。您将要删除“SQLite Interop库内容项”部分中对“%(RecursiveDir)”EXCEPT的所有引用。保存,清理和重建 - interop dll现在应该与主可执行文件/ etc位于同一文件夹中,Installshield应该能够自动将其作为依赖项包含在内。

If it doesn't show up in the right place, try editing a different .NET version's .target file until you hit the right one.

如果它没有显示在正确的位置,请尝试编辑其他.NET版本的.target文件,直到找到正确的文件。

#1


0  

Yes, there is a way to add/deploy folders through InstallShield. Under the Files tabs you can add the files/folder. While adding these files you can set relative path as well in this. Just set a property with the path and use that property in your relative path. So where do want to copy these files (reference locations for DLL), you can add that folder structure through InstallShield and you can add files in that.

是的,有一种方法可以通过InstallShield添加/部署文件夹。在“文件”选项卡下,您可以添加文件/文件夹。添加这些文件时,您也可以在此设置相对路径。只需使用路径设置属性,并在相对路径中使用该属性。那么在哪里想要复制这些文件(DLL的引用位置),您可以通过InstallShield添加该文件夹结构,并且可以在其中添加文件。

#2


0  

I just ran across the same problem using VS2013 / Installshield LE; I ended up opting for changing the NuGet package on my machine to NOT create the x86 folder for the SQLite.interop.dll under the build folder.

我刚刚使用VS2013 / Installshield LE遇到了同样的问题;我最终选择更改我的机器上的NuGet包,而不是在build文件夹下为SQLite.interop.dll创建x86文件夹。

To do that, look in the "packages\System.Data.SQLite.Core.1.0.104.0\build" folder under your project directory. Then pick the subfolder pertinent to the version of .NET you're targeting, and open the "System.Data.SQLite.Core.targets" file in a text editor. You'll want to delete all references to "%(RecursiveDir)" EXCEPT in the "SQLite Interop Library Content Items" section. Save, clean, and rebuild - the interop dll should now be in the same folder as the main executable/etc, and Installshield should be able to automatically include it as a dependency.

为此,请查看项目目录下的“packages \ System.Data.SQLite.Core.1.0.104.0 \ build”文件夹。然后选择与您要定位的.NET版本相关的子文件夹,并在文本编辑器中打开“System.Data.SQLite.Core.targets”文件。您将要删除“SQLite Interop库内容项”部分中对“%(RecursiveDir)”EXCEPT的所有引用。保存,清理和重建 - interop dll现在应该与主可执行文件/ etc位于同一文件夹中,Installshield应该能够自动将其作为依赖项包含在内。

If it doesn't show up in the right place, try editing a different .NET version's .target file until you hit the right one.

如果它没有显示在正确的位置,请尝试编辑其他.NET版本的.target文件,直到找到正确的文件。