0
votes

I am trying to build my ASP.NET core 1.0 application using .Net framework 4.6.1

But I am keep getting below error-

Error Failed to make the following project runnable: Apex_POC (.NETFramework,Version=v4.6.1) reason: Access to the path 'C:\perforce\CFA\Apex\POC\Apex_POC\src\Apex_POC\bin\Debug\net461\win7-x64\Apex_POC.exe.config' is denied. Apex_POC C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 262

I verified path is correct and make sure that none of folder/files are in read only mode.

Also, verified I can write into this file. The current content of file is below (everything is by default, nothing is added from my side)-

<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>

How to resolve this issue?

My environment is VS2015 Professional update3 and a Windows 7 machine.

Thanks & Regards

Vishal

2
Are you running the build under a different user account?Victor Hurdugaci
No Victor. using same account and VS is also running under admin mode.Vishal26
Okay... Let see what else could cause this: (1) Do you have all the updates for Win 7 (SPs & stuff)? (2) Are you running multiple instance of VS or something like dotnet watch from a console? (3) Is the error consistent or sporadic?Victor Hurdugaci
(1) Yes, Windows 7 updated weekly basis. Even VS is also having latest updates. (2) I am running only single instance of VS2005 professional update3 in admin mode. Not using any console. (3) Error occurring consistently from today.Vishal26
(1) Do you have any post build scripts? (2) Does it happen for any solution or just this one (aka, does it happen for a new project)? (3) Do you have any csproj projects in the solution?Victor Hurdugaci

2 Answers

5
votes

The app.config file with the flag gcserver in your root ASP.NET Core MVC project folder was part of ASP.NET Core RC1 version where a separate config file was used for some config settings including to tell the runtime to perform garbage collection.

in RC2 this was moved to project.json and the flag name changed from gcserver to System.GC.Server

if you create a default ASP.NET Core RTM template you will notice that in your project.json you have the garbage collection flag and you don't have an app.config file.

Your solution is to copy the following section to your project.json and then to delete the app.config file in your root project directory from Visual Studio.

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

You can read more about the runtime configuration changes between RC1 and RC2 here

The different flag options here

I can just guess the reason for the error is that in RTM they don't allow copying a config value to your bin directory when debugging anymore.

1
votes

Remove app.config from your .xproj project and then try to build again.

Anything you want to add in app.config, you can either add it in web.config / project.json / appsettings.json

Similar issue is reported here- https://github.com/dotnet/cli/issues/3419#ref-issue-158822811