This project is read-only.
1
Vote

CS1566 error when trying to embed XML documentation files as resources

description

With the VS 2015 Preview I am getting the following error:

CSC : error CS1566: Error reading resource 'Assembly.XML' -- 'The process cannot access the file 'C:\Source\Assembly\Assembly.XML' because it is being used by another process.'

Our product has a handful of contract assemblies and a handful of ASP.NET Web API web sites which make use of the ASP.NET Web API Help Page. To allow the Web API Help Page generation to access the XML code documentation, I embedded the documentation file as a resource into each of the contract assemblies to allow it to be accessible through reflection without each web site having to know about each of the contract assemblies that get included through it's dependencies.

To do this with VS 2013 I enabled the XML documentation file in the project settings, included the output file in the project, changed it's type to an embedded resource and then added a prebuild step to clear any read only flags that source control would add to it.

From debugging through the Emit method in Src\Compilers\Core\Portable\Compilation\Compilation.cs, it looks like the XML documentation file is written out to in the call to Compile and is left open which causes the SerializeToPeStream afterwards call to fail.

It looks like the issue could be addressed by disposing the xmlDocumentationStream object right before calling SerializerToPeStream.

comments