Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rosyln files locked during deployment(msdeploy) and fails with ERROR_FILE_IN_USE #58

Closed
sabmah opened this issue Jul 31, 2018 · 5 comments

Comments

@sabmah
Copy link

sabmah commented Jul 31, 2018

Version Used:

  • MVC 5

  • .Net version 4.6.1

  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform 2.0.0

  • Microsoft.Net.Compilers 2.8.2

  • Windows Server 2016

  • IIS 10.0.14393.0

  • TeamCity 2018.1

Steps to Reproduce:
NOTE: I'm doing all this from TeamCity CI

  1. Build and Deploy MVC5 project with roslyn compiler to IIS
  2. Once step 1 is deployed, Deploy again (occasionally its successful and lot of times it errors )

Expected Behavior:
Successfully deployed the site to IIS

Actual Behavior:
Error Code: ERROR_FILE_IN_USE
[16:18:10]More Information: Web Deploy cannot modify the file 'csc.exe' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.

Also: Every file in bin\roslyn folder has same issue. It shows different files being locked on every deployment with that error. My razor views are also using c#6 features.

@sabmah
Copy link
Author

sabmah commented Jul 31, 2018

Posted here according to this thread: https://github.com/dotnet/roslyn/issues/28856#issuecomment-409295213

@DerDreschner
Copy link

Looks like we have the same problems with nearly the same configurations. Except that we don't use TeamCity when the problem occours and that we publish to our local IIS on the same machine.

#57

@Jinhuafei
Copy link
Contributor

Asp.net runtime compilation uses the Roslyn compiler under bin\roslyn folder to do the dynamic compilation. Based on the error, it looks like that asp.net was compiling the views when you were trying to deploy the app to the IIS.

One option is to fully pre-compile the views on the CI machine, so that you don't need to publish Roslyn compiler files.

@sabmah
Copy link
Author

sabmah commented Aug 14, 2018

Can Roslyn compiler be killed on deploy? Currently, there is no option to kill roslyn compiler from msdeploy or msbuild

@Jinhuafei
Copy link
Contributor

Jinhuafei commented Aug 15, 2018

msdeploy won't be able to stop Roslyn compiler on the web server. You can set environment variable VBCSCOMPILER_TTL to reduce TTL of Roslyn compiler process. Or you can precompile all the views on your build machine and then Roslyn compiler won't be used on the web server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants