Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
When I insert in references netstandard I have errors in every type, like string and int..how do I do? If I remove netstandard I don't have this errors..

This is a project where there are DYMO libraries..and I have an error:

"
Severity	Code	Description	Project	File	Line	Suppression State
Warning		The primary reference "DYMO.Common, Version=1.4.3.37, Culture=neutral, PublicKeyToken=5426002a38745af9, processorArchitecture=MSIL" could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2".	ClassLibrary1			


so I don't know which versione I must install

What I have tried:

Like I said above if I remove netstandard I don't have this problem
Posted
Updated 8-Aug-23 6:35am
v3
Comments
Richard MacCutchan 8-Aug-23 11:34am    
You must build your project against .NETFramework v4.6.1 (or higher), as it says in the error message.

Quote:
I improved my question
Quote:
could not be resolved because it was built against the ".NETFramework,Version=v4.6.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5.2"

This tells you what you need to know: the DYMO libraries use a higher version of the .NET Framework than your app - which means you can't call them as you can't "mix frameworks" in the same process. You can use lower versions provided the process starts at the higher one, but not the other way around. It's a bit like plugging a USB adapter into the mains: you can plug anything that expects USB voltages into it, like your phone, a 3D printer, a tablet. But you can't plug your TV into it as its far too low a voltage for it to run!

You need to change the framework version of your app - go to the Solution Explorer pane, open your project branch, and double click the "Properties" twig. The .NET version is at the top right of the page it displays. Almost certainly, you will have to close and re-open the project to commit the change.
 
Share this answer
 
Comments
Member 14594285 8-Aug-23 12:06pm    
ok thanks, but I have still problems with netstandars, I don't know how can I do
OriginalGriff 8-Aug-23 12:51pm    
How you can do what? Remember, we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.
Member 14594285 9-Aug-23 2:40am    
I have this error: "you must add a reference to assembly 'netstandard, Version=2.0.0.0'" but if I add netstandard I have error for type string, int.."
You don't add the framework to your references - that is done automatically when you select your project type.
At a guess, you selected a project type that uses .NET Core, so adding the standard framework will give you errors as all the base types are already defined.
 
Share this answer
 
Comments
Member 14594285 8-Aug-23 6:03am    
so how must I do to add netstandard without have errors?
OriginalGriff 8-Aug-23 7:30am    
You can't - you cannot run a app on two different frameworks!
You will have to create a new project based on the correct framework type and transfer the code to that.
Member 14594285 8-Aug-23 11:04am    
I improved my question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900