RonC
RonC

Reputation: 33897

How to resolve Lock file error? "...contains msbuild projects but there is no export file"

I am running visual studio Community 2015 Update 3. I have a solution that has been compiling fine but is now generating an error when I try to compile it. The error is

Lock file Microsoft.DotNet.ProjectModel.Graph.LockFile contains msbuild projects but there is no export file

This error is displayed in the Error List window when I compile the solution and the error list indicates that it relates to a project in the solution which is an .Net Core Library that houses my xUnit tests.

The error information indicates that the error is on line 262 of C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets

Screenshot of that location selected below:

enter image description here

The solution contains:
____Asp.Net Core project targeting net461
____Windows Library Project targeting .Net Framework
____ A 2nd Windows Library Project targeting .Net Framework 4.61
____A .Net Core Libary Project targeting net461 (used holding XUnit Tests)


If I try to compile each project individually, they all compile fine except for the project holding the xUnit Tests that generates this error.

The Big Question
So what does "Lock file Microsoft.DotNet.ProjectModel.Graph.LockFile contains msbuild projects but there is no export file" mean? And how can I fix it?

Upvotes: 1

Views: 913

Answers (2)

hsop
hsop

Reputation: 3696

I had a similar problem, not with the build inside Visual Studio, but with msbuild. For a long time I was sure that the error was caused by dotnet tooling beeing in a preview state, but finally came upon, that one xproj-project wasn't build before another xproj-project, that was dependent of the first one. So I started looking for solutions to build-order problems instead, and came across an old blog-post by Victor Sergienko http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/ that solved the problem by adding a dependency from the second project to the first like this:

Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ProjectOne", "ProjectOne.xproj", "{CAF36C07-36C7-4842-A2DA-9737005D2835}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ProjectTwo", "ProjectTwo.xproj", "{82875D1E-3F13-430B-8946-C26E08BD9DF9}"
ProjectSection(ProjectDependencies) = postProject
    {CAF36C07-36C7-4842-A2DA-9737005D2835} = {CAF36C07-36C7-4842-A2DA-9737005D2835}
EndProjectSection

EndProject

Now my solution builds in TeamCity again... finally!

Upvotes: 1

RonC
RonC

Reputation: 33897

Posting how I got past this error in case it helps others. Ultimately this issue was solved by removing all the projects from the solution, adding them back one by one and then reestablishing the project references. I would attribute the root issue to the .net core preview2 tooling still being flaky.

Upvotes: 1

Related Questions