Why can't I target for .net 4.8 in my new project and why can't I choose folders where .exe file will be? - visual-studio-2022

I created a new project. I have 2 problems already.
The newest .net framework available is .net framework 4.8 right?
I cannot select that
I want my .exe file to show up on this folder
Instead, the .exe file show up in this
Note: I censored the username actually, but you got the point. It shows up at \net5.0-windows instead
I want that to show up on arbitrage2 folder straight. Not on arbitrange2\net5.0-windows
My other projects do not have this problem.
Where should I change this?
Also I suspect the problems are related. That's because my other project can have target framework 4.8. In fact, in other projects, .net 5.0 and .net 6.0 is not available

Related

VB 2019 project settings empty

I want to store startup settings for my project. When I go to the project Properties/Settings, it's empty except for a link that says, "This project does not have a default settings file. Click here to create one." When I click the link to add one, it says "The system cannot find the file specified. (Exception from HRESULT: 0x80070002." So, how do I add a default settings file?
As mentioned in my comments, this seems to be a bug in VS and ought to be reported to Microsoft. As a temporary workaround, you can actually copy the settings files from a .NET Framework project into a .NET Core project. As far as I can tell from examining various VB and C# projects targeting .NET Framework and .NET Core, the settings files are the same in each case, so there's no issue copying between them. Here's what I did:
Added a VB WinForms app project targeting .NET Framework to the same solution.
Clicked the Show All Files button in the Solution Explorer for both projects.
Expanded the My Project node for both projects.
Dragged the Settings.settings item from the .NET Framework project to the .NET Core project.
It seemed to work as expected after that.

How To Compile with Framework 3.5 instead of 4.5 (VS2012)

I have recently written two small apps in Visual Studio 2012 (VB). I compiled them using Framework 4.5. These have been tested on the end user's PC's and the feedback was to try and get the Apps Compiled using Framework 3.5 as this is already installed on the computers.The computers are using Windows 7.
My questions are these:
Is it possible to force a compile to use 3.5 instead of 4.5?
How would I go about doing this?
Yes, it is possible to target the 3.5 framework when you compile.
Go to PROJECT-> Properties (You can also right-click on the project in the solution viewer and select Properties).
Select .NET Framework 35. in the Target Framework dropdown.
The project will be closed and reopened automatically by Visual Studio (you will be asked to confirm this change).
Note that if you have anything specific to .NET 4.0/4.5 that is NOT present in the 3.5 framework you will have to make the necessary changes.
EDIT
A picture is worth a thousand words:

Missing GAC with .NET Framework 4 Installation

I've installed the full version of .NET Framework 4 (Client Profile + Extended) on a customer machine which is running Windows Small Business Server 2003 Standard Edition. The installation was successful without any errors. There were no errors mentioned in the log files either...
BUT the .NET Framework 4 GAC (Global Assembly Cache) is completely missing! In other words, the following folder is missing:-
C:\Windows\Microsoft.NET\assembly
If I look into the C:\Windows\Microsoft.NET folder, I can only see 2 subfolders (as shown below) and nothing else.
authman
Framework
The server still has .NET Framework 3.5 installed and is running properly. This means that the GAC folder below exists and has all .NET library DLLs in it. But of course, there are no .NET 4 DLLs in there.
C:\Windows\assembly
Because of the missing .NET Framework 4 GAC, none of my applications run. They all complain about missing System or System.Xml references. If I copy the missing files from the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder to my application directory, they will stop complaining about these files and start complaining about other missing .NET files. Obviously I use a lot of .NET Library references, and I don't want to copy the whole .NET Framework folder into each of my applications.
Does anyone know how to create the missing GAC? Or at least find out what causes the GAC to disappear? I tried multiple times to re-install the .NET Framework 4, but the GAC is always missing...
Edit: I've also tried running gacutil.exe -l to see what is in the GAC, it only list out .NET assemblies of version 1.0 to 3.5. All .NET 4 assemblies are missing.
Note: .NET 4 version of gacutil.exe only comes with Visual Studio (or Windows SDK), so I have to copy the file to the customer site.

Building C++ projects that targets framework 3.5 but produces assemblies targeting framework 4.0

Background
We have a C++ solution that has been moved from VS2005 to VS2010 where the project files were targeting the .net framework 3.5 but since moving over to VS2010, all of the project files were showing that they were targeting the.net framework 4.0. I have since changed the .vcxproj files manually so that they are targeting the .net framework 3.5, using the method described in the Community Content on this link
The Problem
When I build these project files, manually or via an automated build, the output assemblies are still targeting the .net framework 4.0. I can tell this by using various methods described here. I also know that this is the case as I build and run the installer for this application. Once the application has been installed (which then shows as a service), I try to start the service on the target machine. This service will not start on a machine without the .net framework 4.0 installed. If 4.0 is then installed, the service will start, so this is another test that I can run that shows me that the application has a dependency on .net framework 4.0 which it should not.
The Aim
Ideally, I need to build this application so that the outputs are targeting the .net framework 3.5 instead of 4.0 so that it will actually run as it is supposed to! I have tried to use the 3.5 version of MSBuild as described in one of the answers given for this question here but got the same error that is described underneath that post.
Can anyone help with this? It's proving to be a right pain and I've been banging my head against the wall for over a week trying to get this sorted!
Thanks again in advance
Make sure you follow all the instructions as provided in the first link you posted.
For example,
Make sure you have Visual Studio 2008 installed on the build server.
Make sure you also change each project's "Platform Toolset" to v90.
Verify the project's framework version: "In Solution Explorer, right-click your project and then click Properties. In the Property Pages window, in the left pane, expand Common Properties and then select Framework and References. Verify that the new Framework version appears at the top of the right pane."

Why can't MSBuild ToolsVersion 4.0 build older projects?

We're using Cruse Control to manage our build process.
AS we convert vs2008 projects to vs2010, we're leaving the target framework set at 3.5 for web and class library projects.
At this point we're not going through and converting all our solutions to vs2010; not if we don't have to.
I recently updated the MSbuild project files that cruise control uses to point at MSBuild 4.0 so our build process would be able to build vs2010 projects.
C:\windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
All was well until a web project that was targeting the 4.0 framework was committed.
At which point this error popped up:
CS0433: The type 'System.Web.Routing.RouteCollection' exists in both c:\Windows\Microsoft.NET\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll and c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Routing.dll in Global.asax.cs(15, 43)
At which point I became aware of the Windows/Microsoft.NET/Assembly folders.
Now... All the MSBuild projects, even though they were using MSBuild 4.0, still had the tools version set at 3.5.
So why was a 3.5 targeted build looking at the new 4.0 assembly folders and finding this conflict? Probably because I was using MSBuild 4.0. But if I can change the toolVersion that MSBuild uses, you'd think I can tell it to target 3.5 without worrying about these potential conflicts.
To resolve this issue, I went to the relevant MSBuild project files that cruise control uses and changed their toolsVersion to 4.0. This got passed that conflict error. But now everytime it tries to build a project that's in a solution that we haven't yet converted to a vs2010 project, it breaks with an error like this:
MyProject.csproj in SomeFilePath:
LC0000: 'Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.' in LC(0, 0)
If I open the solution that contains that project in Visual Studio 2010 and do the conversion, build it and commit that and force another build, I get passed that error only to find that another not yet converted project is tossing that same error.
So now I am for sure using MSBuild 4.0 and for real targeting the 4.0 framework. Why can't 4.0 build 3.5 projects or vs2008 solution projects?
The issue is that you have migrated part of your projects to to visual studio 2010. Any 2008 project that references a 2010 project (by project reference) will give you this compile time error. Try updating all .csproj files to 2010 and try rebuilding again.