SQLite Forum

The CopySQLiteInteropFiles target in the NuGet package no longer works in Visual Studio 16.10

The CopySQLiteInteropFiles target in the NuGet package no longer works in Visual Studio 16.10

(1) By Dave Sparks (sparkplug) on 2021-05-26 23:46:17 [source]


Just a heads up to let you know that, as of version v16.10.0 of Visual Studio, the CopySQLiteInteropFiles target in the Stub.System.Data.SQLite.Core.NetFramework NuGet package no longer copies the SQLite.Interop.dll files to the relevant output directories during the build.

I have reported this to Microsoft here: Microsoft Developer Community: After installing VS v16.10.0, build target no longer copies files to output

(2) By anonymous on 2021-05-27 13:47:27 in reply to 1 [link] [source]

Hi, We found a workaround, there is a trailing slash missing, and because of that a condition is not met, that would copy the files.

you need to adapt the target file under: C:Users*yourUser*.nugetpackagesstub.system.data.sqlite.core.netframework1.0.113.3buildTransitivenet46Stub.System.Data.SQLite.Core.NetFramework.targets

We added a trailing slash to the end of this line: <SQLiteTargetFramework>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)..', '$(MSBuildThisFileDirectory)'))\</SQLiteTargetFramework>

Then it should work at least for the moment

(3) By anonymous on 2021-05-27 16:56:45 in reply to 1 [link] [source]

This is caused by a change in msbuild, see: https://github.com/dotnet/msbuild/issues/6493

(4) By BrunoJuchli on 2021-05-27 17:19:11 in reply to 1 [link] [source]


If the msbuild change does not get reverted the following should fix the problem in a backwards compatible manner:

Change Stub.System.Data.SQLite.Core.NetFramework.targets

Line 39 From: <SQLiteTargetFramework>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)..', '$(MSBuildThisFileDirectory)'))</SQLiteTargetFramework> To: <SQLiteTargetFramework>$([MSBuild]::EnsureTrailingSlash('$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)..', '$(MSBuildThisFileDirectory)'))'))</SQLiteTargetFramework>

The msbuild documentation states:

The EnsureTrailingSlash property function in MSBuild adds a trailing slash if one doesn't already exist.

(5) By BrunoJuchli on 2021-05-27 17:21:00 in reply to 1 [link] [source]

addendum: my suggestions only applies to the Stub.System.Data.SQLite.Core.NetFramework.targets files under the buildTransitive (nuget package) folder.

(6) By Dave Sparks (sparkplug) on 2021-06-04 05:36:39 in reply to 5 [link] [source]

Any chance that someone could update the Stub.System.Data.SQLite.Core.NetFramework nuget package with Bruno's solution? I know it's really a Microsoft problem but they are dragging their heels on this and it is blocking any builds with a System.Data.SQLite dependency.

(7) By mistachkin on 2021-06-06 15:43:43 in reply to 6 [link] [source]

I will look into the feasibility of fixing this issue in a portable and
reliable way later this week.

(8) By mistachkin on 2021-06-06 15:56:14 in reply to 4 [link] [source]

This proposal seems a bit risky given the nesting of single quote characters.

Does MSBuild actually support this?

Perhaps a more complex MSBuild target is needed with a well-defined sequence
of assignments that do not require nesting of single quotes?

(9) By anonymous on 2021-06-08 10:24:48 in reply to 8 [link] [source]

It's me, BrunoJuchli, again, just failing to log in.

Before I posted the code I tried it out and it did work.

Only problem I can think of is that copy-pasting might not have worked as expected, meaning forum software filtering some characters or something like that.

(10) By mistachkin on 2021-06-09 18:20:13 in reply to 7 [link] [source]

So far, I do not see a clean way to work around this issue in MSBuild.

Given how complex (and fragile) the NuGet packaging has been, I sincerely
hesitate to add more complexity here, as it would risk breaking (correct)
versions of MSBuild and/or Visual Studio.

(11) By Dave Sparks (sparkplug) on 2021-06-10 00:20:36 in reply to 10 [link] [source]

OK, thanks for looking into it. My pull request to fix the issue with MSBuild has eventually been merged and it looks like it will be part of VS 16.10.2 (.NET SDK 5.0.302). Hopefully that will be released soon and all will be fine.