Visual studio 2017 Visual studio 2017将web项目发布到文件夹失败

Visual studio 2017 Visual studio 2017将web项目发布到文件夹失败,visual-studio-2017,roslyn,Visual Studio 2017,Roslyn,将web项目发布到文件夹时,日志中将弹出以下错误 .... Publishing folder /... Publishing folder bin... Publishing folder bin/es... Publishing folder bin/roslyn... Unable to add 'bin/roslyn/System.IO.FileSystem.dll' to the Web site. Unable to add file 'bin\roslyn\System.IO.F

将web项目发布到文件夹时,日志中将弹出以下错误

....
Publishing folder /...
Publishing folder bin...
Publishing folder bin/es...
Publishing folder bin/roslyn...
Unable to add 'bin/roslyn/System.IO.FileSystem.dll' to the Web site.  Unable to add file 'bin\roslyn\System.IO.FileSystem.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/System.IO.FileSystem.Primitives.dll' to the Web site.  Unable to add file 'bin\roslyn\System.IO.FileSystem.Primitives.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/System.Reflection.Metadata.dll' to the Web site.  Unable to add file 'bin\roslyn\System.Reflection.Metadata.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/System.Security.Cryptography.Algorithms.dll' to the Web site.  Unable to add file 'bin\roslyn\System.Security.Cryptography.Algorithms.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/System.Security.Cryptography.Primitives.dll' to the Web site.  Unable to add file 'bin\roslyn\System.Security.Cryptography.Primitives.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/System.ValueTuple.dll' to the Web site.  Unable to add file 'bin\roslyn\System.ValueTuple.dll'.  The process cannot access the file because it is being used by another process.
Unable to add 'bin/roslyn/VBCSCompiler.exe' to the Web site.  Unable to add file 'bin\roslyn\VBCSCompiler.exe'.  The process cannot access the file because it is being used by another process.
Publishing folder bin/zh...
...
Publishing folder Views/WFDefs...
Publish failed. Target file://machine/d$/PATH.
如果我使用web publish发布,它可以工作,但真正的目标不支持web发布


注意:VBCSCompiler未运行。

在Visual Studio 2017社区版中也有同样的问题。当你的问题出现在谷歌上但没有答案时,我想我应该补充一下

我发现他帮了我很多

打开sysinternals并转到查找->查找句柄或DLL。。。或(Ctrl+F)并搜索保持打开状态的文件。在我的例子中是“System.IO.FileSystem.dll”

搜索结果显示,两个MSBuild实例和一个VBCSCompiler挂在文件上。最糟糕的情况是,我刚刚杀死了流程树,构建了项目,一切又恢复了正常


相关回答:

我在Visual Studio community 2017的应用程序中遇到了同样的问题。在我的例子中,解决方案很简单,我只删除了目录bin(C:\Projects\DotNet\ApplicationName\bin)中的所有文件,然后重新编译应用程序


我希望它能对您有所帮助。

如果您试图在Azure中发布asp.net web应用程序并出现上述错误,请尝试将Microsoft.CodeDom.Providers.DotNetCompilerPlatform包更新到V1.0.7或更高版本。最初,在您的应用程序中,将有Microsoft.CodeDom.Providers.DotNetCompilerPlatform版本1.0.5,然后卸载并安装最新版本1.0.7或更高版本。清理您的解决方案并构建。现在,您将能够使用Visual Studio 2017在Azure中发布您的web应用。