Intellisense doesn't work on certain scripts - c#

I've been using vscode for editing my unity scripts but lately I haven't been able to use autocomplete for my scripts, for some reason on my older projects intellisense seems to work fine but any new project I try to use it and it just doesn't work, here is the omnisharp output: (and yes, I've installed the targeting pack for this framework version).
I also tried reinstalling vscode and resetting the settings, nothing seemed to work.
Omnisharp server running using Stdio at location 'c:\Users\Lincoln\Documents\Prototype SI' on host 7244.
The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Failed to load project file 'c:\Users\Lincoln\Documents\Prototype SI\Assembly-CSharp.csproj'.
c:\Users\Lincoln\Documents\Prototype SI\Assembly-CSharp.csproj
C:\Users\Lincoln.vscode\extensions\ms-vscode.csharp-1.18.0.omnisharp\1.32.11\msbuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1126,5): Error: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Attempted to update project that is not loaded: c:\Users\Lincoln\Documents\Prototype SI\Assembly-CSharp.csproj
Miscellaneous file: c:\Users\Lincoln\Documents\Prototype SI\Assets\Player.cs added to workspace

try to locate the project folder from vs code. click the open folder from vs code and navigate to your project.

Related

Ranorex build fails 9.4.1 The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found

Getting Error with
The reference assemblies for framework ".NETFramework,Version=v4.7.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. (MSB3644) - C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets:1179,5
I figured it out by downgraded to 4.6.2 from 4.7.2 under Project > Project Option > Compiling Tab downgraded Target > .Net Framework

In Linux , The reference assemblies for framework ".NETFramework,Version=v4.5" were not found

I have made a setup of Visual studio to compile C# code in my Ubuntu Machine .
I loaded the workspace/my code to VS and I could see the below error.
The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Please help me on resolving this issue as am a beginner in Visual studio.
Thanks
If project is heavy, you can follow
this procedure
If your project is lightweight, create a new .netcore project using VS and move your code (and dependencies references)into that new project. then let VS telling you potential errors and correct them.
Looking at the procedure, you can firstly retargeting your actual project in dotnet 4.6.2 framework in order to "ensures that you can use API alternatives for .NET Framework-specific targets in the cases where .NET Core can't support a particular API."
I would recommend running the portability tool in Visual Studio 2017 if you have it. This will give you an idea if you will have a hard time moving it over.
As for your error with the csproj, that's because that file has paths within it, which are pointing to locations using windows paths, instead of Linux paths.

ASP .NET CORE could not find file or assembly with custom assembly

I've ran into a weird problem.
I basically have my own web-stack for .NET-core which I've built into a few .dlls, and I want to reference these from another ASP CORE-solution.
VS seems to find the assemblies, where I can navigate types etc.
I can also build the project without any issues, but when IIS then runs the server I get an internal server error stating:
FileNotFoundException: Could not load file or assembly 'myDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
The referenced DLLs are in the debug-folder, and the really weird thing is that if I create a new ASP Core project in the same solution as the web-stack, I can reference and use it without any problems.
Why is this happening only when running on a project outside the web-stack's solution, and what can I do to make it runnable everywhere?
The .NET Core Tooling in VS 2017 (< 15.3 preview) / .NET CLI < 2.0 doesn't fully support referencing assemblies on disk. You need to package the library up as a NuGet package or use a project reference ("same solution"). The technical reason is that all the required assemblies and versions are resolved during compilation and written to the .deps.json file. When loading arbitrary assemblies, this might fail because either the assembly or its dependencies cannot be found (or a conflict with each other).
for load the external dll in core project, needed to:
vs 2017 with version 15.3 or upper.
Microsoft.Extensions.DependencyModel NuGet package installed in your project.

Xamarin Forms Portable Application MonoAndroid Build Error - Framework not found

I've made a fresh Xamarin Forms Portable Project from the Cross Platform templates in Visual Studio 2015. Haven't touched or modified any of the project files. Then When I try to initially build it, I get the following build error:
C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1098,5): error MSB3644: The reference assemblies for framework "MonoAndroid,Version=v6.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
My Project defaults are:
Looking at similar questions, it would seem that, indeed, that version of the framework is not installed. But it seems to be. Android SDK Manager shows the following:
What is going on here? How can I resolve this.
When you get these type of errors, that are really 'out there' and hint of system configuration problems, it's time to reinstall.
I had to completely remove all remnants of Visual Studio, SDKs and Xamarin. 'Modify' and 'Repair' didn't work.
After the complete fresh install of VS 2015 and Xamarin, things are back to normal.

Referenced Nuget package has errors finding system types

I have several strange errors after using NuGet to add a third party library to a project. The project targets .NET 4.5.2.
The errors I get complain of standard system types not being of the correct version
e.g.
CS0012: The type 'System.Collections.Generic.IEnumerable`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I have cleaned the project folder, deleted the bin folder, reinstalled the
NuGet package and readded the reference to no avail.
The library is Remotion.Linq
According to the Registry the following .NET versions are installed on the machine
v2.0.50727 2.0.50727.4927 SP2
v3.0 3.0.30729.4926 SP2
v3.5 3.5.30729.4926 SP1
v4
Client 4.6.01038
Full 4.6.01038
v4.0
Client 4.0.0.0
Does anyone know what is happening here?
This suggests the third party library targets 4.0 of the framework. You either need to find a later version of the library or in your project properties set the target framework to 4.0 as opposed to 4.5
This turned out to be a misleading error. The library was built against .NET 4.5.2 but I had .NET 4.5.1 installed.
Microsoft explain this in a KB article (KB2971005) but you really need to know what the issue is to easily find the article. I somehow stumbled across it after a lot of searching.
The resolution is to install the updated version of the Microsoft .NET Framework 4.5.2 Developer Pack.

Categories

Resources