Let's say a Visual Studio Solution has 40 + projects within it; are you able to mix (for example) .NET 4.6.1 framework projects with 4.7.2 framework projects?
Will it cause problems?
Note: this question is specific to .NET Framework 4
Related
I am trying to start a new project using .NET 4.7. I have Creators Update installed as well as the latest version of Visual Studio 2017. When I start a project and device to choose a .NET version, the latest .NET framework version I have is 4.6.2. When I go to download a new .NET framework, it only lists 4.6.2 as the latest via MS that you can download. It says that .NET 4.7 is included in VS 2017. What am I missing?
You need to go to Visual Studio Installer and install an optional component ".NET Framework 4.7 Development Tools".
"A picture is worth a thousand bytes (with adequate compression)" and all that jazz...
The .NET Framework 4.7 was released as part of Windows 10 Creators. For other versions of Windows, you have to install the .NET Framework 4.7.
Offline Installer of .NET Framework 4.7 Developer pack
So I could not find the .Net Framework 4.7.2 Developer tool even in Visual Studio Installer. However you can download & run them from here:
https://www.microsoft.com/net/download/visual-studio-sdks
For anyone late to the party here; In Visual Studio 2019, I had this problem by using a .Net Core template to create my project.
https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-multi-targeting-overview?view=vs-2019
For non-.NET Framework project templates, for example .NET Core templates, the Framework drop-down list doesn't appear.
Make sure you pick a .Net Framework template when creating a project/solution :)
I have a C++ project that builds a .NET class library that targets the framework 3.5.
This project has been working seamlessly since ages and the classes can be used from, among others, C# applications. It was developed with Visual Studio 2008 Professional.
Now I need to migrate if to Visual Studio 2012 Professional. I have successfully converted the project.
I meet a first problem, which is that the target framework cannot be changed from the project Common Properties, the field is read-only.
I can work around this by editing the .vcxproj file to insert a TargetedFramework tag. The new version does appear in the Common Properties.
I am also able to add references to the .NET assemblies that the library needs (just System, System.Drawing and System.Windows.Forms). The class library compiles correctly to a Dll and I can see its content in the Object Browser.
Now if I try to use it in an application targeting a framework version below 4, I get the message
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(1605,5): warning MSB3258: The primary reference "MyClasses" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
I can't see where an indirect reference could come from (my explicit references are to v2.0.50727, which seem to be the file version for 2.0/3.0/3.5).
Do you have any explanation ?
(Expanding on Hans's correct comments)
Visual Studio supports .NET multi-targeting for the C++/CLI language by launching older versions of the C++ compiler.
As a result, the language features are inextricably linked to the .NET framework dependency -- with the newer compilers (Visual C++ 2010 and later), you get C++11 and C++14 features and .NET 4, with the older compilers (Visual C++ 2008 and before) you get .NET 2, but very little C++11 support.
To control this, there's a Platform Toolset selection in the Project Properties, but some manual project file editing is also required.
The Visual C++ Team wrote a blog post about C++ Managed Multi-Targeting in Visual Studio 2010... for later versions, read the documentation on MSDN.
I write the plugins for AutoCAD. If I write the managed (i.e. .net) plugins, then I can use any Visual Studio version which can work with .NET Framework version which are used by AutoCAD (it is very convenient):
AutoCAD 2009 can use .NET 3.0, 3.5
AutoCAD 2010 can use .NET 3.5.
...
AutoCAD 2016 can use .NET 4.5, 4.5.1
So, through Visual Studio 2013 I can write the .net plugins for AutoCAD 2009-2016.
But sometimes I need to write unmanaged plugins for AutoCAD, because its managed .net API covers unmanaged API (ObjectARX SDK) not complettely. ObjectARX is API for C++. At this case I can't use the same Visual Studio for each AutoCAD version. For example, I am to use VS 2005 for AutoCAD 2009 plugins writting. Therefore I have installed VS 2005-2013 on my virtual machine. It is very unconvenient in my opinion.
I know, this problem exists because the standard of C++ functions naming is not exist and each version of VS has own rules of the name generation for the functions which aren't marked by external "C".
But why this standard is not exist still? What the reason of it? I am sure this reason is exists. Such behaviour is unconvenient is not for me only (I asked other programmers about it). But they don't know why each new VS version has own rules of C++ function naming and why standard of nameing of C++ functions is not exist.
Thank you.
A standard does exist, see https://mentorembedded.github.io/cxx-abi/abi.html#mangling
But not all compilers use it, because they have their own mangling conventions that they have used for many years, and they don't want to change them for various reasons.
In your case the differences between different versions of Visual Studio are not just name mangling, there are changes in the C++ runtime library and the standard library.
The title said it all.
Unfortunately, this isn't possible, even with VS 2008 sp1. You set the target framework under the "Common Properties"->"Framework and References" in the project property pages. In 2008sp1, the only choices are:
.NET Framework 2.0
.NET Framework 3.0
.NET Framework 3.5
There's a bug/feature in Visual Studio 2010 where you can't create a unit test project with the 2.0 CLR.
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483891&wa=wsignin1.0
This causes all sorts of problems when the project being tested is targetting the 2.0 CLR (ASP.NET MVC 2 on top of .Net 3.5 SP1 in this case) - crashes on debug, tests failing unexpectedly, in one case the test project doesn't even build because of the dependency on System.Web 2.0.0.0 which isn't available in projects targetting 4.0.
It's not possible to change the test project to target the 3.5 framework.
Does anyone know of a workaround?
Workarounds I'm aware of, but want to avoid, include:-
1) Upgrading the whole solution to target .NET 4
I want to host on Azure and it isn't clear at this point if/when support for .NET 4.0 will be added. See .NET 4.0 on Windows Azure?
2) Rolling the whole project back to Visual Studio 2008
This is a last resort as there are a number of features in 2010 that I really want to use
3) Building the unit tests in 2008 and managing the references manually
This will work, but it'll be a tremendous pain.
Any ideas?
It looks like Visual Studio 2010 Service Pack 1 will resolve this once it is released (see the heading 'Better platform support | Unit Testing on .NET 3.5')
You can get the Beta version with a Go-Live licence now...
You haven't suggested changing to a different test framework. Personally, I use NUnit and have for years. It's far more sophisticated that the stuff in 2008. I haven't had time to see what's changed in 2010 but I can't see MS catching up that quickly.