View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default Visual Studio 2010 (Creating Excel DLL) "warning" no build

Visual Studio 2010 Beta

Attempting to build an Excel DLL with Visual Studio.

Did use Chip Pearson template but apparently 2010 may have changed the process.

Example of Division.vb

Option Explicit On
Option Compare Text
Option Strict Off
Imports XL = Microsoft.Office.Interop.Excel
Imports OFC = Microsoft.Office.Interop
Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.Win32


<ClassInterface(ClassInterfaceType.AutoDual), ComVisible(True) Public _
Class Division

Public Function DivideBy2(ByVal D As Double) As Double
Return D / 2
End Function

Public Function DivideBy4(ByVal D As Double) As Double
Return D / 4
End Function

<ComRegisterFunctionAttribute() Public Shared Sub RegisterFunction(ByVal type As Type)
Registry.ClassesRoot.CreateSubKey(GetSubkeyName(ty pe))
End Sub

<ComUnregisterFunctionAttribute() Public Shared Sub UnregisterFunction(ByVal type As Type)
Registry.ClassesRoot.DeleteSubKey(GetSubkeyName(ty pe), False)
End Sub

Private Shared Function GetSubkeyName(ByVal type As Type) As String
Dim S As New System.Text.StringBuilder()
S.Append("CLSID\{")
S.Append(type.GUID.ToString().ToUpper())
S.Append("}\Programmable")
Return S.ToString()
End Function

End Class


------ Build started: Project: MathNET, Configuration: Debug x86 ------
vbc : warning BC40059: A reference was created to interop assembly
'Microsoft.Office.Interop.Excel' because of an indirect reference created
by assembly 'Microsoft.Office.Tools.Excel.v9.0'. Consider linking assembly
'Microsoft.Office.Tools.Excel.v9.0'.
vbc : warning BC40059: A reference was created to interop assembly
'Microsoft.Vbe.Interop' because of an indirect reference created by
assembly 'Microsoft.Office.Tools.Excel.v9.0'. Consider linking assembly
'Microsoft.Office.Tools.Excel.v9.0'.
vbc : warning BC40059: A reference was created to interop assembly 'office'
because of an indirect reference created by assembly
'Microsoft.Office.Tools.Common.v9.0'. Consider linking assembly
'Microsoft.Office.Tools.Common.v9.0'.
vbc : warning BC40059: A reference was created to interop assembly 'office'
because of an indirect reference created by assembly 'Microsoft.Office.Tools.Excel.v9.0'.
Consider linking assembly 'Microsoft.Office.Tools.Excel.v9.0'.

Build started 5/27/2009 1:06:15 PM.

CoreResGen:
Processing resource file "My Project\Resources.resx" into
"obj\x86\Debug\MathNET.Resources.resources".
CopyFilesToOutputDirectory:
Copying file from "obj\x86\Debug\MathNET.dll" to "bin\Debug\MathNET.dll".
MathNET - C:\MathNETFunctionLibrary\MathNET\bin\Debug\MathNE T.dll
Copying file from "obj\x86\Debug\MathNET.pdb" to "bin\Debug\MathNET.pdb".
c:\Windows\Microsoft.NET\Framework\v4.0.20506\Micr osoft.Common.targets(3171,9): error MSB3216:

Cannot register assembly "C:\MathNETFunctionLibrary\MathNET\bin\Debug\MathN ET.dll" - access denied.
Please make sure you're running the application as administrator. Access to the registry key
'HKEY_CLASSES_ROOT\MathNET.Division' is denied.

Build FAILED.

Time Elapsed 00:00:01.20
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I have no experience in "linking 'Microsoft.Office.Tools.Excel.v9.0' -or-
'Microsoft.Office.Tools.Common.v9.0'.

MY best guess is that the Declarations in the Visual Basic need to change from:

Imports XL = Microsoft.Office.Interop.Excel
Imports OFC = Microsoft.Office.Interop
Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.Win32

To: Pure guess which does Not work

Imports XL = Microsoft.Office.Interop.Excel.VB.9.0
Imports OFC = Microsoft.Office.Interop VB.9.0
Imports System
Imports System.Runtime.InteropServices
Imports Microsoft.Win32

Bottom line:

The error message states: Consider linking assembly 'Microsoft.Office.Tools.Excel.v9.0'
If I wanted to attempt the linking, here and how do I do it?

Thanks in advance, EagleOne