Setting up Microsoft Visual Studio 2019 environment?Solved
Hi everyone. This is my first post post here and hopefully not the last. I have gotten into coding Rust plugins (and C# in general) recently and I'm having a couple of issues setting up my workspace so IntelliSense or whatever doesn't spew out any warnings before I even typed the first statement. There will surely come time for those later, when I get to coding :P

There's seems to be an awful scarcity of tutorials on how to set up your workspace. Apparently there was a tutorial once, on github - but now the repo has been purged and presumable merged into Oxide.

I cloned this repo: https://github.com/OxideMod/Oxide.Rust. Installed NuGet and with that, presumably, all the required packages. I built twice, added the Human NPC plugin I'm trying to customise into the project, and there seems to be a bunch of dependencies missing and warnings and errors showing up. Here's what the IDE looks like now:



I can understand how Pathfinding is a separate plugin that I also need to install/add to the project, but that's a next step, I guess. Before even adding Human NPC to the whole project, there had been these 2 warnings (doesn't look like they're super serious though, they could be supressed with clear conscience?):

1d5Jkq3.png

I have definitely effed something up. Don't remember being asked for Oxide's assembly dlls's location, I did, however, download the Jan 3 version.
So I'm missing some dependencies, like mscorlib, System, websocket-sharp and Oxide dlls.

Would someone be as kind as to point me in the right direction/tutorial? I am sure this has been asked time and time again, yet I can't find anything on it while searching the forums for "workspace" or "visual studio". Googling isn't much helpful either due to a very, VERY unfortunate coincidence of this existing and taking much prevalence in the results: Rust (programming_language). Unfortunate because, apparently, Rust has been receiving much praise in the dev community and here I am hating on it because it "taints" the results I'm looking for.

All help is much appreciated. I'm not planning on patching any dlls or anything, just some plugin work. Thanks!
Simply download rust server, install oxide and add ALL DLLs as a reference. Profit!
5b6ed4c9ac8e4.jpg misticos
Simply download rust server, install oxide and add ALL DLLs as a reference. Profit!

I have already copied every single file from my server's RustDedicated_Data\Managed to Oxide.Rust\src\Dependencies\Patched\public\RustDedicated_Data\Managed. How do I add them as a reference? Again, is there a tutorial I can follow step-by-step?

Firt off  to start with you don't need the  "oxide" source, unless you are developing actual oxide server side API.

if you are developing plugins that USE the "oxide" API, then you jsut need the libraries that are precompiled.
copy those libraries from the server as you appear to have done (stick them in a  handy directory)

you need to make a project....../ solution. (C# class) once done...

on your top bar will see "project"-> edit references.. but its greyed out sometimes....(or not)

so go to "view" and set it to "DESIGN"!!!!, on your left you should have a  view of the WHOLE project, navigate DOWN the project until the menu item is NOT grey..., then select it and a  "edit refrences" will open.

Select ".Net Assembly" and then the "browse" button. to add each library... BUT don't go mad, there are some conflicts  "newtonsoft" for a start
razorfishsl
Firt off  to start with you don't need the  "oxide" source, unless you are developing actual oxide server side API.

if you are developing plugins that USE the "oxide" API, then you jsut need the libraries that are precompiled.
copy those libraries from the server as you appear to have done (stick them in a  handy directory)

you need to make a project....../ solution. (C# class) once done...

on your top bar will see "project"-> edit references.. but its greyed out sometimes....(or not)

so go to "view" and set it to "DESIGN"!!!!, on your left you should have a  view of the WHOLE project, navigate DOWN the project until the menu item is NOT grey..., then select it and a  "edit refrences" will open.

Select ".Net Assembly" and then the "browse" button. to add each library... BUT don't go mad, there are some conflicts  "newtonsoft" for a start
5b6ed4c9ac8e4.jpg misticos
Simply download rust server, install oxide and add ALL DLLs as a reference. Profit!

See, this is where it doesn't work work me, I just know I did something wrong along the way because there's no "Project/Edit References". Not even greyed out, it's just plainly not there.



And there's nothing about dependencies in the Solution Explorer, either:

https://i.imgur.com/8SntHUs.png

I don't even know how to make a solution/project properly (yet I am very willing to learn!) I can clearly see yours looks right, mine doesn't. I don't think I'm working on the right project? I thought opening the *.cproj files included on the github repo would be enough - apparently it's not.

So basically, after cloning the repo - what are the next steps? Did you open the project file or created a new one? Did you import anything? When do all those NuGet extensions come in? Some *.dll files are already present after building the project - do you leave those, do you replace them with Oxide ones?

I can't be the only one asking those very basic questions, and it's even harder for me to grasp how there's nothing about it in the Docs - and if there is, that I failed to find them. I really hate asking for the third time, but is there a tutorial on how to set up plugin dev environment? Anything? All I keep finding is stuff from circa 2015.

Or, alternatively, would someone just share their whole "working" setup of a blank, dummy, "Hello World!" plugin solution as a ZIP file? It's all text-based, so I can easily search-and-replace anything relating to absolute paths to fit my folder structure. I know this is going a terrible solution (Ba-dum-tss), but I'm getting rather desperate. I'm eager to start working on plugins, yet the frustratingly undocumented process that hundreds of modders must've already went through (and it feels like they're holding out on this ancient, secret art) is, frankly, very discouraging.

Don't panic........  you are in good hands..
I used to teach computer programming to ex-convicts... (a goverment run initiative...notes the outbreak of really smart car jackers)

if you had "startup menu" on , it asks you at start up.

1. throw your current project  away.(close it) , then exit program and re enter it
2. go to "file", there should be  "New solution",  do it.
3.  when it asks WHAT you want to generate ,go to  ".net core" select class library
4. name it & create it
5. wait a bit til it generates it.
6. go to veiw->design
7. skip past top level in  "solution sidebar" until your  menu"   project->edit references work
8. add the libraries

once you get to this stage...... we can move on...

DON'T  download anything from git  at this stage.... you do not need it....

I would send you a project but my paths are gonig to be all different... and you aint gonna learn nufink

and if you are "discouraged" at this stage... maybe programming plugins  for rust is not for you.... ;-)

I appreciate both the offer to be taught AND the assumption my patience is lesser or equal to that of a low-level criminal :)

2. I think we have different versions of the IDE


This is my Welcome screen. Again, nothing about solutions. I figured "solution" is the equivalent to, say, Eclipse's workspace and you can have several projects/folders/structures within it.


Apparently it isn't (anymore?). I've got everything under Project for some reason (different OS-es I'm assuming). There it is! C#, core class library!

So onto step 7:

Now I have an empty project. There's no "View->Design"....



And there's no "Project->Edit references".



So, yeah, we definitely have different versions and I can't shake the feeling you're somehow missing that fact!

And no, I never said I'm discouraged, only that the lack of any sort of learning materials combined, simultaneously, with seemingly mutually exclusive "we want you to learn things" attitude, is discouraging :)

Imagine asking a room full of teachers "What's the title of that textbook we need to read? Or the author? Anything?", getting no response 3 times, and then the teacher is surprised pupils just want the cheat-sheet, synopsis version. "But you won't learn anything from that!", says the teacher. Well, certainly more than from something which clearly doesn't exist! :D

That being said, thank you so much for your help so far! I really hope we can get past 5) :)

Er glasses ?
second screen "open a project or SOLUTION?

Merged post

Pffff…… Microsoft.
The problem is that many people go on forums and think they deserve an answer, like it's some sort of Indian tech support...  
Much of this process is still ongoing and in some cases people take the view why they should give the info for free... or use significant time to  onboard people that have not done proper research.

Merged post

Then there is the issue of the multi platform nature of the product....... ( compile tools & server setup)

Ok.. here is the ALMOST FULL PROCESS  on WINDOWS 10. (step2)
windows10 it is……. I avoided this because it uses way more electricity.. but here goes.


you can start at 2


1.
https://developer.microsoft.com/en-us/windows/downloads/virtual-machines (thats 2 minutes of my life wont get back)

Visual Studio 2019 (latest as of 11/13/2019) with the UWP, .NET desktop, and Azure workflows enabled and also includes the Windows Template Studio extension

Windows 10, version 1909 (10.0.18363.418) 
Windows Subsystem for Linux enabled with Ubuntu installed 


took longer to Decompress than download….


2. So after startup.


ohhhhhh jesus… yep it is completely different………. menu overload……


“Create new project… “ see your second screen right hand side.

when that god awful “picker” comes up:

choose “class library (.net core)” (it’s near the bottom)


name it “hashtest” or whatever


create
 the project.

you now have a window called “hashtest” with some skel. code.
go to “view” select “solution explorer”
in the little window by the code.....find “dependancies” right click add references.
browse to your libraries (where you stored the RUST library shit)
 add them in.

Then move down the menu to “browse” and you can see your libraries with little check boxes

Check means they are included. 
 (obviously)

select “ok”… and its gonna take a while…..

When you get back to your “skel” code.. now on the right you have a item called “assemblies” with all the libraries in.

you will see your "skel” code is called “Class1.cs” it MUST be called the same as the  class  name.(in this case "hashtest")

so lets call it “hashtest”, you can do that in the “solution explorer” by finding the file & right clicking it. (rename)

CLEAN OUT ALL the existing code in teh class   then stick some new "RUST" code it it…..
notice the construction, this must be followed for it to load
This is an example only but it works for testing.

using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Rust;
using Oxide.Core.Plugins;
using UnityEngine;
using System;

namespace Oxide.Plugins
{
    [Info("hashtest", "mr, Smith", "1.0.0")]
    [Description("A simple tie in")]
    public class hashtest : RustPlugin

    {
        void Init()
        {

            Puts("Hello boys we are in: ");

        }
    }
}​

and a screen to show it compiled on our computer

*NOTE this is not the same as the server, it is possible to get the code compiled on your computer but it wont work on the server due to illegal systems classes & security.:

you see it compiled ok….
YOU MUST configure your rust server with OXIDE and enable it. (I’m not going to show this, because I do it differently on a K8s farm)

now here is the interesting shit… 

YOU DO NOT put the compiled class (.dll) on the RUST server…………

You put the SOURCE class file on the OXIDE modded rust server……. into the “oxide” folder “plugins”

"hashtest.cs" in this case.


Now  a screen from my server


near the very bottom you see

"
hashtest was compiled successfully in 831ms
[hashtest] Hello boys we are in:
Loaded plugin hashtest v1.0.0 by mr, Smith
Saved 24,650 ents, cache(0.03), write(0.01), disk(0.01).
Saving complete"

so the "[hashtest] Hello boys we are in: "  tells us WE ARE IN & linked into the server  being called......

Merged post

why the hell is the images not working......
https://imgur.com/ivrJGrc
https://imgur.com/0uRxGg8
razorfishsl
why the hell is the images not working......
https://imgur.com/ivrJGrc
https://imgur.com/0uRxGg8

You cannot add a webpage as an image, that's why. ;) Use a direct image URL.

Also, HashTest and HashTest.cs would be proper standard, not hashtest.

Yep I'm well aware of the correct capitalisation,
I had already done the screen snapshot. by the time i realised.... so i went thru and edited it to match the snapshot.....
It takes over an hour to pull all this together & fire up a PC

AWESOME! Following those steps (started from everything works like a charm now! I had a bit of trouble adding references, I got this message after picking Add references from the context menu:



It's all sorted now though, I followed the instructions at Visual Studio 2017 enterprise can not add reference (Stack Overflow)

The paths might be a little bit different (in my case, it was C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies) and make sure you're running your Developer's Command Prompt / Powershell as an administrator (posting this just in case someone in similar situation to me will inevitably find themselves in this thread, googling for tutorials).

Thank you so much for the time you've taken to experience my frustration first-hand. I agree, the Windows IDE is definitely not perfect. I hate clunky menus, I've seen the one you posted on your screenshots, looks much cleaner. This seems to be a running theme in Microsoft's environments - one of the reasons I refuse to use Microsoft Office at work in favour of Google Docs.

This thread can be now closed/solved, I guess.
Glad you got it working......
As you see the "oxide" repository on git is "related" but something completely different.. it is the enabler for the plugins...
on github you will also find  a plugin writer who has put all his plugins up in a single repository.

So that should give you enough points of reference to get most of what you want... or you can download other plugins from this site...
Just some other points...
Watch:
1.  your plugin timings... they directly affect the  RUST server it's a multi user system.
2.  the "re-entrancy", this is when something you do in the plugin... triggers something else in the plugin, which then triggers the plugin source event.. several "free" plugins suffer from this,  it is potentially dangerous.. server/client killing stuff (and behaves differently on different platforms)
3. the classes you use,  even your plugin compiles on your computer, does not mean all the classes are availabe on the server.
4. don't expect to find tons of info on  API's etc..... there is the oxide API on this site, but as regards internal  objects & resources on RUST you are on your own.... so grab a de-compiler........ and binary editor
Locked automatically