Autocad 2010 and Framework 4.0 - .net-4.0

How can i assembly "NET Framework 4" with autocad 2010.
I have problems while using NETLOAD command.

You need to use .NET 3.5 with AutoCAD 2010. 4.0 is only supported by AutoCAD 2012.

AutoCAD 2010 can support non beta .Net 4.0 versions. If you edit the acad.exe.config file you may add this to get .Net 4.0 functionality:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
You can see for yourself in this AU material:
Using .NET 4.0 with AutoCAD

If you go into the AutoCAD install folder and edit the acad.exe.config file there you can add .NET 4.0 as a supported runtime:
<startup>
<!-- v Add this line v -->
<supportedRuntime version="v4.0"/>
</startup>
Note that advanced features of C# added in 4.0 wont work because they require all assemblies involved to be compiled for that version.

Go To Project>yourappname properties>Compile>Advanced Compile options. And choose target .NET Framework 3.5

Related

Visual Studio and msbuild produces .net 4 resources dlls instead of 3.5

If you follow the instructions on Access resx resource files from another project to create translations using resx files, when the project is .net 3.5 it is not working and it seems to ignore specified culture.
It seems that the problem is specific with my build chain.
I have installed
.net 4.8
Windows SDK 10 (I have this C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools)
Visual Studio 2019
When I inspect the output DLLs using jetbrain's dotPeek, I see that the satellite DLLs are .net 4.0
A colleague doesn't have .net 4.8 or Windows SDK 10 and he produces satellite DLLs .net 3.5
He has Windows SDK 7.
The problem AFAIK is with the al.exe that outputs these DLLs.
The problem was indeed with al.exe. The configuration in al.exe.config was specifying that it should support v4.0 of dotnet.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
And by changing it to:
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
solved it.

Configure Application to run on .NET 2.0 and 4.5

I am using Visual Basic Express 2010 and are trying to configure my application to run on a large variety of computers without the need of updating .NET Framework.
My current project has the following settings in app.config:
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
<supportedRuntime version="v4.0"/>
<supportedRuntime version="v2.0.50727"/>
The target framework is .NET 2.0. One may think that, with these settings, the program should run out of the box on machines with both .NET 2.0 and 4.X
However, when I attempt to run the software on a fresh Windows 8.1 virtual machine, I run into the following error:
I'd rather not have my users install .NET 3.5 if it's not necessary. Is there a way to get past this?
Thank you all in advanced.

Application built with .NET 3.5 running on machine with only .NET 4.0. How does supportedRuntime element work?

We have an application that was built using .NET 3.5. There is a situation where it will run on a machine which only has .NET 4.0 installed.
If in the application configuration file the <supportedRuntime> element is not defined, or is defined as follows
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
will the application crash on start up since .NET 3.5 and CLR v2.0.50727 are not present?
Note I understand that .NET 4.0 APIs are supposed to be compatible with .NET 3.5 ones and that a .NET 3.5 application should run in .NET 4.0. That is not the question. I am specifically asking about the <supportedRuntime> behavior.
Adding Hans Passant's comment as it seems a suitable answer.
The application will crash. To run on .NET 4.0 you need to add another supportedRuntime attribute with version="4.0".

Upgrading a .Net 2.0 project to .Net 4.0

I have a .Net 2.0 project that depends on many 3rd party .Net dlls (all of which obviously target .Net 2.0).
If I were to migrate my project to VS2010 and target the .Net 4.0 framework, will my app still build? Or will it complain about the .Net 2.0 dll references and I will have to find .Net 4.0 versions of these 3rd party dlls?
Yes it will work. Make sure that you have both the .NET 2 and 4 FW installed on the machines executing the application.
If you need to use older assemblies with 4.0 (Mixed-Mode) you may need to add the following to <yourappname>.config:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
I had to do this when I attempted to load some old 1.1 assemblies into my Ironpython program (.NET 4.0) and got the following error:
"Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."
Adding those three lines to my ipyw.exe.config file let me run those assemblies in mixed mode.

How can I target .Net 4.0 Beta using NAnt?

I want to start testing my project using the Microsoft .Net 4.0 Beta version that has already been released. I know that adding a "net-4.0" target framework to NAnt requires updating nant.exe.config file, does anyone know what are the necessary changes?
If you want to use nant to build projects targeting .NET 4.0 you'll have to modify NAnt.exe.config and add the net-4.0 target framework and add a <supportedRuntime ... /> line to the <startup> section.
http://paigecsharp.blogspot.com/2009/08/nant-net-framework-40-configuration.html is a full code for .config file for NAnt.