|
185 | 185 | <AppDesigner Include="Properties\" /> |
186 | 186 | </ItemGroup> |
187 | 187 |
|
| 188 | + <!-- SQLite native DLL package location (needed early for Content items) --> |
| 189 | + <PropertyGroup> |
| 190 | + <SQLiteStubPackageDir Condition="'$(SQLiteStubPackageDir)' == '' AND '$(NuGetPackageRoot)' != ''">$(NuGetPackageRoot)stub.system.data.sqlite.core.netframework\1.0.119\</SQLiteStubPackageDir> |
| 191 | + <SQLiteStubPackageDir Condition="'$(SQLiteStubPackageDir)' == ''">$(UserProfile)\.nuget\packages\stub.system.data.sqlite.core.netframework\1.0.119\</SQLiteStubPackageDir> |
| 192 | + </PropertyGroup> |
| 193 | + |
| 194 | + <!-- Include SQLite native DLLs in ClickOnce deployment --> |
| 195 | + <ItemGroup> |
| 196 | + <Content Include="$(SQLiteStubPackageDir)build\net46\x86\SQLite.Interop.dll" Condition="Exists('$(SQLiteStubPackageDir)build\net46\x86\SQLite.Interop.dll')"> |
| 197 | + <Link>x86\SQLite.Interop.dll</Link> |
| 198 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 199 | + <PublishState>Include</PublishState> |
| 200 | + <IncludeHash>true</IncludeHash> |
| 201 | + <FileType>File</FileType> |
| 202 | + <Visible>false</Visible> |
| 203 | + </Content> |
| 204 | + <Content Include="$(SQLiteStubPackageDir)build\net46\x64\SQLite.Interop.dll" Condition="Exists('$(SQLiteStubPackageDir)build\net46\x64\SQLite.Interop.dll')"> |
| 205 | + <Link>x64\SQLite.Interop.dll</Link> |
| 206 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
| 207 | + <PublishState>Include</PublishState> |
| 208 | + <IncludeHash>true</IncludeHash> |
| 209 | + <FileType>File</FileType> |
| 210 | + <Visible>false</Visible> |
| 211 | + </Content> |
| 212 | + </ItemGroup> |
| 213 | + |
188 | 214 | <ItemGroup> |
189 | 215 | <EmbeddedResource Include="NavfertyRibbon.xml" /> |
190 | 216 | </ItemGroup> |
|
218 | 244 | <ManifestKeyFile>Navferty.pfx</ManifestKeyFile> |
219 | 245 | </PropertyGroup> |
220 | 246 |
|
| 247 | + <!-- Custom target to ensure SQLite native DLLs are copied to output directory --> |
| 248 | + <Target Name="CopySQLiteNativeDlls" AfterTargets="Build;_CopyFilesToPublishFolder;ComputeFilesToPublish"> |
| 249 | + <PropertyGroup> |
| 250 | + <!-- SQLite native DLLs are in the stub package, not the main package --> |
| 251 | + <SQLiteStubPackageDir>$(NuGetPackageRoot)stub.system.data.sqlite.core.netframework\1.0.119\</SQLiteStubPackageDir> |
| 252 | + <!-- Fallback if NuGetPackageRoot is not set --> |
| 253 | + <SQLiteStubPackageDir Condition="'$(NuGetPackageRoot)' == ''">$(UserProfile)\.nuget\packages\stub.system.data.sqlite.core.netframework\1.0.119\</SQLiteStubPackageDir> |
| 254 | + </PropertyGroup> |
| 255 | + |
| 256 | + <!-- Log diagnostic information --> |
| 257 | + <Message Text="=== SQLite Native DLL Copy Target ===" Importance="high" /> |
| 258 | + <Message Text="SQLite Stub Package Directory: $(SQLiteStubPackageDir)" Importance="high" /> |
| 259 | + <Message Text="Output Directory: $(OutDir)" Importance="high" /> |
| 260 | + <Message Text="Publish Directory: $(PublishDir)" Importance="high" /> |
| 261 | + |
| 262 | + <ItemGroup> |
| 263 | + <!-- Get SQLite native DLLs from the stub package --> |
| 264 | + <SQLiteNativeFiles Include="$(SQLiteStubPackageDir)build\net46\x86\SQLite.Interop.dll" Condition="Exists('$(SQLiteStubPackageDir)build\net46\x86\SQLite.Interop.dll')"> |
| 265 | + <DestinationFolder>$(OutDir)x86\</DestinationFolder> |
| 266 | + <PublishDestinationFolder>$(PublishDir)Application Files\$(AssemblyName)_$(ApplicationVersion)\x86\</PublishDestinationFolder> |
| 267 | + <Arch>x86</Arch> |
| 268 | + </SQLiteNativeFiles> |
| 269 | + <SQLiteNativeFiles Include="$(SQLiteStubPackageDir)build\net46\x64\SQLite.Interop.dll" Condition="Exists('$(SQLiteStubPackageDir)build\net46\x64\SQLite.Interop.dll')"> |
| 270 | + <DestinationFolder>$(OutDir)x64\</DestinationFolder> |
| 271 | + <PublishDestinationFolder>$(PublishDir)Application Files\$(AssemblyName)_$(ApplicationVersion)\x64\</PublishDestinationFolder> |
| 272 | + <Arch>x64</Arch> |
| 273 | + </SQLiteNativeFiles> |
| 274 | + </ItemGroup> |
| 275 | + |
| 276 | + <!-- Log what we found --> |
| 277 | + <Message Text="Found @(SQLiteNativeFiles->Count()) SQLite native DLL(s)" Importance="high" /> |
| 278 | + <Message Text=" - %(SQLiteNativeFiles.Identity) [%(SQLiteNativeFiles.Arch)]" Importance="high" Condition="'@(SQLiteNativeFiles)' != ''" /> |
| 279 | + <Warning Text="No SQLite native DLLs found in $(SQLiteStubPackageDir)" Condition="'@(SQLiteNativeFiles)' == ''" /> |
| 280 | + |
| 281 | + <!-- Copy to build output directory --> |
| 282 | + <Copy SourceFiles="@(SQLiteNativeFiles)" |
| 283 | + DestinationFolder="%(SQLiteNativeFiles.DestinationFolder)" |
| 284 | + SkipUnchangedFiles="true" |
| 285 | + Condition="'@(SQLiteNativeFiles)' != ''" /> |
| 286 | + |
| 287 | + <!-- Copy to publish directory if publishing (for ClickOnce) --> |
| 288 | + <Copy SourceFiles="@(SQLiteNativeFiles)" |
| 289 | + DestinationFolder="%(SQLiteNativeFiles.PublishDestinationFolder)" |
| 290 | + SkipUnchangedFiles="true" |
| 291 | + Condition="'$(PublishDir)' != '' AND '@(SQLiteNativeFiles)' != ''" /> |
| 292 | + |
| 293 | + <!-- Also copy to root publish directory as fallback --> |
| 294 | + <Copy SourceFiles="@(SQLiteNativeFiles)" |
| 295 | + DestinationFolder="$(PublishDir)%(SQLiteNativeFiles.Arch)\" |
| 296 | + SkipUnchangedFiles="true" |
| 297 | + Condition="'$(PublishDir)' != '' AND '@(SQLiteNativeFiles)' != ''" /> |
| 298 | + |
| 299 | + <Message Text="✓ Copied SQLite native DLLs to: $(OutDir)" Importance="high" Condition="'@(SQLiteNativeFiles)' != ''" /> |
| 300 | + <Message Text="✓ Copied SQLite native DLLs to: $(PublishDir)" Importance="high" Condition="'$(PublishDir)' != '' AND '@(SQLiteNativeFiles)' != ''" /> |
| 301 | + </Target> |
| 302 | + |
221 | 303 | <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" /> |
222 | 304 |
|
223 | 305 | <Import Project="$(VSToolsPath)\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" Condition="Exists('$(VSToolsPath)\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets')" /> |
|
0 commit comments