Vous êtes sur la page 1sur 3

Visual Studio 2010 - Not a valid assembly

Pgina 1 de 3

Search Visual Studio with Bing

Enviar Consulta

SIGN IN

HOME

SAMPLES

LANGUAGES

EXTENSIONS

DOCUMENTATION

COMMUNITY

forums

codeplex

user voice

file a bug

get started for free

Visual Studio Developer Center >Visual Studio Development Forums>Visual Studio Diagnostics (Debugger, Profiler, IntelliTrace)> Visual Studio 2010 - Not a valid assembly

Visual Studio 2010 - Not a valid assembly


Search Visual Studio Diagnostics (Debugger, Profiler, IntelliTrace) Forum

My Forum Links
Sign In To Forums

Ask a question

Forums Home Browse Forums Users

kkhan7

0 Points
Wednesday, April 18, 2012 2:35 PM

I would like to ask for any suggestions on fixing an issue with Visual Studio 2010. In VisualStudio 2010 there is a known bug and the fix that Microsoft proposes hasn't worked. This issue is well documented on the web. See more info: http://support.microsoft.com/kb/956933

Frequently asked questions Forums help

Scenario: When using VisualStudio 2010 to create a public class that will be exposed as a com object the Build function gives the following error "not a valid assembly". This err occurs when trying to build a 64-bit com object, "Register for Com interop" is unchecked. Proposed Solution: Microsoft's solution is to use a command line in post build event that will specify which version of RegAsm to use to register the file. I have tried the following with no success: "%Windir%\Microsoft.NET\Framework64\v2.0.50727\regasm""$(TargetPath)" Or "%Windir%\Microsoft.NET\Framework64\v4.0.30319\regasm""$(TargetPath)" Or "%Windir%\Microsoft.NET\Framework\v4.0.30319\regasm"/codebase /tlb "$(TargetPath)"

....and more.

Thanks in advance for any suggestions.

Reply Quote

All Replies
Jack Zhai - MSFT CS&S (MSFT CSG) 19,165 Points
Friday, April 20, 2012 6:27 AM

Hi kkhan7,

Thank you for posting in the MSDN forum. This err occurs when trying to build a 64-bit com object, "Register for Com interop" is unchecked. Do you mean that it could work if you check Register for COM Interop? Whether all project has this issue? This is a blog about How to register .NET Assembly for COM Interop?, it provided some useful information about registering the assembly for COM Interop. If possible, you could check it. In addition, we would check the steps and settings as the link provided by you.

http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/9d9563f1-a1e0-4aed-... 14/04/2013

Visual Studio 2010 - Not a valid assembly

Pgina 2 de 3

If still no help, you can submit this feedback to Microsoft Connect feedback portal:http://connect.microsoft.com, Microsoft engineers will evaluate them seriously. Thanks for your understanding.
Best Regards,

Jack Zhai [MSFT] MSDN Community Support | Feedback to us

Reply Quote

kkhan7

0 Points
Friday, April 20, 2012 5:54 PM

Hello Jack, The following steps worked for me. Specifically, the command line in Step 4 fixed the

"not valid assembly" err. For more info: http://stackoverflow.com/questions/2724387/excel-2010-64-bit-cant-create-net-object http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/253110bc-5fee-478f-a2ebe1d5ec6039af Open VS 2010 as run as Admin In the Build menu
1. 2. 3. 4. Configure manager : Changed configuration to platform to x64 Compile, Register for COM interop = uncheck Application, Assembly information, make assembly com visible = check Build Events, Post. Paste:

"%Windir%\Microsoft.NET\Framework64\v4.0.30319\regasm" "$(TargetPath)" /tlb "$(TargetDir) $(TargetName).tlb" /codebase 5. Build CLASS Thanks for your response.

Kim Khan

Marked As Answer by Jack Zhai - MSFT Microsoft Contingent Staff, Moderator Monday, April 23, 2012 2:13 AM

Reply Quote

Jack Zhai - MSFT CS&S (MSFT CSG)

19,165 Points
Monday, April 23, 2012 2:13 AM

Hi kkhan7,

Glad to see this issue has been resolved and thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions. Have a nice day,

Jack Zhai [MSFT] MSDN Community Support | Feedback to us

Reply Quote

http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/9d9563f1-a1e0-4aed-... 14/04/2013

Visual Studio 2010 - Not a valid assembly

Pgina 3 de 3

Currie Dail (Partner)

0 Points
Monday, October 15, 2012 3:16 PM

Has anything been done to fix this in Visual Studio? The proposed solution is a workaround, not a fix. When running a setup project to install a 64 bit Com assembly, the registration of the type library is not done when you uncheck the Registration for Com Interop. I can manually run the registration, but would prefer not to do that so that the type library gets cleaned up properly on uninstall. Does anyone have any suggestions? Currie Dail

Reply Quote

HOME Welcome Visual Studio Team Foundation Server .NET Framework

SAMPLES

LANGUAGES Overview Visual C++ Visual C# Visual Basic JavaScript Visual F#

EXTENSIONS

DOCUMENTATION COMMUNITY Visual Studio Team Foundation Server/ALM .NET Framework Forums CodePlex User Voice File a Bug

United States (English)

2013 Microsoft

Terms of Use

Trademarks

Privacy Statement

Site Feedback

http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/9d9563f1-a1e0-4aed-... 14/04/2013

Vous aimerez peut-être aussi