Missing namespaces when downgrading to asp.net 4.0 - c#

I just had to downgrade my ASP.Net 4.5 application to an ASP.Net 4.0 application, because our servers don't support 4.5. The way I downgraded it was pretty simple:
Project -> Properties -> Application -> Target Framework
When it finished doing stuff, I restarted the solution, tried to start debugging, but it stopped right after I started debugging, giving me first some errors (which say they can't find some namespaces) for a fraction of a second and after the errors disappeared it gives me 127 warnings that all look like this:
Now I know what the problem is here, but I don't know how to solve this issue.. Does anyone know how to fix these warnings?
Thanks in advance
INFO
I'm using Visual Studio 2015 Community

Remove your current references to the Dlls in question and them add them again, it should load the correct versions of the Dlls. Because you had references to the 4.5 versions and then changed the project target the references are invalid now because they are build against a higher version framework. Changing the projects framework version target does NOT update the references in most cases

It is actually not that easy when it comes with ASP.NET. You have to go through all web.config(s) and downgrade referenced libraries. If its new project, just create new ASP.NET on .NET 4 and compare its web.config(s) with yours.

Related

Teamcity nugets with .net 5.0 not showing up in Visual Studio

I am building an assembly based on .NET 5.0, and I am publishing it as a nuget package, to be used in other projects.
It is built with Teamcity on premises, and published here, too:
When I try to use it in another solution in Visual Studio, it doesn't show up in the list of nuget packagess. Yes, the assembly/nuget is there, but not in the correct version:
I just upgraded the target framework in the devexpress build jobs to be net5.0windows7.0
I am wondering if that has caused my trouble or it may basically be that .net5.0 is no longer supported...
(I intended to do that upgrade as next step, but I don't want to leaves something broken).
Has anyone had the same experience of nuget packages not being shown?
Ahh, found it ;-)
just had to look in the right place...
It is simply the sort order, and the change from 2 digits to 3 that fooled me.
Everything works nicely ;-)
i.e. 95 was the old no. 104 was the new..(and yes I had deleted the builds in between)

New to Visual Studio, program won't build

I am relatively new to Visual Studio, C#, and using Github. I am trying to get the example for AncestralTrees working (Found here: https://github.com/fire-eggs/Ancestral-Tree). I cloned the repo and try to build, but I get a set of errors that do not make sense.
First is that AppSettings.cs and MruStripMenu.cs could not be found. Are these default config files I have to provide, or am I missing something?
And second is that .NET framework v4.5 wasn't found. For this I am a bit confused, because I thought it was backwards compatible, and I have v6.0.301 installed. To try and fix this error, I went to the website provided and downloaded it, but it wouldn't install as I already have a newer version. Again, am I missing something?
Any help would be greatly appreciated!
For the compatibility issue, .Net Core (6.0) and .Net Framework (4.5) are different animals, with .Net Core as more of a successor to Framework. They are very similar, but there are some breaking changes between Framework and Core, and if a project was intended for .Net Framework 4.5 you will want to have it installed on your system and set as the build target for the project in Visual Studio. You could probably also build for 4.7 or 4.8.
For the files, if they are part of the repo I would expect them to be there. I'd check your file system and see if the files are there, and then check the repo on github and see if they are included in the repo. If not, you may need an additional repo or you may need to manually add a NuGet package.
I did notice this at the bottom of the github page:
This program is both a demo of my GEDCOM library: YAGP, and a hopefully useful program in itself.
Where the "YAGP" text is a dead link. So I would expect to also need this project, which either no longer exists or is not public. This is probably the correct address:
https://github.com/fire-eggs/YAGP
(I submitted a change with the fixed link.)

The target process exited without raising CoreCLR started event error with .NET Core 2.2

I want to debug an empty WebApi Project based on .NET Core 2.2.
I installed the "Core 2.2 SDK x86" and changed the target framework to 2.2:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
When I started to debug this project, IIS starts, but in the route api/values I see nothing (it loads forever) and I get this error:
The target process exited without raising a CoreCLR started event.Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core
In my solution WPF and Class Library projects exist. I wanted to make a WebApi for it. Like I said, it's an empty base project generated by Visual Studio 2019. I just installed Core 2.2. Why do I get that error and what am I doing wrong?
I had the same issue.
I ran Program.cs file from the command line and the error message was different.
So, apparently, I didn't have the appropriate .NET Core runtime installed.
You can download it by the following link - https://dotnet.microsoft.com/download
I was facing the same issue!
I updated my Visual Studios to the most recent via the VS Installer.
While updating, I also added the following VS Workloads:
ASP.NET and web development
.NET desktop development
See about workloads here:
https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/install/modify-visual-studio.md
This worked for me! 😊
I did not have to downgrade or remove anything
I had to do a "clean" and "rebuild" of the project and after that it worked again.
I ran with the same problem. But for me it was that my project was running in .NET Core 2.2, which I didn't have installed. I'm using VS 2019.
So for the solution, just go to Visual Studio Installer and for your VS 2019 hit "Modify" like in the following image (it's in spanish though):
Then, click "Individual Components", like
And then, make sure you checked in ".NET Core 2.2 Runtime (EOL)" (and above like .NET Core 3.0, if you want) and click "Modify", as shown
Hope this works for you.
In my case, switching to x64 save the day.
It seems like there are lots of different causes for this. For me, it was because I had upgraded a .csproj file but I hadn't updated the image used in my docker file.
I had same issue after package upgrading. You don't need any vs update.
Just go to
dotnet.microsoft.com/download/dotnet-core/2.2
and get runtime
dotnet-hosting-2.2.7-win.
I had the same error. Remove "Microsoft.AspNetCore.All" from dependencies.
I have downgraded "Microsoft.AspNetCore.App" version and error gone .
Deleting all bin folders of my solution
building everything again did the trick for me
(.NET Core 3.1 VS 2019)
I see many answers like try and error
after searching about the issue, I got the following :
it simply depends on three parameters and they have to be compatible
Windows platform "x86,x64" you can change it from the CPU option of the visual studio
or choose any CPU hence the install .net x framework should be compatible with the windows
The target framework for the project
(check the project target framework "right-click on the project and check target framework") if it is 5 so the enabled in the third parameter should be 5 or change this one but take care you should tell the other team members if you change it
The Enabled framework go for tools and get tools and go for individuals component and chose the target framework the same as found in step 2 and press modify
Faced this issue during xUnit testing. Downgrading nuget package "Microsoft.NET.Test.Sdk" to 15.9.0 worked for me
I got this error because of a Project reference pointing to a project, that did not exist anymore (was removed in merged git-commit). Solved it by right-clicking the project, then Edit Project File, delete the reference and save.
I was trying to run a project that used net core 2.2 but I didn't have it, and there was no error(I had 1.1), so after installing the 2.2 using the "Visual Studio Installer" it worked like a charm. =)
I restarted my Visual Studio instance in Admin mode and I was able to debug.
After closing Visual Studio I can now start in normal mode and debug as expected. I'm not sure what changed though.
I was missing a reference to AWSSDK.Core. After installing the specific version and re-starting VS2019 and rebuilding, the project ran fine.
All of a sudden it stopped working. For me clean solution and re-build solution worked.
I was getting a similar error with my project: The target process exited without raising a CoreCLR started event.
My startup project was targeting multiple frameworks: netstandard2.0;netcoreapp2.2
I fixed this issue by changing my target framework from netstandard2.0 to netcoreapp2.2 using the following stackoverflow directions: How to switch between target frameworks for .NET Core projects in Visual Studio
Be sure to install the exact version of .net core that you want your project to run on
I had this issue and finally tracked it down to doing a "publish" operation with a deployment mode of: "Self contained" That resulted in dropping all .NET runtime binaries in my bin directory. Where I think things got totally messed up is I have several solutions all using that same common bin directory, each build different exe's and dll's.
Only one was for a self contained deployment as a test. I think that started mixing up some of the minor dlls for the .NET core and causing this issue. Once I purged all the dll's that were "not mine" and rebuilt things started working again. I'm using Visual Studio 2019 16.8.2 / .NET Core 3.1
I realize the original question is regarding .NET Core 2.2 but this question comes up first when searching for the main issue.
.Net Core 2.2 is required to be installed. I fixed when I added this in Visual Studio Installer.
VS2019 16.7.1 ASP.Net Core 3.1
Our Nunit test projects that issued this error, only worked with a very select set of Nunit and Microsoft packages.
Microsoft.NET.Test.sdk - 16.5
Nunit - 3.12
Nunit3TestAdapter 3.16.1
But here's the catch, you have to go into
c:\users\yourname\.nuget\packages and look for all three folders shown above. If you find any other version in those folders, delete it.
I found two versions in the Microsoft.NET.Test.SDK folder. I suspect the newer version was being loaded. Why? Because when I deleted it everything ran fine.
A corrupt layout is also possible, had this happen myself. To fix, go to projpath\bin\x64\configtype\AppX, for example:
C:\Users\Foo\Documents\Visual Studio 2019\projectname\bin\x64\Debug\AppX
Delete everything here, rebuild and you're good to go.
Since I don't see it here yet, here's what worked for me. I have a UWP project, Win32 project, and Windows application packaging project in the same solution. Running the Win32 app using FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync was giving this message and not working.
What fixed it was changing a setting in the packaging project's project settings:
Debug -> Debugger type -> Background task process: Native Only
I had same issue. Now in VS2022 you cannot download NetCore2.2.
So just download and install NetCore 2.2 from microsoft dotnet website.
https://dotnet.microsoft.com/en-us/download/dotnet/2.2
This error occurred when I tried changing C# projects in my solution to use Docker and running it:
The error went away when I changed the C# projects back to use the Visual Studio's debug server and running it:
In the Test Explorer window of Visual Studio 2019, make sure that there are no references to any *.testsettings or *.runsettings files if you are not using them intentionally. I had referenced a *.testsettings file unintentionally, and that was causing the issue.
For me, I'd just installed Visual Studio 2022 on a fresh installation of Windows 11. My project uses .Net 5, which wasn't installed by default (I only had .Net 6). I simply used the Visual Studio installer, modified my VS2022, selected Individual Components, and enabled .Net 5. Viola!
I started to get this error after updating Visual Studio from 2019 to 2022. It turned out that the project target framework was set to .Net Core 3.1, which was removed when I uninstalled VS2019, and the solution was to change it to .Net 6.0 which is the component I had selected during installation (Installing .Net Core 3.1 from the Visual Studio Installer should work as well).
To do so, right click on the project name and look for the "Target framework" option (my installation is in Spanish so that's what I presume it should say).
I've encountered this issue multiple times, using VS 2017 and VS 2019 across .NET Core 2.1, 3.1 and 5.0.
There are many conditions that can cause this problem to occur:
Microsoft Update can install a version of .Net Core at any time, automatically and outside of your awareness and knowledge.
It can also change the installation of any .Net Core SDK version's installed components.
Your version of VS has to be compatible with the version of the .Net Core SDK that you have installed.
You must have all of the following components installed for this error to be resolved/pre-empted for .NET 5.0 (please check the dotnet 5.0 site for the compatibility list by versions).
Microsoft .NET SDK 5.0.408 which includes (the following below) must all be installed and listed in the control panel:
.NET Core 5.0.17 Windows Desktop Runtime,.NET Runtime, Windows Server Hosting, Shared Framework
If any .NET Core 3.1 SDK are installed without your knowledge, you must uninstall it and repair your targeted .net core version's installation.

Error Upgrading To .NET 4.5

I'm trying to upgrade from VS2010 .NET 4 to VS2012 .NET 4.5 and I'm getting the following error in each Project that I've set to .NET 4.5 when they try to build.
The expression "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(.NETFramework, ?, '', '')" cannot be evaluated. Version string portion was too short or too long.
I can't find any references to this in my code and the msdn reference for the function doesn't provide any hints (http://msdn.microsoft.com/en-us/library/hh135279.aspx).
Anyone seen this before or know the solution?
Edit
The solution listed here doesn't seem to work. http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/8ca4a9b0-742d-487d-ab8c-6c3a80cffd40
Somehow after multiple tries, including restarting the machine and visual studio, this started working for no apparent reason.
Unload your project and remove the below tag from your .csproj file:
<TargetFrameworkVersion></TargetFrameworkVersion>
and reload your project again, it works for me.
I had the same problem when upgrading from 4.6.1 to 4.7.2 framework.
I had a big solution with many projects.
This error turned out when building the last project (win application), which had the correct <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>.
The cause of the problem were the other projects, used by the win app project.
They had incorrect framework versions.

C# Referencing Quartz.DLL. Error on Debug losing Reference

I'm trying to build a simple scheduler using Quartz.NET, but when I try to run my program it "loses" the reference and gives me 8 errors. If I re-add the reference, which never actually disappeared, the errors go away, but the program just does the same thing. I'm working on the project on a Team Server Foundation which is completely new to me. I committed the changes, but I simply can't get the third-party references to stick.
I saved the Quartz.DLL in my project in a lib folder.
Here's a screenshot of the errors I'm receiving.
I should also note that I'm not really super familiar with C# or Visual Studios. Any advice on how to add and manage a third-party library would be great.
check if your project's properties is running under .net 4.0 and not client profile.
I think your issue is the using System.DateTime; above using Quartz;. Try removing that to see if it fixes the issues.
Also, if you are running Quartz 2.0, you need to be sure that you are targetting at least the .Net 3.5 framework, not 2.0. See the breaking changes information here.
Right click on Home_Control project. Select properties >> Select Application tab >> Look for the Target framework: >> Change it to .Net Framework 4 (Note: Please select the appropriate version depending on your project. Please Don't Select .Net Framework 4 Client Profile or .Net Framework 3.5 Client Profile).
Try Building the project now.
remove the Qurtz reference and add new reference manually . Use reference from netXX-client folder in package folder.

Categories