tag:support.appharbor.com,2010-11-23:/discussions/problems/24265-systemiofileloadexception-the-given-assembly-name-or-codebase-was-invalid-hresult-0x80131047AppHarbor: Discussion 2013-12-18T21:59:56Ztag:support.appharbor.com,2010-11-23:Comment/263502072013-04-11T20:07:10Z2013-04-11T20:07:10ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>I can see that the repository is being deployed "as-is", i.e.
without building it. That's because we can't find a solution file
in the repository you push to us. If that's not intended you can
try and add a solution file and reference the web project you want
to deploy.</p>
<p>You can always download the compiled build artifact from the
<a href=
"https://appharbor.com/applications/carpu/builds/650606">build
page</a>. That might be helpful if you need to figure out whether
all files are deployed as expected, or for downloading and
debugging locally.</p>
<p>I hope this helps!<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-11T22:57:47Z2013-05-08T00:43:49ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hey Rune, thanks for your quick answer.</p>
<p>At the first time I really deployed it "as-is", but from the
second time on, I was trying to push only the folder which contains
the builded project (I builded it locally to be able to do that).
But I still haven't understood how can I delete everything I had
deployed till now to be able to delete and deploy all again,
deploying only the builded project this time.</p>
<p>I downloaded the build page but there's no .sln or .csproj files
in it. The same as the deployed project's folder. Shouldn't I push
the non-build project intead, then?</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-12T20:52:31Z2013-04-12T20:52:52ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Everytime you deploy to AppHarbor it'll be a completely
redeployed, and won't be affected by prior pushes if that's. You
can optionally force to overwrite the current state of your git
repository (if you've made change to the revision history) by
pushing with the <code>-f</code> switch like so <code>git push
appharbor master -f</code>. I'm not sure that's what you meant
though?</p>
<p>It seems like you did it almost right the last time you pushed.
The build failed, but that's because the solution file
<code>CarpuProject.sln</code> references references a solution file
at this location <code>CarpuProject\CarpuProject.csproj</code>.
That file is not included in the repository and you likely want to
move the solution file up one level, have a folder containing your
project (i.e. <code>CarpuProject</code>) and then have the project
file (<code>CarpuProject.csproj</code>) in there. Like so:</p>
<pre>
<code>+-.gitignore
src/
| +-CarpuProject.sln
| +-CarpuProject/
| | +-Content/
| | +-CarpuProject.csproj
| | +-Global.asax
| | .........
lib/
| +-Antlr3.Runtime.dll
| ........</code>
</pre>
<p>I've separated the directory structure into a <code>src</code>
and a <code>lib</code> folder as I noticed that you're including
the "bin" folder containing the compiled app in your repository.
That'll rapidly cause your repository size to grow, and is not
necessary since AppHarbor will build it anyway. So I recommend that
you delete the bin folder from your repository, add the bin folder
to your <code>.gitignore</code> file (like in <a href=
"https://gist.github.com/tt/825373">this example</a>).</p>
<p>You can then move any dependencies your app relies on to the
"lib" folder, reference them from your project file and it'll be
copied when the application is built.</p>
<p>We've found that having a directory structure roughly similar to
this makes it significantly easier to maintain and debug apps as it
forms a well-defined "contract" for the app to be deployed.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-17T21:47:58Z2013-05-08T00:43:49ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Well.. I think that been a completely newbie on it I may be
disturbing you =[<br>
But I tried alot and can't still build it.</p>
<p>Let's back to the begining:<br>
- The first thing I did was clicking on the Visual Studio "Publish"
option and my project is configured to deploy "only files needed to
run this application". So I choose to publish it in a local folder.
After published, there's no .sln or .csproj files in this local
folder. - Then I right click in this local folder and selected "Git
add all files now" - Then right click again on "Git gui" and on the
window opened I clicked on "Send" and entered my password.</p>
<p>Then I check my repository on AppHarbor website and it's still
getting the same error.</p>
<p>So, what should be the right proccess of publishing my project
on this local folder before pushing it to AppHarbor?</p>
<p>So sorry if I'm annoying and thank you so much of your help</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-19T04:36:40Z2013-04-19T04:36:40ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>No problem - the issue is that you shouldn't use the "Publish"
feature of Visual Studio. Instead you need to use Git/Mercurial for
your code, and push that to AppHarbor instead. AppHarbor will build
your source code for you, and deploy the website contained in it.
Have you tried that?</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-23T14:37:13Z2013-05-08T00:43:50ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Oh, for security reasons I though shouldn't publish the code,
that's why I was publishing the project after deploying it with the
Visual Studio "Publish" tool.<br>
But ok, I'm trying now to publish the original folder (the one with
the source code and the .sln and .csproj files). I had also to
delete my already created Appharbor application and created another
one with the same name. But now, after pushing the files, even
after desabling the Appharbor Build tool (desabled precompilation)
I am getting this error: "Build failed: An error occurred during
the build" :(</p>
<p>Any idea?</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-23T21:28:39Z2013-04-23T21:28:39ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>Yes you can click the <a href=
"https://appharbor.com/applications/carpu/builds/664916">Show Log
link</a> to get the output from MsBuild. Looks like it expects a
project, which isn't in the repository/correct location, to be
there.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-23T23:01:02Z2013-05-08T00:43:50ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>I've seen this log but I can't find the option to download the
compiled build artifact. Anyways, I'm pushing the folder
CarpuProject which contains the .sln file and the second
CarpuProject folder (which contains the CarpuProject.csproj file).
I can't understand why the MsBuild is saying that
CarpuProject\CarpuProject.csproj doesn't exists. If I push the
folder that contains it, shouldn't it be pushed? :(</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-24T05:02:28Z2013-04-24T05:02:28ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>In this case you can't download the build artifact because we're
unable to build the application. Are you certain that the
<code>CarpuProject.csproj</code> is located in the specified
directory, relative to your solution file? and that this project is
also committed to your repository?</p>
<p>If so we'll have to take a closer look at this, but I'm fairly
certain that the structure is the problem - it may simply be nested
a level to deep and not included in the repository.</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-24T13:38:44Z2013-05-08T00:43:50ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Yes, I am! The structure is:</p>
<ol>
<li>CarpuProject/<br></li>
<li>| CarpuProject.sln<br></li>
<li>| CarpuProject/<br></li>
<li>| | CarpuProject.csproj</li>
</ol>
<p>And I'm pushing the root folder (1) so it's supposed to
automatically push all the directories and files inside this
folder, listed bellow:</p>
<p>CarpuProject/<br>
CarpuProject/CarpuProject.sln<br>
CarpuProject/CarpuProject/<br>
CarpuProject/CarpuProject/CarpuProject.csproj</p>
<p>Am I right?</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-24T22:09:04Z2013-04-24T22:09:04ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>I just checked out your repository, and there doesn't appear to
be any files in the <code>CarpuProject</code> folder - the one that
should contain <code>CarpuProject.csproj</code>. Adding those files
and committing it to git should resolve the issue.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-04-25T17:16:30Z2013-05-08T00:43:50ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>What's wrong with the following tutorial then?<br>
<a href=
"http://support.appharbor.com/kb/getting-started/deploying-your-first-application-using-git">
http://support.appharbor.com/kb/getting-started/deploying-your-firs...</a></p>
<p>Because I followed it's steps and pushed the root folder
CarpuProject/ which, as I said, contains all the subfolders and
files (including CarpuProject.csproj) you mentioned, but you're
telling me that the CarpuProject subfolder is empty...</p>
<p>I can't find any information in this tutorial on "how to push an
specific subfolder that supposed to be pushed on the first
commit"..<br>
This tutorial was created by Appharbor, that's why I'm not
understanding why it doesn't work with me.</p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-04-25T17:32:53Z2013-04-25T17:32:53ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>All the required files haven't been added to the repository -
that'll really all I can say. It's honestly a bit weird/unusual
that there are no files in the <code>CapuProject</code> folder, but
that really is the case. The tutorial should be fine, and if you
committed the files as mentioned in the tutorial you should have
all the files in the repository. You could try and run <code>git
status</code> from your root folder to ensure that they are indeed
all committed.</p>
<p>You'll need to somehow fix the git-related problem you're
having. If you're new to git perhaps it'll be helpful to use a
graphical interface or similar when verifying that the files are
contained and committed to the repository. You can try and push
your app to for instance Bitbucket og GitHub.</p>
<p>Alternatively you could use a different way of deploying. We
support deployments through GitHub, BitBucket and with <a href=
"http://blog.appharbor.com/2012/08/28/appharbor-cli-version-1-1-released">
our own CLI</a> that doesn't require any version control system
integration.</p>
<p>I hope this helps.<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/263502072013-05-05T18:51:43Z2013-05-08T00:43:50ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi, Rune.</p>
<p>Some weeks passed and I'm still trying to fix this issue. I
upgraded my visual studio to the 2012 version and installed the
Visual Studio tools for GIT (*) but still I'm deploying the project
but seems that the /CarpuProject folder is neither being pushed.
:(</p>
<p>Any suggestion? I can't find any help on the web :(</p>
<p>(*) <a href=
"http://www.hanselman.com/blog/GitSupportForVisualStudioGitTFSAndVSPutIntoContext.aspx">
http://www.hanselman.com/blog/GitSupportForVisualStudioGitTFSAndVSP...</a></p></div>carpubrasiltag:support.appharbor.com,2010-11-23:Comment/263502072013-05-06T02:04:06Z2013-05-06T02:04:41ZSystem.IO.FileLoadException: The given assembly name or codebase was invalid. HRESULT: 0x80131047<div><p>Hi,</p>
<p>I can see that the contents of the <code>CarpuProject</code>
folder is now contained in the repository - that's a good first
step. As you can see from the <a href=
"https://appharbor.com/applications/carpu/builds/682817">build
log</a> (click the "Show Log" link the bottom) there are however
some references that are no contained in the repository. In
particular:</p>
<ol>
<li>Elmah (and Elmah.mvc) is attempting to resolve to a path that
is not available when the app is build on AppHarbor (or any
environment except your own). Elmah is for instance resolving to
<code>C:\Users\LEO\Desktop\bin2\Nova pasta\Elmah.dll</code> which
is also evident from your <code>web.config</code>. I can see that
you've installed the NuGet elmah package, so you might want to
simply remove the reference, reinstall the Elmah NuGet package to
update the references. You can then enable NuGet package restore
<a href=
"http://blog.appharbor.com/2012/02/06/use-nuget-package-restore-to-avoid-pushing-packages-to-appharbor">
as described in this blog post</a> to ensure that the packages are
fetched upon deployment.<br></li>
<li>The references to the <code>Facebook</code>,
<code>System.Web.Optimization</code>, <code>WebActivator</code> and
<code>WebGrease</code> assemblies are all trying to resolve to the
the <code>CarpuProject\bin</code> folder. However this folder is
not included in the repository, and that's actually also the
recommended configuration (referencing files in the
<code>bin</code> folder can lead to all sorts fo confusion and
assembly mismatches). I'd recommend that you remove all references
to these assemblies, create a <code>lib</code> folder in the root
of your project (next to your <code>CarpuProject.sln</code> file)
and reference the assemblies in that location instead. Remember to
add the lib folder and the assemblies to your repository. Also
remember to save and commit the project files after you've updated
the references.</li>
</ol>
<p>Another solution to (2) would be to install these dependencies
as NuGet packages and let these dependencies be download and
resolved like in (1).</p>
<p>While you figure out the remaining issues I recommend that you
inspect the build log to see what assemblies and references may be
missing. You're getting pretty close to resolving these issues
now.</p>
<p>Best,<br>
Rune</p></div>rune