1
votes

I get the following error when a build is run

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.targets(2221,5): Error : Copying file web.config to obj\Release\CSAutoParameterize\original\web.config failed. Could not find file 'web.config'.

I've checked and the web.config file is in the repository.

I'm quite new to working with CI/CD, ms build so i don't know why i get this error.

Any ideas?

3
What kind of build agent are you running? "Hosted 2017"?Niels

3 Answers

0
votes

Double check to make sure the account that is running the build has access to the folder where the web.config is located.

0
votes

After reading through the console output from the failed build, it told me that it was looking for a web.config placed in a folder somewhere in the solution. This web.config file was Ignored according to my solution explorer in Visual Studio.

After "deleting" the file in the solution explorer, the solution could build

0
votes

I resolved this issue on an old project (MVC 2) by replacing the build step.

Before:

<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
</Target>

After:

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" ToolPath="$(AspNetToolPath)" />
</Target>