Support ProjectName = ExcelAddInFileName
govert opened this issue · 1 comments
Suppose our project is called NewComServer.
We only want to build a 64-bit add-in called NewComServer.xll.
We set these properties:
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ExcelDnaCreate32BitAddIn>false</ExcelDnaCreate32BitAddIn>
<ExcelDna64BitAddInSuffix>%none%</ExcelDna64BitAddInSuffix>
<ExcelAddInFileName>NewComServer</ExcelAddInFileName>
<ExcelAddInName>NewComServer</ExcelAddInName>
</PropertyGroup>
This is the error when building
1>MSBUILD : ExcelDnaBuild error DNA925543065: The process cannot access the file 'C:\Temp\NewComServer\bin\Debug\net6.0-windows\NewComServer.deps.json' because it is being used by another process.
1>MSBUILD : ExcelDnaBuild error DNA925543065: System.IO.IOException: The process cannot access the file 'C:\Temp\NewComServer\bin\Debug\net6.0-windows\NewComServer.deps.json' because it is being used by another process.
1>MSBUILD : ExcelDnaBuild error DNA925543065: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at ExcelDna.AddIn.Tasks.Utils.ExcelDnaPhysicalFileSystem.CopyFile(String sourceFileName, String destFileName, Boolean overwrite)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at ExcelDna.AddIn.Tasks.CreateExcelAddIn.TryCopyDepsJsonToBuildOutput(String outputDnaPath)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at ExcelDna.AddIn.Tasks.CreateExcelAddIn.TryBuildAddInFor64Bit(BuildItemSpec[] buildItemsForDnaFiles)
1>MSBUILD : ExcelDnaBuild error DNA925543065: at ExcelDna.AddIn.Tasks.CreateExcelAddIn.Execute()
I think it should work fine if we don't copy the deps file in the case where the course and destination would be the same. But we should check whether there would be other errors.
I've fixed the same file copy problem and packed add-in now builds and runs.
But unpacked add-in fails in AssemblyDependencyResolver constructor with:
Dependency resolution failed for component ExcelDna\Source\Tests\ExcelDna.AddIn.Tasks.IntegrationTests.TestTarget\NET6SameAddInFileName\bin\Debug\net6.0-windows\NET6SameAddInFileName.xll with error code -2147450740. Detailed error: Error:
An assembly specified in the application dependencies manifest (NET6SameAddInFileName.deps.json) has already been found but with a different file extension:
package: 'NET6SameAddInFileName', version: '1.1.0.0'
path: 'NET6SameAddInFileName.dll'
previously found assembly: 'ExcelDna\Source\Tests\ExcelDna.AddIn.Tasks.IntegrationTests.TestTarget\NET6SameAddInFileName\bin\Debug\net6.0-windows\NET6SameAddInFileName.xll'
Manually removing "libraries" - "NET6SameAddInFileName/1.1.0.0" entry from .deps.json resolves this problem. We may use it as a workaround.