1

I'm implementing Minification and Bundling in my asp.net MVC3 application. I installed the nuget package for System.Web.Optimization 1.1.3.

Now when I build it will build ok for a bit then I get this error:

Error 312 Unable to copy file "D:\TFS\CIS3G_3_34\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.xml" to "bin\System.Web.Optimization.xml". Access to the path 'bin\System.Web.Optimization.xml' is denied. CIS3G

Once I get that error I can't build. I looked and the file is locked by the vs2010 ide. If I close the ide, I can delete the file and it works for a little while again, then it gets stuck agian, but that's a huge pain.

Copy local on the reference to the dll is set to true, but I don't understand why it's copying the .xml file too.

I didn't add anything fancy like custom build events or anything like that... The problem started after I'd compiled the sln with the nuget package added a few times.

Anyone know why the xml file is beign copied? no other xml for a dll gets copied.. If I can stop that I think I'll be golden again.

Barring that, does anyone know why the IDE keeps locking it?

What is the purpose of the XML file that matches my DLL in the nuget package?

Eric Brown - Cal
  • 14,135
  • 12
  • 58
  • 97
  • Maybe this detail from [MSDN](https://msdn.microsoft.com/en-us/library/vstudio/x4sa0ak0%28v=vs.100%29.aspx) will help explain what the xml document is for and what causes it to get generated. – pnm Mar 25 '15 at 15:22
  • Have you tried running the IDE as Admin? – Hozikimaru Mar 25 '15 at 15:55
  • Yep, I've treid running it as admin... I did notice that when I close the IDE, the file ususally disappers on it's own, I don't ususally have to go physically delete it. – Eric Brown - Cal Mar 25 '15 at 17:35

2 Answers2

1

The solution was simple as I resolved in this way:

I cleaned solution and rebuild the project and it was resolved. If it does not go this way for you, Close Visual Studio and reopen and again clean the solution and rebuild the solution then it will be resolved.

Usman
  • 2,547
  • 31
  • 35
0

It's been longer than i should have waited, so I'm a little fuzzy on specifics, but I closed the .sln, stopped IIS, and then deleted the file.. then the error went away for a while... at which point I'd repeat. Sorry I'm not more precise.

Eric Brown - Cal
  • 14,135
  • 12
  • 58
  • 97
  • 1
    I tried doing the cleaning and rebuilding as usman posted, but it didn't work. However, after cleaning, closing VS, reopening, and rebuilding, it started working alright. I did not have to manually stop IIS or delete the file in my case. – Hagelt18 May 19 '16 at 18:40
  • Glad it helped you – Eric Brown - Cal May 23 '16 at 13:38