CrnaStena
CrnaStena

Reputation: 3157

Generate Dependency Fragment File task failed

I am testing .Net Core 1.0. There are two scenarios:

1) .Net Core 1.0 project is checked into TFS 2013

I created initial project based on the template provided by VS. After initial check-in to local TFS 2013 server, following builds (on my machine, not build machine) fail consistently getting this and similar assess to the path is denied.

Error   MSB4018 The "GenerateDependencyFragmentFile" task failed unexpectedly.
System.UnauthorizedAccessException: Access to the path 'C:\workspace\Project1\Solution1\Web1\project.fragment.lock.json' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at System.IO.File.Delete(String path)
   at Microsoft.VisualStudio.ProjectSystem.DotNet.FileSystem.RemoveFile(String referenceFile)
   at Microsoft.DotNet.Tasks.GenerateDependencyFragmentFile.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
C:\workspace\Project1\Solution1\Web1\Web1.xproj 
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets  
Line: 349   

2) .Net Core 1.0 project is checked into VSTS

I've tried same bare-bones, out of the box project that is not checked into source control and it builds fine.

I've also tried same bare-bones, out of the box project that is checked into Visual Studio Team Service online source control (VSTC) and that one builds fine.

What else?

I am running VS as Administrator.

So based on similar problems/solutions found around internet, I tried following. I checked out project.json, project.fragment.lock.json and project.lock.json. At this point project build fails with:

Error       Failed to make the following project runnable: Web1 (.NETFramework,Version=v4.5.2) reason: 
Access to the path 'C:\workspace\Project1\Solution1\Web1\bin\Debug\net452\win7-x64\Microsoft.ServiceFabric.Internal.Strings.dll' is denied. 
Web1    
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets  
Line: 262   

I also tried following solutions:

  1. SO-37928200
  2. dotnet-cli#3794, by installing latest dotnet-cli.

Any suggestions?

UPDATE 1

Only thing that helps is checking out whole packages and project in question folders. But to me that does not seem like reasonable solution.

UPDATE 2

I updated some language in the question to clarify that builds fail on my local machine and not build machine, I have not come to that part yet.

Upvotes: 2

Views: 1072

Answers (2)

CrnaStena
CrnaStena

Reputation: 3157

So after a lot of research (and trial and error) I ended up adding .tfignore file to the root folder in order to exclude *.lock.json files from whole solution.

.tfignore contents:

######################################
# exclude all lock.json files
*.lock.json

Additionally, I've removed app.config files and added appropriate equivalent (see below) to project.json.

"runtimeOptions": {
  "configProperties": {
    "System.GC.Server": true
  }
},

Upvotes: 3

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

You need to follow the steps here: Build ASP.NET Core 1.0 with TFS 2013.4 Build Server to build Asp.Net Core project on TFS 2013.

Upvotes: 1

Related Questions