Jessecar96 / SteamBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1.33k stars 911 forks source link

Namespace error #897

Open ghost opened 8 years ago

ghost commented 8 years ago

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?)"

scholtzm commented 8 years ago

You need to clone the git modules as well.

atannerd commented 8 years ago

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?

scholtzm commented 8 years ago

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.

atannerd commented 8 years ago

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?)"

scholtzm commented 8 years ago

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

atannerd commented 8 years ago

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

scholtzm commented 8 years ago

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?

atannerd commented 8 years ago

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

atannerd commented 8 years ago

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

public SteamAuth.SteamGuardAccount SteamGuardAccount;

BlueRaja commented 8 years ago

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

scholtzm commented 8 years ago

I will test it out tomorrow.

atannerd commented 8 years ago

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.

scholtzm commented 8 years ago

@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.