Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential cross-platform path handling issue in EntityDeploy MSBuild task #1378

Closed
mistachkin opened this issue Oct 13, 2019 · 5 comments
Closed
Assignees
Milestone

Comments

@mistachkin
Copy link
Contributor

mistachkin commented Oct 13, 2019

The OutputCMS method in the source file "src/Microsoft.Data.Entity.Build.Tasks/EntityDeploy.cs" has the following code:

FileInfo outputFile = new FileInfo(Path.Combine(topLevelOutputDir.FullName, inputFileRelativePath));

And then a bit later in the same method:

string outputDirPath = outputDir.FullName + "\\";

I think hard-coding the backslash here is causing the problem I'm seeing with my Linux build:

CSC : error CS1566: Error reading resource 'NorthwindModel.EF6.NetStandard21.csdl' -- 'Could not find file './testlinq/obj/Debug/netcoreapp3.0/NorthwindModel.EF6.NetStandard21.csdl'.' [./testlinq/testef6.NetStandard21.csproj]

Within the "obj/Debug/netcoreapp3.0" directory, I see the following files and directories:

(directory) edmxResourcesToEmbed
(file) edmxResourcesToEmbed\NorthwindModel.EF6.NetStandard21.ssdl
(file) edmxResourcesToEmbed\NorthwindModel.EF6.NetStandard21.msl
(file) edmxResourcesToEmbed\NorthwindModel.EF6.NetStandard21.csdl
(file) testef6.NetStandard21.assets.cache
(file) testef6.NetStandard21.csproj.FileListAbsolute.txt
(file) testef6.NetStandard21.csprojAssemblyReference.cache

Notice the three files that have a backslash within their name? That is the root of the problem, which I'm pretty sure was caused by the errant code in the MSBuild task.

I think the solution may be as simple as using the System.IO.Path.DirectorySeparatorChar field instead of hard-coding the backslash; alternatively, the Path.Combine method could potentially be used (again) in this method to avoid using the character at all.

FYI: This issue is currently blocking the release of .NET Core 3.0 support for System.Data.SQLite.

@ajcvickers
Copy link
Member

@bricelam Thoughts?

@mistachkin
Copy link
Contributor Author

Update: I think part of the problem here is actually a bad interaction with the private CreateTaskItem method within the same file. It searches for Path.DirectorySeparatorChar, not backslash. Seemingly, this would lead to an incorrect LogicalName being set on the created TaskItem.

@mistachkin
Copy link
Contributor Author

I think pull request #1385 should contain the necessary changes to fix this issue.

@bricelam
Copy link
Contributor

PR looks good to me. I suspected there might be bugs in this area. #1137 (comment)

@springy76
Copy link

@mistachkin btw: I was the one who created ticket ce75d320d0a31dabfec48df265e611d0fc235a30 asking for netcore3/netstandard2.1. I have to admit I'm not a "fan" of fossil (I have no clue how to register there, thats why I'm using anonymous all the time) and I might not have the time to build System.Data.SQLite myself -- or is there a private feed of prerelease NuGet packages?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants