.NET

Reply
Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 1 of 9 (853 Views)

VS 2010

853 Views, 8 Replies
10-05-2010 03:04 PM

Please don't tell me you can't run/use Visual Studio 2010 stuff inside AutoCAD 2011?.......

Jerry Bryant
"Swing hard and hope you hit it!"
*Expert Elite*
norman.yuan
Posts: 1,024
Registered: ‎04-27-2009
Message 2 of 9 (849 Views)

Re: VS 2010

10-05-2010 03:11 PM in reply to: jerry.bryant

I have done a couple of small AutoCAD 2011 (AcadMap, actually) projects with VS2010, trageting .NET4.0. No issue so far.

 

Of course I had to add this into acad.exe.config:

 

<configuration>
 
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>

 

  ...

 

</configuration>

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 3 of 9 (849 Views)

Re: VS 2010

10-05-2010 03:13 PM in reply to: jerry.bryant

You can't run Visual Studio 2010 stuff inside AutoCAD 2011, but you can use Visual Studio 2010 to develop apps for 2011, 2010,  2009,  and how ever far it goes back.

You can also find your answers @ TheSwamp
Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 4 of 9 (848 Views)

Re: VS 2010

10-05-2010 03:16 PM in reply to: Jeffrey_H

Really no issues with 4.0 you must not be using any new features in 4.0 that directly interact with AutoCAD. Then I would play it safe with 3.5

You can also find your answers @ TheSwamp
Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 5 of 9 (743 Views)

Re: VS 2010

10-12-2010 09:35 AM in reply to: norman.yuan

My acad.exe.config.....contains what you state below.

 

However, I tried running a sample .DLL (sample taken from AutoCAD (2010) .Net Developers Guide), and I get the following errors:

Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///D:\My Documents\Visual Studio
2010\Projects\MyFirstProject\MyFirstProject\obj\Debug\MyFirstProject.dll' or
one of its dependencies. This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded.
File name: 'file:///D:\My Documents\Visual Studio
2010\Projects\MyFirstProject\MyFirstProject\obj\Debug\MyFirstProject.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at loadmgd()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure
logging.
To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].

 

Any ideas?

 

attached is my acad.exe.config file (renamed so I could attach)

 

Jerry Bryant
"Swing hard and hope you hit it!"
*Expert Elite*
norman.yuan
Posts: 1,024
Registered: ‎04-27-2009
Message 6 of 9 (739 Views)

Re: VS 2010

10-12-2010 09:43 AM in reply to: jerry.bryant

1. Do you use Acad2011?

2. In your attached acad.exe.config, you have <!--....--> that comments out the needed setting. Are you sure you do not have <!--   ...  --> in your real acad.exe.config?

 

Distinguished Contributor
jerry.bryant
Posts: 174
Registered: ‎10-23-2003
Message 7 of 9 (737 Views)

Re: VS 2010

10-12-2010 09:55 AM in reply to: norman.yuan

Thx....that fixed the problem (I had the required line commented out...jeeez!)

Jerry Bryant
"Swing hard and hope you hit it!"
Mentor
mzakiralam
Posts: 231
Registered: ‎11-09-2012
Message 8 of 9 (254 Views)

Re: VS 2010

11-14-2012 06:27 AM in reply to: jerry.bryant

HI I have the same problem which is stated earlier. When I try to to load the .dll show following error:

Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file://\\home003.vih.infineon.com\alamzaki\My
Documents\Visual Studio
2010\Projects\MyFirstProject\MyFirstProject\bin\Debug\MyFirstProject.dll' or
one of its dependencies. This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded.
File name: 'file://\\home003.vih.infineon.com\alamzaki\My Documents\Visual
Studio 2010\Projects\MyFirstProject\MyFirstProject\bin\Debug\MyFirstProject.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at loadmgd()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure
logging.
To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].

 

MY acad.exe.config file is:

<configuration>
 <configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.9.9.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/></configSections><!--
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
  </startup>
-->
 <!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
 <runtime>
  <generatePublisherEvidence enabled="false"/>
 </runtime>
 <appSettings>
<add key="WebServiceTimeout" value="1000000"/></appSettings><microsoft.web.services3>
<messaging>
<maxMessageLength value="51200"/><mtom clientMode="On"/></messaging><security>
<timeToleranceInSeconds value="86400"/></security></microsoft.web.services3><loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="" logWarningsWhenNoCategoriesMatch="false"><listeners>
<add fileName="rolling.log" rollSizeKB="0" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text Formatter" header="" footer="----------------------------------------" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.9.9.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" traceOutputOptions="LogicalOperationStack" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.9.9.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat File Trace Listener"/></listeners><formatters>
<add template="{timestamp} ({win32ThreadId})  {message}
Category: {category}{dictionary(
{key}: {value})}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.9.9.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Text Formatter"/></formatters><categorySources>
<add switchValue="All" name="Information"><listeners>
<add name="Rolling Flat File Trace Listener"/></listeners></add><add switchValue="All" name="Error"><listeners>
<add name="Rolling Flat File Trace Listener"/></listeners></add><add switchValue="off" name="Trace"><listeners>
<add name="Rolling Flat File Trace Listener"/></listeners></add></categorySources><specialSources>
<allEvents name="All Events" switchValue="All"/><notProcessed name="Unprocessed Category" switchValue="All"/><errors name="Logging Errors &amp; Warnings" switchValue="All"/></specialSources></loggingConfiguration></configuration>

 

I can not recity the problem. I am using VB2010 (Premium), AutoCAD2011. Windows 7 32 bit machine. Can you help me to solve this problem?

 

Thanks in advance.

 

Zakir

ADN Support Specialist
Balaji_Ram
Posts: 723
Registered: ‎03-21-2011
Message 9 of 9 (187 Views)

Re: VS 2010

11-21-2012 09:32 AM in reply to: mzakiralam

Hello Zakir,

 

In what you have posted, I see those <!-- and -->

You too seem to have the lines that specify the supportedRuntime in acad.exe.config commented.

 

Can you try removing those comment markers ?

 

Hope this helps.



Balaji
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.