2

I have a valid web.config with Web.Debug.config and Web.Release.Config. (I know it's not a problem with the web.config itself because I get the same behavior with a fresh 'new project' in Visual Studio)

When I publish the web.config to my server, 'Web Publish Activity' always says: "Processing web.config... Applying transformations to web.config failed."

If I use a publish profile that just publishes to my C: then the web.config successfully transforms.

The server publish profile successfully validates connection. I can publish file fine and they appear on the server. Everything works fine apart from the web.config doesn't transform

I've never encountered this before 1 week ago and I can't fix it.

Does anyone know how I can get web.config transform working again when publishing to my server?

mejobloggs
  • 7,937
  • 6
  • 32
  • 39
  • When you publish to your c: drive do both debug and release transforms work? – Joshua Morgan Sep 20 '17 at 16:55
  • Is it only one remote server having the issue, or any? – Joshua Morgan Sep 22 '17 at 01:26
  • I've got two server, same issue happens with both. Furthermore, I can right click the web.config and choose "Preview changes to web.config" and the same issue happens. I've tried using a different 'publish' user such as machine administrator but no change. – mejobloggs Sep 22 '17 at 02:05
  • 1
    I honestly don't know the answer to this, but I'll see if I can still help. Does this help? http://www.blakepell.com/visual-studio-error-publishing-applying-transformations-to-web-config-failed – Joshua Morgan Sep 22 '17 at 02:13
  • Very interesting, I just did a "preview publish" and it failed... Yet I can do a real publish just fine. Maybe that's what's stopping it. I'll have some time to look into it further soon – mejobloggs Sep 22 '17 at 02:26
  • Preview fails because can't find '\obj\Debug\AspnetCompileMerge\Source\bin\roslyn\csc.exe' that's bizzare. Why does preview give that error when building/running/publishing are fine. – mejobloggs Sep 22 '17 at 02:32
  • @Locke125 I fixed my "preview publish" and the web transform works now. If you make an answer I'll mark it as correct, since your link to blakepell.com pinpointed the issue for me. My preview was failing due to rosyln\csc.exe which I resolved by this stackoverflow solution: https://stackoverflow.com/a/38668274/290328. – mejobloggs Sep 22 '17 at 02:40
  • Glad you got it working. – Joshua Morgan Sep 22 '17 at 03:27

1 Answers1

3

According to this link unrelated errors can cause this to fail. Going through the publish wizard and selecting preview changes may show the actual error causing your build to fail.

http://www.blakepell.com/visual-studio-error-publishing-applying-transformations-to-web-config-failed

Joshua Morgan
  • 678
  • 6
  • 18
  • 2
    Thanks! Just to be clear to anyone else that might be reading, my website would build fine and publish fine (so it wasn't a normal build error), but after the publish the web.config wasn't transformed. However, if I previewed changes that would fail, and fixing the preview failure fixed the web.config transform – mejobloggs Sep 22 '17 at 03:39
  • That link was a big help, I wouldn't have thought to check the full-Publish preview. My case was a totally different underlying error (Azure app service, build fails to create the rosyln folder for some reason) and unfortunately, at the moment the project is totally dead. I opened an issue with MS about this. – McGuireV10 Dec 15 '17 at 15:24