SteamBot icon indicating copy to clipboard operation
SteamBot copied to clipboard

Namespace error

Open ghost opened this issue 9 years ago • 13 comments

When I try and compile it gives me this error: "The type or namespace name 'SteamAuth' could not be found (are you missing a using directive or an assembly reference?)"

ghost avatar Jan 06 '16 15:01 ghost

You need to clone the git modules as well.

scholtzm avatar Jan 06 '16 16:01 scholtzm

I am getting this error using VS2015 after cloning the repo and using the Nuget Package Manager to update Newtonsoft.Json to version 8.0.2 - at this point this is the only error I am getting. Is there something about build order that needs to be addressed?

atannerd avatar Jan 19 '16 20:01 atannerd

https://github.com/Jessecar96/SteamBot/blob/master/SteamBot/packages.config#L3 https://github.com/geel9/SteamAuth/blob/master/SteamAuth/packages.config#L3

You ought to install the version which is declared in the package configs.

scholtzm avatar Jan 19 '16 21:01 scholtzm

Good point. When I revert to 7.0.1 I get the same error "The type or namespace name 'SteamAuth' could not be found (are you missing a directive or an assembly reference?)"

atannerd avatar Jan 19 '16 21:01 atannerd

Check your project's References. Seems like one of them is missing.

scholtzm avatar Jan 19 '16 21:01 scholtzm

I appreciate your help with this.

The references in the SteamAuth project are as follows: Analyzers Microsoft.CSharp Newtonsoft.Json System System.Core System.Data System.Data.DataSetExtensions System.Net.Http System.Xml System.Xml.Linq

atannerd avatar Jan 19 '16 21:01 atannerd

Manually removing and adding the dependency fixed the issue for me. It has been also discussed here so perhaps one of the comments will push you in the right direction.

@BlueRaja is this behaviour normal? What's causing the project to not be buildable right away after cloning?

scholtzm avatar Jan 19 '16 21:01 scholtzm

it looks like it was also discussed here to some degree https://www.reddit.com/r/SteamBot/comments/3xmbmt/steambot_setup_steamauth_error/

atannerd avatar Jan 19 '16 21:01 atannerd

To add some detail here the error is coming from line 131 of Bot.cs

public SteamAuth.SteamGuardAccount SteamGuardAccount;

atannerd avatar Jan 20 '16 20:01 atannerd

@scholtzm If it builds after readding the dependency but not before, check the git staged diff to see what's changed.

BlueRaja avatar Jan 20 '16 20:01 BlueRaja

I will test it out tomorrow.

scholtzm avatar Jan 20 '16 20:01 scholtzm

I figured out my foolishness. There were actually some good warnings in the stack that I was not paying attention to. The SteamAuth project was targeting 4.5.2 instead of 4.5. Targeting the project to 4.5 resolved this issue and the thing compiled like a dream. Thanks again for your help.

atannerd avatar Jan 20 '16 20:01 atannerd

@BlueRaja OK, found the culprit:

SteamAuth.csproj

// current
- <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>

// fixed
+ <HintPath>..\..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>

Looks like the issue is related to SteamAuth being a submodule and the path is broken.

scholtzm avatar Jan 21 '16 17:01 scholtzm