Help cloning TinyCLR project from online repository

Hi,

A relevant question while we’re all remote working.

I have a TinyCLR project that I had been working on in the office, which I’ve been version controlling with git (via GitLab).

I’m now trying to work on it from home, so I’ve cloned the repository (using Visual Studio’s “Clone Code” option. All the code seems to have come through fine, but it’s suddenly covered in errors - things like “The type or namespace ‘System’ could not be found”, and “Predefined tpe ‘System.Object’ is not defined or imported”, etc.

Is the project not getting set up correctly when I clone it from a remote repo, missing some setup that’s done automatically when initially setting up a TinyCLR project?

Is there some workaround anyone can offer? Any help greatly appreciated!

Is your local machine setup with TinyCLR extension?

Hi Gus

Yup, I just made a new application and ran it on my G120E to be sure. All works for fresh projects

Then it maybe easier to just start a new project and your old C# files to it.

Thanks. While that would work, it’s not ideal for the long term and I’d hoped I was just doing something wrong in my interactions between Visual Studio and git. I’m likely to often switch between different PCs, and would prefer being able to use git properly, rather than having to start fresh projects, make a full copy and then push everything back to the remote repo every time.

Is this a known issue / are there known issues with keeping projects setup properly for TinyCLR related to the Visual Studio extension or am I (more likely) facing unique issues here?

Not known. We have many developers working on the same projects, no issues. There will issues when you go from TinyCLR 1.0 to 2.0 but this is somewhat expected with major releases. Beside that it should work just fine.

It could be that Visual Studio didn’t restore the references from the Nuget Pakages. I see that on other project types all the time.

I can’t pretend to be familiar enough with the environment to really understand that, but it sounds promising. Do you have a fix or workaround when that happens?

1 Like

I just ran into this with one of my projects (and because I am building the TinyCLR libs locally and changing source branches frequently).

I didn’t edit my project at all - just did: Delete the contents of the packages dir; clean the project; rebuild the project (which restores the packages); exit VS; restart VS and do another clean and full rebuild; built successfully and intellisense was no longer confused.

There have been times where I repeated that more than once. The trick is to get the bad copy of mscorlib out of your target directories. Emptying the packages dir is probably not necessary for you (I have to do it to make sure I get my most recent local build of the packages.

Clean and rebuild cleans up your targets directories, but you also need to restart VS to get intellisense using the right mscorlib. Bad mscorlib in your target dirs will cause broken builds. Bad mscorlib ref’d by VS will cause wacky red squiggles.

3 Likes

Thanks so much! This has worked perfectly!

For info in case anyone else wants to follow these instructions but isn’t yet particularly familiar with NuGet or Visual Studio (like me!).

  • The packages directory is found in %userprofile%\.nuget\packages for Windows and ~/.nuget/packages in Unix systems.
  • You can clean a project by right clicking on it in the solution explorer (or find the option in the Build menu), same for rebuild.
1 Like

An additional note, as I’ve found myself following these steps for quite a few projects that I’m bringing onto a new PC. Often the solution may only need cleaning and rebuilding. It’s worth trying that before going through all the steps

1 Like