I'm successfully building an app on my local machine, but when I push to AH, I get a missing reference build error. The offending dll is Microsoft.Practices.Unity. The dll is there (copy local = true). I see it in the directory, yet AH's build process can't find it. Any ideas? Here's the error:
MilvioContextMock.ObjectSet.cs(18,7): warning CS0105: The using directive for 'System' appeared previously in this namespace ModelGenerator.Context.cs(14,7): warning CS0105: The using directive for 'System' appeared previously in this namespace c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. ClientAccountManager.cs(7,17): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) ClientAccountManager.cs(17,37): error CS0246: The type or namespace name 'IUnityContainer' could not be found (are you missing a using directive or an assembly reference?) 4 Warning(s) 2 Error(s)
#1 Posted by friism Support staff on 16 Apr, 2011 05:43 AM
Are you sure the dll is also pushed to AppHarbor?
#2 Posted by donniefitz2 on 16 Apr, 2011 05:46 AM
Well, I'm sure that git is adding it because I removed it and re-added it just to see the message and it's there. And I'm sure it's physically in the directory. Whether or not it made it to AH, I don't know. Is there a way to verify that?
#3 Posted by friism Support staff on 16 Apr, 2011 05:59 AM
Could you add [email blocked] as a collaborator, and we'll take a look.
#4 Posted by donniefitz2 on 16 Apr, 2011 06:02 AM
Sorry, I'm not sure what you mean. Add **@appharbor.com to the project? How is that done? Thanks for the quick replies by the way.
#5 Posted by donniefitz2 on 16 Apr, 2011 06:04 AM
Okay. Got it. I added support@appharbor to the project.
#6 Posted by donniefitz2 on 16 Apr, 2011 06:05 AM
that is "support"
#7 Posted by rune Support staff on 16 Apr, 2011 06:40 AM
Hi Don,
The problem occurs because Microsoft.Practices.Unity is referenced in different ways around the project - and sometimes it doesn't reference the dll. Make sure every reference in all the projects points to the Microsoft.Practices.Unity dll - as it is used several places it might make sense to put it in the "Dependencies" folder.
I would also recommend you to remove all the obj/debug folders from the git repository. The reason is that they're not necessary for us to build the code and it might lead to confusion as to why it doesn't build on AppHarbor or an continous integration server.
In this case you're not experiencing any build errors locally because the Microsoft.Practises.Unity file is actually already in the obj/debug repository (and the reference doesn't explicitly point to the dll). We build your code under the release configuration and there the dll is missing.
An extra bonus is that your commits will only contain the relevant code change and git won't track all the binaries causing the repository to be smaller.
After your remove the obj/ folders from the git repository I would recommend you make an .gitignore so git doesn't track them anymore. That way you don't commit the binaries by accident later on. We've made a little knowledge base article on how you make a basic .gitignore file here http://support.appharbor.com/kb/tips-and-tricks/gitignore
Hope this helps or feel free to contact us again if you need more help with this.
Best,
Rune
rune closed this discussion on 16 Apr, 2011 06:40 AM.
donniefitz2 re-opened this discussion on 16 Apr, 2011 06:43 AM
#8 Posted by donniefitz2 on 16 Apr, 2011 06:43 AM
Okay, this make good sense. I'll make the changes and try it again tomorrow.
Thanks for your quick response and quality support.
Don
On Fri, Apr 15, 2011 at 11:40 PM, Rune Sørensen <
[email blocked]> wrote:
rune closed this discussion on 16 Apr, 2011 06:48 AM.
donniefitz2 re-opened this discussion on 16 Apr, 2011 06:54 AM
#9 Posted by donniefitz2 on 16 Apr, 2011 06:54 AM
I decided to just try adding the Unity dll's to the Dependencies folder and
that did it. Everything builds and the tests pass. Again, thanks. You guys
are doing a great thing with this system.
Don
#10 Posted by donniefitz2 on 16 Apr, 2011 06:59 AM
So, after working with AH support, all I needed to do was add my Microsoft.Practices.Unity references to a local folder in the project (called Dependencies in my case) and then reference Unity from that folder and all was well (because that folder is known by Git). Apparently, Unity was referenced from my local machine but adding the references to the git project (in the Dependencies folder) did the trick.
#11 Posted by rune Support staff on 16 Apr, 2011 07:01 AM
Great - we're glad to hear everything worked out!
Thanks,
Rune
rune closed this discussion on 16 Apr, 2011 07:01 AM.
donniefitz2 re-opened this discussion on 16 Apr, 2011 07:04 AM
#12 Posted by donniefitz2 on 16 Apr, 2011 07:04 AM
I didn't have to add the ignore to Git. I just had to put the dll's in the
local Dependencies directory so Git knew about them. It was really pretty
clear after you explained it.
Don
On Sat, Apr 16, 2011 at 12:01 AM, Rune Sørensen <
[email blocked]> wrote:
#13 Posted by rune Support staff on 16 Apr, 2011 07:29 AM
Yeah I know - I just wanted to recommend you to remove those folders and ignoring them as it could make debugging these kinds of errors easier in the future. You could then easily run "git clean -fdx" (remove all files not tracked by git) and build it from scratch. That would resemble how it's build on AppHarbor a bit more. But great that it's more clear now :-)
rune closed this discussion on 16 Apr, 2011 07:29 AM.