SQLite Forum

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

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 [link]

Hi,

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](https://developercommunity2.visualstudio.com/t/After-installing-VS-v16100-build-targ/1432786)

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

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*\.nuget\packages\stub.system.data.sqlite.core.netframework\1.0.113.3\buildTransitive\net46\Stub.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]

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

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

@Maintainers

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](https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2019) 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]

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]

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]

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

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]

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]

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]

OK, thanks for looking into it. My [pull request](https://github.com/dotnet/msbuild/pull/6513) to fix the issue with MSBuild has eventually been merged and it [looks like](https://github.com/dotnet/msbuild/pull/6537) 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.