2

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.

Community
  • 1
  • 1
CrnaStena
  • 3,017
  • 5
  • 30
  • 48
  • >I checked out project.json, project.fragment.lock.json and project.lock.json. Are project.fragment.lock.json and project.lock.json in your project or they are generated during restore packages? How do you restore packages during the build? What's the result if you restore packages through dotnet restore command manually on that build agent machine? – starian chen-MSFT Aug 29 '16 at 05:26
  • project.fragment.lock.json and project.lock.json are part of the project and are checked into source control. this is on my machine and not build agent machine. – CrnaStena Sep 08 '16 at 18:18
  • 1
    I can't reproduce that issue. What's the result if you don't check project.lock json, project.fragment.lock.json and whole package into the source control. http://stackoverflow.com/questions/38448468/should-project-lock-json-file-be-checked-into-source-control-asp-net-core-1-0 , http://blog.falafel.com/what-is-project-lock-json/ – starian chen-MSFT Sep 09 '16 at 02:41
  • 1
    @starain that is what I ended up doing, using .tfignore to exclude lock.json files. – CrnaStena Sep 09 '16 at 17:44

2 Answers2

3

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
  }
},
CrnaStena
  • 3,017
  • 5
  • 30
  • 48
1

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.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • This will come in handy at some point, but at this point builds are still failing on my machine. In question I mentioned TFS 2013 as source control and not build agent machine. – CrnaStena Sep 08 '16 at 18:20