View Single Post
  #5   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

As stated, I was able to get VS 2010 to compile, build, .msi and Setup.

Also, I was able to install into 2007 via Automation Addin. Both are listed in the Addins window

That said, entering =DivideBy2(1234) fails #Name?

Obviously, I have been through the loop so often that I fail to see my mistake. Thoughts?

Thanks EagleOne



Chip Pearson wrote:

I can't reproduce the problem you report. I'm using VS2010. When you
installed Office 2003 and/or 2007, did you include the "NET
programmability" option? Beyond that, I'm not sure why you would get
the errors you describe. Keep in mind, of course, the VS2010 is still
in the test phase, so who knows what could be happening.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 28 May 2009 07:23:12 -0400,
wrote:

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\Mi crosoft.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