"ReferencePath" item list does not define a value for the "CopyLocal" metadata
Hi there,I am making a form application with C# and after downloading Iot.Device.Bindings System.Device.Gpi libraries from nuget I got such an error:
"C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\..\..\..\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll" in the "ReferencePath" item list does not define a value for the "CopyLocal" metadata. To use this metadata, either make it available by specifying %(ReferencePath.CopyLocal) or ensure that all items in this list define a value for this metadata. CPU_GPU
as I research,adding this should solve the problem(this path is my one):
<ItemGroup>
<ReferencePath Include="C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll">
<CopyLocal>true</CopyLocal>
</ReferencePath>
</ItemGroup>
but this time it says:
Metadata file 'C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.6.0\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll' not found CPU_GPU C:\Users\ardub\source\repos\CPU_GPU\CPU_GPU\CSC
Can you help me please?37 Replies
System.Windows.Runtime
is a Nuget package, from what I can tell. Why are you referencing the dll like this?
Also, what .NET version are you on?Im on 4.8
Any particular reason for not being on something newer? Just curious
as I said,I got this error
C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461......\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll" in the "ReferencePath" item list does not define a value for the "CopyLocal" metadata. To use this metadata, either make it available by specifying %(ReferencePath.CopyLocal) or ensure that all items in this list define a value for this metadata.
nope
Just FYI, you're 7 major versions behind
We're on .NET 8 now
what
In any case, any reason you have the dll downloaded and are referencing it this way, instead of using a nuget package?
its newst version on vs2022
$newproject
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework.
.NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended.
https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
For
(.NET Framework)
, yes
It ended at 4.8 and will never update
It's there for legacy purposes
The template without (.NET Framework)
covers all versions from .NET Core 1.0 to .NET 8oh,i didnt notice that
Microsoft should really have hidden those legacy templates
Im gonna try this
I dont have these options,wihch packet should I install from visual studio insaller?
Nothing like this?
no,all .network
Huh
I thought VS installs .NET SDK as well...
Open Powershell and install the .NET 8 SDK with
winget install Microsoft.DotNet.SDK.8
I got old w11 sdk,Im insatlling new one
That's not a .NET SDK
ok Im downloading it
still same :(
Huh
In Powershell, could you execute
dotnet --list-sdks
?
Also, is VS up to date?yes it is
So that works fine, huh
Let's try using the CLI to create a project
Make a new folder somewhere, open Powershell there
dotnet new console
to create a new basic hello world project
dotnet run
to run it
Let's see if that worksit wroks
lets reboot to see if it any helps
nope thill same
Aight, try opening the project created with CLI with VS
See if it works
If it does, then you can just
dotnet new winforms
to create a Winforms project, and open it with VS like normal
Double-clicking on the .csproj
should open it in VSError NETSDK1209 The current Visual Studio version does not support targeting .NET 8.0. Target .NET 7.0 or lower, or use Visual Studio version 17.8 or higher dotnettest c:\program files\dotnet\sdk\7.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 165
no it doesnt support
but this is lastest vs
isnt it?
17.10.3 is latest
Open VS installer and see what version it is
Then update
Opening start menu and typing "visual studio installer" should find it
@ZZZZZZZZZZZZZZZZZZZZZZZZZ I fixed it:right click on 'References' in the project solution -> select 'Migrate from package.config to PackageReference'.
Thanks a lot
Ah, well, if it works it works
but i still cant figure out why other porject types doesnt appear
You could try $dotnetpath
* Open
powershell
in a terminal in admin mode as in the following video:
https://cdn.discordapp.com/attachments/569261465463160900/1157744344183341156/20230930-1822-10.7436061.mp4
* copy/paste the following script:
in case of an invalid setup detected, it will:
* tell you that it did (or not) detected an invalid Path
setup
* in case some action are require it will ask you to Press Enter to confirm
Everything seems fine as we could not find a match in PATH for 'C:\Program Files (x86)\dotnet' ... which is fine Write-Host **