I created my first C# application recently, and since buying a new computer I cannot get the application to start.
I am receiving 7 of the following errors Error NU1101 Unable to find package Microsoft.VisualStudio.Web.CodeGeneration.Design. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages clesson C:\Users\porkh\Desktop\WERK\Personal\c-lesson\clesson\clesson\clesson.csproj
Each with different packages missing.
Since this was a missing dependencies message I reinstalled visual studio 2019 with C# .net support again, yet I am running into the same error.
On StackOverFlow I read that I need to check my NuGet packages,
Here it shows every package that is "missing" in the error messages as installed.
I have also tried running dotnet run and dotnet restore but I get the same error messages.
I am extremely new to C# so sorry if I have missed the solution in other's answers. Any help you can give me I'd appreciate it.
A link to all of my project files here
In the image it says
Not available in this source
and the package source is set to Offline Packages. My best guess is, switching to an official NuGet Feed in the drop down to the upper right, will solve your problem. You also want to check, if the Nuget source is available (it should).
If not, click the Cog icon, and add it there with the name "Nuget" and the Url https://api.nuget.org/v3/index.json
I am following a tutorial about Unity and I see that the instructor has intellisense when writes the method's name.
However I have only intellisense with classes and variables, I mean Unity classes like Rigidbody and my own variables.
I have also read:
Autocompletion not working in Visual studio
How to enable intellisense in Visual Studio 2017 for Unity
Old question, but I had the same problem just recently.
There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files.
You can tell Unity (my version: v2019.2.20f1) to create these for you by enabling Edit > Preferences > Generate all .csproj files.
1. Delete both files.
2. Enable .csproj file generation.
3. Double click on a script in Unity.
This fixed my issue.
I would really like to clear things up a bit for everyone trying to get Intellisense working with Visual Studio Code.
First of all I am writing this for Unity 2019.4.14 (edit: also for 2020.3 and 2021.3).
These are the things you MUST do for this to work:
You need Visual Studio Code (duh)
You need .NET SDK. I don't think it matters which version, latest is the best I guess. Make sure you install the SDK, not the runtime.
Check if you have .NET SDK installed by typing dotnet in the VSCode terminal.
You also need The .NET Framework Dev Pack because otherwise VSCode is going to be throwing this error:
The reference assemblies for .NETFramework,Version=v4.7.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application.
In VSCode search for the 'C# for Visual Studio Code' extension and install it
In Unity go to Package Manager and install Visual Studio Code Editor. This will enable Unity to generate proper project files for VSCode. (might be already installed)
In Unity go to Edit -> Preferences -> External Tools and choose VSCode from the dropdown (could be listed as code.cmd) and after you choose it tick all the checkboxes you want in the Generate .csproj files for section. I checked Embedded Packages, Local Packages, and Packages from unknown sources. Click 'Regenerate project files'
Open any C# file from Unity and you should be good to go. (you might need to restart VSCode after regenerating project files in order for this to work)
Now, what about Unity Code Snippets and Debugger for Unity extensions? Well these are useful helper extensions but they have nothing to do with Intellisense. The first is for quickly typing common Unity patterns and the second is for showing Unity Debug warnings and errors as you type instead of saving and going back to Unity and reading the console.
Hope this was of any help.
p.s.
One more note: Visual Studio Code depends on the solution files we generate through Unity for Intellisense to work. This is important because you have to add the entire project folder to VSCode workspace and not just Assets folder or your Scripts folders. If you add only the Assets folder to VSCode it won't be aware of those solution (.sln) files. If you open scripts through Unity it will probably work regardless.
Although the answer by Alex Myers is helps, its not 100% right. Unity Snippets does give you some snippets, and the illusion of typeahead, it's not actually intellisense.
For true intellisense you need to:
install dotnet on your system (https://code.visualstudio.com/docs/languages/dotnet) and,
install the dotnet extension for VSCode (https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
More information can be found here: https://code.visualstudio.com/docs/languages/dotnet
You can test you have dotnet installed by typing dotnet into the terminal within VSCode.
Note In the image below how I get a full method signature, reference counts, and the yellow hint globe. These are only available when using dotnet + extension (and not available when using the snippets)
Note: my solution does not solve intellisense to function names, but this was the first question that come in fixing intellisense more generally in VSCode.
I needed to update the VSCode package in unity.
In Unity, click Window, then Package Manager, then look for Visual Studio Code Editor. Expand it by pressing triangle, and upgrade to the latest version (for me, it was 1.2.0. I restarted VSCode and it worked.
v1.1.4 had a bug that caused this problem, and was not fixed for about 3 months. It is still the default package installed with a new default project, so you have to change this package version to 1.2.0 in every new project, until they update it.
Check out the guide for Unity Development with VS Code. They recommend a few extensions:
Unity Snippets
Debugger for Unity
Unity Tools
I believe the Unity Snippets extension is what you are looking for.
For anyone having the same problem on a Mac, try setting this value in your .vscode/settings.json (or in the user settings instead of the workspace settings)
"omnisharp.useGlobalMono": "always"
For me just in Unity, Edit/Preferences/External Script Editor, and changed it to My_Install_Location\Microsoft VS Code\Code.exe (maybe hit Regenerate Project Files)
Sorry, I don't have good English, but I'll show you what worked for me.
I opened the C # script in Visual Studio Code and looked for the Assembly-CSharp.csproj file, then, on line 16, I changed the following:
<TargetFrameworkVersion> v4.5 </TargetFrameworkVersion>
For:
<TargetFrameworkVersion> v4.5.1 </TargetFrameworkVersion>
This solved the Intellisense issue.
Intellisense is a pure workflow of .Net Environment. So, you need to have .Net 'Developer pack' (not Runtime) installed on your system as it installs all three necessary components below:
.Net framework
.Net Target pack
.net SDK
reference link: https://dotnet.microsoft.com/download/visual-studio-sdks
It is directly installed to a system admin-accessible path, so no need setting it up. Now, you have to tell VS Code which .Net version to use (whichever you have installed).
Your Unity project will have these two files in the root directory:
Assembly-CSharp.csproj
Assembly-CSharp-Editor.csproj
In these both files search for line (probably 16):
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
Edit version that you had just installed (I had 4.8). Then reopen VS Code. Now everything should work fine.
I found another solution since none of the other solutions were working for me and i was searching for hours.(07/08/2021):
I got the feeling i found the solution for a lot of people since i reinstalled windows recently and simply downloaded everything needed to start without other problems.
I got the same error with .NET, .NET Core or .NET Framework, here are some screenshots of the errors:
In the error output, it says to install the Developer Pack for this framework version. You can find the version in the .csproj file:
By installing the .NET Framework of this version on the dotnet microsoft site: .NET Framework download list
i fixed the error after reloading VSCode and got my Intellisense working for Unity.
TLDR:
My fix was too install .NET Framework version 4.7.1
If you still can't enable IntelliSense, make sure you have VS Code opened in the same directory as the .sln file (I had mine opened deeper in the Assets before).
Source:
https://code.visualstudio.com/docs/other/unity
Though the question is 2 years old, the problem pops up occasionally, just like happened to me.
I had the issue myself, so this one is possibly the first that should be checked.
"Install .NET Framework 4.6 Targeting Pack"
WHY?
First of all, I work with dotnet core, not the standard, so I don't have standard libraries installed on my computer. When I started trying Unity, and VS Code with it, this was the missing part I wasn't aware of.
When I hit the issue, I searched the net a while and see this question. Took me another while to notice this framework sentence in "Enabling code completion" section of VS Code and Unity page. So I tried and now I am happy I tried.
Just don't forget you need to restart at least VS Code to get the intellisense working.
PS: Framework version may, and will most possibly, be changed depending on what year we are in, and which versions we use. So if "4.6" is not working then you probably need another version.
PS2: If it is Mac you are looking for, follow the same link above and find the same section I mentioned above to get a link for .NET SDK.
Follow these steps:
Go into your Unity project.
Go to Edit.
Go to Projects preferences.
Go to External tools.
In line "External Script Editor" you have to change to "Visual Studio Cummunity 2019..."
then it should work.
I've installed Xamarin.Android 4.16 but I have a bug with date and time in this version. So I want to rollback to Xamarin.Android 4.14.
I searched the version 4.14 of Xamarin.Android for Visual Studio, but I can't find it.
Does somebody know the link to access to this version ?
I saw this post : Downgrade Xamarin.Android and I tried to change the link of the .msi with my version number but I can't find it.
Thanks for your help!
You can get several previous versions right from your Xamarin's account. Go to https://store.xamarin.com/account/my/subscription/downloads and select View all versions. Choose what you want. It may happen that required version is not there. Then, just contact support and tell them what version you need (or approximate date/month of your required version if you do not know the number).
I updated to iPhone SDK 4.3 today and now it's not possible to build/run (in debug or release mode) any of my projects that worked fine in iPhone SDK 4.2.
When I try to build or run Monodevelop "hangs" on "Compiling to native code"
If I try to run/debug to the iPhoneSimulator I get the error message:
"Error merging info.plist: Invalid
data"
Does anyone have a solution to this problem?
Explicitly target the 4.2 iOS SDK inside your project's options, under the iPhone Build section. When it is at the Default setting, it always targets the latest iOS version installed.
Upgrading to MonoTouch 3.2.5 will resolve this issue.
For an older version, you just need to create a symlink:
cd /Developer/MonoTouch/SDKs
sudo ln -s MonoTouch.iphonesimulator4.2.sdk MonoTouch.iphonesimulator4.3.sdk
No symlink is needed for the device SDK directory, as it does not contain a version number.
Upates are released to both MonoDevelop and MonoTouch that fix this problem. The updates are available through the update function in MonoDevelop
I had the same problem. It all started for me when I uninstalled/re-installed my dev environment in order to fix something else (breakpoints not being hit during debugging).
So, even though I re-staged my entire laptop in order to come to this conclusion, user653490 is correct, the update to MonoDevelop DOES fix the problem. However, what is NOT clear at first is the fact that the BUILD VERSION is very important. Whereas I was still seeing "Error merging info.plist: Invalid data" with MonoDevelop 2.4.2 build 20402000, once I was using build 2040200*4*, I was able to compile again. The build version is the key. Hope this helps someone else, because it was very frustrating.
In reference to the post below, where it says I should increase the version number for older versions to be replaced by newer ones.
MSI Installer fails without removing a previous install
What I find is, just changing the version number didn't do the job. I had to change the product code also, which I got an option to change through a Message Box just after changing the Version Number.
Is this how it's supposed to be?
I think Visual Studio setup project uses the version number to generate the Product Code which is why you must update both. The product code is a unique GUID that identifies the installed application. It is good practice to update both each time you release an installer. Otherwise the client will get a message that says something like "Another version of this application is already installed, please uninstall that version first..." etc. and the MSI will not install the new version.
So to remove a previous version before installing a new version you must set RemovePreviousVersions property to True and update the version number and product code.
You can automate the version number and product code part by executing a script in the PreBuildEvent of the setup project. You can find interesting article and sample script on CodeProject http://www.codeproject.com/KB/install/NewSetupVersion.aspx