Metadata file '.dll' could not be found - c#
I am working on a WPF, C# 3.0 project, and I get this error:
Error 1 Metadata file
'WORK=- \Tools\VersionManagementSystem\BusinessLogicLayer\bin\Debug
\BusinessLogicLayer.dll' could not be found C:\-=WORK=- \Tools
\VersionManagementSystem\VersionManagementSystem\CSC VersionManagementSystem
This is how I reference my usercontrols:
xmlns:vms="clr-namespace:VersionManagementSystem"
<vms:SignOffProjectListing Margin="5"/>
It happens after every failed build. The only way I can get the solution to compile is to comment out all my user controls and re-build the project, and then I uncomment the usercontrols and everything is fine.
I have checked build orders and dependencies configurations.
As you can see, it seems to have truncated the DLL file's absolute path... I have read that there is a bug with the length. Is this a possible problem?
It's very annoying and having to comment, build, and uncomment, the build is becoming extremely tiresome.
I just had the same problem. Visual Studio isn't building the project that's being referenced.
Written Instructions:
Right click on the solution and click Properties.
Click Configuration on the left.
Make sure the check box under "Build" for the project it can't find is checked. If it is already checked, uncheck, hit apply and check the boxes again.
(Optional) You had to do it for both Release and Debug modes on the solution properties.
Screen capture Instructions:
They say a picture is worth a thousand words. Click on the GIF to zoom in, and hopefully it will be easy to follow:
This can still happen in newer versions of Visual Studio (I just had it happen on Visual Studio 2013):
Another thing to try is to close Visual Studio and delete the .suo file that is next to the .sln file. (It will be re-generated the next time you Save all (or exit Visual Studio)).
I've had this problem when adding new projects to the solution on another machine and then pulling the revisions in, but the .suo file can be corrupted in other cases as well and lead to very strange Visual Studio behaviour, so deleting it is one of the things I always try.
Note that deleting the .suo file will reset the startup project(s) of the solution.
More on the .suo file is here.
The suggested answer did not work for me. The error is a decoy for another problem.
I found out that I was targeting a slightly different version of .NET and this was flagged as a warning by the compiler, but it was causing building to fail.
This should have been flagged as an error and not a warning.
Well, my answer is not just the summary of all the solutions, but it offers more than that.
Section (1):
In general solutions:
I had four errors of this kind (‘metadata file could not be found’) along with one error saying 'Source File Could Not Be Opened (‘Unspecified error ‘)'.
I tried to get rid of ‘metadata file could not be found’ error. For that, I read many posts, blogs, etc. and found these solutions may be effective (summarizing them over here):
Restart Visual Studio and try building again.
Go to 'Solution Explorer'. Right click on Solution. Go to Properties. Go to 'Configuration Manager'. Check if the checkboxes under 'Build' are checked or not. If any or all of them are unchecked, then check them and try building again.
If the above solution(s) do not work, then follow sequence mentioned in step 2 above, and even if all the checkboxes are checked, uncheck them, check again and try to build again.
Build Order and Project Dependencies:
Go to 'Solution Explorer'. Right click on Solution. Go to 'Project Dependencies...'. You will see two tabs: 'Dependencies' and 'Build Order'. This build order is the one in which solution builds. Check the project dependencies and the build order to verify if some project (say 'project1') which is dependent on other (say 'project2') is trying to build before that one (project2). This might be the cause for the error.
Check the path of the missing .dll:
Check the path of the missing .dll. If the path contains space or any other invalid path character, remove it and try building again.
If this is the cause, then adjust the build order.
Section (2):
My particular case:
I tried all the steps above with various permutations and combinations with restarting Visual Studio a few times. But, it did not help me.
So, I decided to get rid of other error I was coming across ('Source File Could Not Be Opened (‘Unspecified error ‘)').
I came across a blog post: TFS Error–Source File Could Not Be Opened (‘Unspecified error ‘)
I tried the steps mentioned in that blog post, and I got rid of the error 'Source File Could Not Be Opened (‘Unspecified error ‘)' and surprisingly I got rid of other errors (‘metadata file could not be found’) as well.
Section (3):
Moral of the story:
Try all solutions as mentioned in section (1) above (and any other solutions) for getting rid of the error. If nothing works out, as per the blog mentioned in section (2) above, delete the entries of all source files which are no longer present in the source control and the file system from your .csproj file.
In my case it was caused by a .NET Framework version mismatch.
One project was 3.5 and the other referencing project 4.6.1.
Visual Studio 2019 this worked for me:
Close Visual Studio
Delete the hidden .vs folder
Reopen Visual Studio and rebuild the solution.
Closing and reopening Visual Studio 2013 worked for me!
Well, nothing in the previous answers worked for me, so it got me thinking about why am I clicking and hoping when as developers we should really try to understand what is going on here.
It seemed obvious to me that this incorrect meta data file reference must be held somewhere.
A quick search of the .csproj file showed the guilty lines. I had a section called <itemGroup> that seemed to be hanging onto the old incorrect filepath.
<ItemGroup>
<ProjectReference Include="..\..\..\MySiteOld\MySite.Entities\MySite.Entities.csproj">
<Project>{5b0a347e-cd9a-4746-a3b6-99d6d010a6c2}</Project>
<Name>Beeyp.Entities</Name>
</ProjectReference>
...
So a simple fix really:
Backup your .csproj file.
Find the incorrect paths in the .csproj file and rename appropriately.
Please make sure you backup your old .csproj before you fiddle.
In my case, I have my installed directory in mistaken ways.
If your solution path is something like "My Project%2c Very Popular%2c Unit Testing%2c Software and Hardware.zip", it cannot resolve the metadata file, perhaps we should prevent some invalid words like %2c.
When a repository is cloned from certain sites, the directory name is URL encoded. Which would convert space characters in directory names to %20, forward slashes to %2f, underscores to %5f, etc. Although, I'm not sure why the % symbol is breaking things.
Renaming the path into a normal name resolved my issue.
I also met this problem. Firstly you have to manually build you DLL project, by right-click, Build. Then it will work.
In my case, the problem was caused by a simple build error,
error CS0067: The event 'XYZ' is never used
that, for any reason, did not show up in the error window.
Because of that, the Visual Studio build system seemed to miss the error and tried to build dependent projects, which in turn failed with the annoying metadata message.
The recommendation is -as stupid as it may sound-:
First look at your Output Window!
It took me half an hour before this idea hit me...
I got the same error "Metadata file '.dll' could not be found", and I tried several things described above, but the reason for the error was that I was referencing third-party DLL file which was targeting a .NET version higher that my project target .NET version. So the solution was to change the target framework of my project.
I added a new project to my solution and started getting this.
The reason? The project I brought in was targeting a different .NET framework (4.6 and my other two were 4.5.2).
For me, it was trying to find a DLL in a path that used to contain the Project, but we'd moved it to a new directory. The Solution had the correct path to the Project, but Visual Studio somehow kept looking in the old location.
Solution: Rename each problem Project - just add a character or whatever - then rename it back to its original name.
This must reset some global cache of some kind in Visual Studio, because this clears both this issue up and several like it, while things like Clean do not.
It looks like such kind of errors related to the fact that Visual Studio doesn't provide correct information about an error. The developer doesn't even understand the reason for the failed build. It can be a syntax error or something else. In common, to solve such problems you should find the root of the problem (for example, look at the build log).
In my case the problem was in fact that the Error List window didn't show any errors. But really there were syntax errors; I found these errors in the Output window, and after fixing them, the problem was solved.
For me it occurred when I included a new project to a solution.
Visual Studio automatically selects .NET framework 4.5.
I changed to version .NET 4.5.2 like the other libraries, and it worked.
If you have a space in your solution name, this will also cause the issue. Removing the space from your solution name, so path doesn't contain %20 will solve this.
Coming back to this a few years later, this problem is more than likely related to the Windows maximum path limit:
Naming Files, Paths, and Namespaces, Maximum Path Length Limitation
For me the following steps worked:
Find the project that is not building
Remove/add references to projects within the solution.
I was pulling my hair out with this problem also, but after trying the previous answers the only thing that worked for me was to open each project in my solution 1 by 1 and build them individually.
Then I closed Visual Studio 2013, reopened my solution and it compiled fine.
It's strange, because if I clicked each project in my Solution Explorer and tried to build them that way, they all failed. I had to open them alone in their own solutions.
In my case the issue was that I'd manually deleted a non-compilation file which was marked as "missing". Once I deleted the reference to the now-missing file and recompiled - all was well.
My instance of the problem was caused by a common project that had a duplicate class name in it (under a different filename). It is strange that Visual Studio could not detect that and instead just blew up the build process.
I got this problem in Visual Studio 2012 in a solution that had many projects. Rebuilding each project in the solution manually in the same order as the Project Build Order (right-click and rebuild in Solution Explorer) fixed it for me.
Eventually I got to one that gave me a compile error. I fixed the error, and the solution would build correctly after that.
I too had the same error. It hides as in the below path.
The path which I referred to for the DLL file is like "D:\Assemblies Folder\Assembly1.dll".
But the original path in which the assembly referred was "D:\Assemblies%20Folder\Assembly1.dll".
Due to this path name variation, the assembly could not be retrieved from its original path and hence throws the "Metadata not found" error.
The solution is in Stack Overflow question How do I replace all the spaces with %20 in C#?.
Most of the methods explained here did not solved the problem for me.
Finally, I fixed the problem by applying the following steps:
1. Close Visual Studio.
2. Delete all the contents in the bin folders of each project.
3. Open solution and rebuild.
I hit and solved this problem today on VS2022 in a solution with a Blazor project.
The underlying problem is that I had introduced a routine C# compilation error
in C# code declared in a .razor file. VS2022 was dropping the display of the error from the Build Error List tab. I found the C# error by scanning the build output in the Output console log tab where my C# error was described as expected.
p.s. In case you are wondering, I had a Unit Test project referencing my Blazor web project. The project DLL reference from the Unit Test project to the Blazor app was complaining about the missing Blazor DLL.
Based on the error message I don't believe the file path is being truncated. It looks to just be incorrect. If I'm reading the message correctly it appears to be looking for the DLL file at ...
WORK=-\Tools\VersionManagementSystem\BusinessLogicLayer\bin\Debug\BusinessLogicLayer.dll
This is not a valid path. Is it possible that you have a macro definition in the build process set to an invalid value?
I'd faced the same problem. In my case I'd referenced to a class library project with higher .Net version than my project and VS failed to build the project and raised the same error you posted.
I simply set .Net version of my class library project(the one that had broken the build) identical to the .Net version of referenced project and problem solved.
Just pointing out the blatantly obvious: if you don't have "Show output window when build starts" enabled, make sure you're noticing if your build is failing (small "build failed" error in lower left)!!!!
I had this error when I was trying to publish a web application. Turned out that one of a class properties was wrapped into
#if DEBUG
public int SomeProperty { get; set; }
#endif
but the property usage was not. The publishing was done in Release configuration without the DEBUG symbol, obviously.
Related
How to prevent Visual Studio from building the project every time?
When I right-click on a project and select Build, it builds it every time despite the fact that I just built it and the project is not out of date. I've followed the instructions in the winning answer to a similar question, but that didn't resolve my problem. I've also gone and made sure that Options/Project and Solutions/Build and Run settings were all correct. I turned on Detailed build output but didn't see anything obvious. The output is here: Part 1 and Part 2. The project itself if here. The only thing that's suspicious is the following: 1>Project file contains ToolsVersion="4.0". This toolset may be unknown or missing There is no ToolsVersion=4.0 in the project file.
Answering my own question in case anyone runs into a similar problem. The problem was that some files in the project (binaries and other non c# files) were set to Content/Copy Always. I changed them to Content/Copy if Newer and that fixed the issue.
The "ResolveLibraryProjectImports" task failed unexpectedly
I have a Xamarin project, which is based on MvvmCross. The project is for both iOS and Android. I opened this project in Visual Studio 15. I got some errors, which I solved in no time. There are some errors, which are stuck and I couldn't solve them even after searching on Google and on Stackoverflow. I have tried each and every method found on Stackoverflow, but still all remaining errors are there. This project is using 3rd party libraries like RestSharp and BoxApi.V2 (few more) I am posting my error log below. Severity Code Description Project File Line Suppression State Error The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'RestSharp(Android), Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'RestSharp(Android).dll' at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName, ReaderParameters parameters) at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName) at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.GetAssembly(String fileName) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() BoxApi.V2 (Android) This error is repeating for all projects included in this solution. So I am getting this error multiple times. I also want to add that the project was previously built on MAC and I am using windows, does this make some compatibility or cross OS issue? I have checked all assembly references and all are working fine.
I've literally just had this with a brand new Xamarin.Forms application in Visual Studio 2017. The root cause appears to be that I let VS2017 create the project in it's default location 'C:\Users\Dave\Documents\Visual Studio 2017\Projects' and this has resulted in one of more files now having a path which it too long. I moved the solution to the root of my D drive and it builds without any problem.
Your issue is most likely linked to this post on the Xamarin forums, and this bugzilla entry. Without a reproducible sample, all I can advise you try is: Updating Xamarin for Visual Studio, Xamarin.Android, and Xamarin.iOS to the latest stable versions Cleaning and rebuilding Deleting all of the bin and obj folders from your project directories Restarting Visual Studio/your PC Failing all of that, there's not likely to be anyone who can help you without a reproducible sample and potentially your Xamarin logs.
edit your android project file (csproj) like below this issue topic may guide https://github.com/xamarin/AndroidSupportComponents/issues/51
Had same problem. Here is my solution Restart Visual Studio Open the Project Clean the solution Rebuild the solution Close solution Reopen the project
I'm working with XAML (.xaml) and code-behind file (.xaml.cs). My issue was that I had the same page name, but under different namespaces. The XAML and the code behind file didn't match together. So finally it was an issue with my XAML, because of course it couldn't find the view element.
Well for me the problem was in my xaml file... Somehow while setting the Layout bounds i used '.' as a separator instead of ',' e.g AbsoluteLayout.LayoutBounds="0.5.0.3,1,0.3" should have been AbsoluteLayout.LayoutBounds="0.5,0.3,1,0.3" Hence changing the '.' to ',' solved the problem
This happened to me when I accidentally installed nuget packages in a class library that was included in the solution. I just had to uninstall the packages from the class library project.
In my case, this issue came with another related to my xaml. I had to solved the second in order this error dissapear. I clean up the class with a new default content and then clean all projects and solution. By last, close visual studio, open it , run the project and It works know .-.
This is still a fresh problem, after all attempts i wanted to try to shift the code to a shorter path - however that is lot of work as svn management will get complicated, so i wanted to first verify if path is really an issue, one way to do this was to check where the android SDKs are stored. I am on mac and the investigation revealed that SDKs path was longer than my project path. Plus i tried with a fresh project, and that was compiling correctly. So i dropped the idea of shifting. Instead i used svn and compared what has changed since last correct build. The comparison revealed that the project file of droid was somehow referring to the project file of iOS, it seems like some bug of Visual Studio. So i reverted the changes and than all got back to normal.
i get the same error and i usually solve this by closing all other opened xamarin solutions and there is one more way i had solved this issue -> go to taskmanager and find MSBUILD Service and end that service -> clean your solution -> Rebuild
We have encountered this too, it appears to be some type of race condition when building multiple projects and a very deep/complex dependency tree (our example has over 100 projects). The only way we've been able to resolve this (beyond continually rebuilding) is to disable Visual Studio 2017's Parallel Build Abilities (Tools->Options->Projects and Solutions->Build and Run->"1" Maximum number of parallel project builds). The problem appears to be in ResolveLibraryProjectImports.cs (https://github.com/xamarin/xamarin-android/blob/93ddf96f86710ad848d5189858567dd7fe964579/src/Xamarin.Android.Build.Tasks/Tasks/ResolveLibraryProjectImports.cs) there is most likely a race condition with their logic to shorten up the file names. There are zero tests around this which means there is most likely some dodgy code. I am going to attempt to dig more and get an issue opened up on GitHub but finding a reliable repo is probably going to be very difficult.
This worked for me: Clean solution Build one project at a time starting at the top - NOT rebuild solution - just one project at a time Try deleting the contents of Obj and bin folder as well When done delete the project from the emulator or device before you run it again Hope this helps.
Still have issues ? Check your namespaces and your xaml code. Sometimes when you copy/paste some files, it can be the problem.
Not sure if it will help anyone of you. For my case, I comment the erroneous class (eg. those with missing references), and it will start to pick up everything and build again.
In my case, I just forgot to delete the clicked event in XAML that doesn't exist in my code behind(cs file). After that, I just clean and rebuild. I think that error was caused by not updated references.
It's probably an issue with your references / reference assemblies? If you look under each project's references folder in the solution explorer, any references that visual studio cannot find, delete and re-add them (right click reference folder to add).
I have Faced this issue a thousand times its actually a very simple thing when you create a new project visual studio creates it in C:Drive in its default folder all you have to do is move your project out in some other Drive Like D:, E: whatever just make sure to keep it in the root of your Drive i.e. If you move it in D: Then place it like this D/Project/solutionFile
Here is the problem: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. Try to move you project to another location like "C:/" , or change the name of the project for something more brief
I encountered the same issue and none of the solutions above worked. After noticing and error on the list regarding Cryptography I knew it had to be related to FIPS being enabled (required by a VPN client) By disabling FIPS and restarting Visual Studio the issue was resolved.
I had this error as well. In my situation it was accompanied by Xamarin.Forms.Maps not importing into the one of the xaml.g.cs files correctly. I had all the using statements correct. The IDE was showing no errors but it kept telling me that Xamarin.Forms did not have a name space Map. It was generating in MapPage.xaml.g.cs as Xamarin.Forms.Map instead of Xamarin.Forms.Maps.Map and I couldn't force a fix manually. It turned out though that the suggested xmlns:maps for maps was causing the problem. The IDE had told me to use "http://xamarin.com/schemas/2014/forms" but the correct namespace is "clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps". After I changed this it was able to build my App1.dll
This was how I got the error. In a StackLayout I put in a Padding property, and I seperated the 4 digits by a space rather than a comma. To find the bug I had to comment out the XAML controls individually and rebuild to isolate where the error is, and eventually I found the problem line. So basically this was the error message I got for a syntax error in my XAML code! In any other language I would expect to be informed what the error is so I can fix it in seconds. But this took me a few hours - although next time I know what to do.
This kind of issue may also come if by mistake you have any syntactical error like in my case: two text cells were present in the ListView - <ListView x:Name="ProductsView"> <ListView.ItemTemplate> <DataTemplate> <TextCell Text="{Binding ProductId}" /> <TextCell Text="{Binding ProductDescription}" /> </DataTemplate> </ListView.ItemTemplate> </ListView> I went through other posts for this issue and found the same issue occurred due to the presence of syntactical errors, which VS doesn't report directly. So look for this, otherwise, reinstall the compatible version of xamarin.forms -> clean solutions -> rebuild by reopening VS.
I have faced the same problem today. After two days searching, I have found the solution here. The issue is Xamarin.Forms library does not install all its dependent Nuget packages while first creating project by choosing cross-platform Mobile(Xamarin.Forms) project template from Visual Studio 2017. I have to manually install the upgraded dependent nuget packages to build the project successfully. Also have removed and added Xamarin.Forms at the end which resolves the issue. Also, it is some time creating issues when two instances of Visual Studio 2017 is running, make sure only one instance is only running as I have encountered this issue as well.
xmlns:maps="clr-namespace:Xamarin.Forms.Maps; assembly=Xamarin.Forms.Maps" The problem was because of the space between the semicolon above and the assembly as stated above. As soon as the gap is closed, it compiles.
Shorteninig the path(folder names) to the solution solved it for me. For example : the path was : C:\Users\Username\Downloads\Compressed\ListView-GettingStarted-in-Xamarin-Forms-master\ListView-GettingStarted-in-Xamarin-Forms-master\GettingStarted and i changed it to : C:\Users\HelloKali\Downloads\Compressed\3\2\1.
Project <PROJECT NAME> is not up to date. Missing input file 'netframework,version=v4.0,profile=client.assemblyattributes.cs
I have a sln with > 50 projects, and recently, when I moved to VS2013, every time I press F5 for a build, it will rebuild all the projects, even though I have just performed a build. The diagnostics show, that each project is marked as not up to date with the following error: Project <PROJECT NAME> is not up to date. Missing input file 'c:\users\USER\appdata\local\temp\2\.netframework,version=v4.0,profile=client.assemblyattributes.cs I have read these threads: In Visual Studio 2010 why is the .NETFramework,Version=v4.0.AssemblyAttributes.cpp file created, and can I disable this? https://social.msdn.microsoft.com/Forums/vstudio/en-US/15d65667-ac47-4234-9285-32a2cb397e32/migration-from-vs2008-to-vs2010-and-netframeworkversionv40assemblyattributescpp?forum=vcgeneral but the suggestion there is to add the following line to the proj file: <Target Name="GenerateTargetFrameworkMonikerAttribute" /> I did and it did not work. Suppressing the warning as MS suggestion will also not work as the project will remain "not up to date". I am using VS2013, C# and VB projects. With the very same project and VS2012, such error is not raised and the projects are up to date. Any suggestions? UPDATE Perhaps it is worth mentioning that I do have a few build definitions in the solution, where all of the projects are building for AnyCPU except one: http://screencast.com/t/fuw9k4IubN
I had the same problem and solved it by upgrading the ToolsVersion attribute in *.csproj files: ToolsVersion="4.0" replaced with ToolsVersion="16.0" (I’m using Visual Studio 2019, which is v16.x internally).
<Target Name="GenerateTargetFrameworkMonikerAttribute" /> Well, not a good idea, that accomplishes the exact opposite of the problem you are trying to solve. It forces MSBuild to create the AssemblyAttributes.cs file, inevitably your project needs to be rebuilt since the file is new. The Q+A you found addresses a completely different issue, these were C++ programmers that were trying to come to grips with a new linker warning in VS2010. They hate warnings that appear from nowhere from files that are not part of their project. Well, don't we all. The marked answer on that SO question is quite evil btw, that other guy posted a much better answer :) Missing input file 'c:\users\USER\appdata\local\temp\2\.netframework... There's a signal in this message, note the presence of the \2 subdirectory in that path name. That is a Big Red Flag, it is not normal. This auto-generated .cs file normally lives inside the TEMP directory, not a subdirectory of that folder. Surely this has something to do with your real problem. MSBuild doesn't do anything special and simply uses System.IO.Path.GetTempPath() to generate the folder name. That method isn't special either, it simply delegates the job to the GetTempPath() winapi function. The diagnostic therefore is that on this build machine, that OS function sometimes generates an odd-ball path, picking a subdirectory of the TEMP folder. And that it doesn't always generate the same one, thus causing your projects to getting rebuilt. There is at least one good theory for this behavior, mentioned by commenter #Darran Rowe to this blog post: No, this is Terminal Services at work. When you log in over remote desktop, Windows will set the temp directory for the logon session to %LOCALAPPDATA%\Temp\<session id> Rings a bell?
Try deleting the hidden .vs directry which is in the same folder than the solution file.
This worked for me Close visual studio and Deleted the .sou files from the projects
I was getting the same error and I solved it by removing the project from my solution and re-adding it. It is a pain because then you have to add the inter project references back in.
Why is my MonoDroid/Xamarin.Android project suddenly giving me a "'java' exited with code 1." error?
While working on my MonoDroid/Xamarin.Android app, it suddenly stopped building, telling me "java" exited with code 1. After turning on normal MSBuild output verbosity, it showed that the error occurred in Xamarin.Android.Common.targets, located in C:\Program Files (x86)\MSBuild\Xamarin\Android. The line (line 988) starts this block of xml: <CompileToDalvik JavaMaximumHeapSize="$(JavaMaximumHeapSize)" JavaOptions="$(JavaOptions)" AndroidSdkDirectory="$(_AndroidSdkDirectory)" ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes" JavaSdkDirectory="$(_JavaSdkDirectory)" MonoPlatformJarPath="$(MonoPlatformJarPath)" JavaSourceFiles="#(AndroidJavaSource)" JavaLibraries="#(AndroidJavaLibrary)" LibraryProjectJars="$(IntermediateOutputPath)__library_projects__\*.jar" UseDx="$(UseDx)" /> Also, when I have the above file open, I have 53 warnings, all similar to: The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'ResolveReferencesDependsOn' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, AllowUnsafeBlocks, ... [followed by a long list of elements] I deleted all the code that I had recently added, then ended up doing a full revert to previous code that worked, but the error continues no matter what I do. I found a resolved bug that may occur on the same line, but the solution given there didn't work for me. Also, because of the warnings and the fact that my code used to work it its current revision, it doesn't seem to be the same problem. Any ideas why this would happen, and how I might fix it? More details: I tried running a new M4A project and it worked fine, so it looks like it isn't a problem with the M4A file, but something my code. Even more details: I was going through each class, commenting them out to see if I could find a particular block that was causing the problem, when the error suddenly changed. It now displays an error identical to the one found in this question. I am also using the 30-day trial. However, I am using Visual Studio. I'll be seeing if the answer and comments there will help me too.
I had the same problem and solved it by deleting my entire solution an pulling it from source control again. If you do not have a source to pull from, then i suggest deleting all generated files such as the contents of bin and debug folders.
Yes It's a good solution I have removed same problem from my project. Step that you have need 1. Delete Bin and obj folder from project 2. Delete Solution File From Project Folder 3. Open New Visual Studio and then Click File > Open > Project/Solution > Select Folder Where placed you project. and after all, Rebuild Solution file and then rebuild your project. I am sure u will success about this problem.....
I encountered this problem on a colleague's computer. The problem ended up being that his old sdk was installed under Program Files, while the update installed it under AppData. Changing this folder under Options > Xamarin > Android in Visual Studio solved the problem for him.
I have solved by disabling the Proguard option and able to build it. Right Click on Project -> Click Properties -> Android Options -> Uncheck Checkbox of Enable Proguard.
Can't rebuild my application anymore
I'll give you 2 versions of my problem to describe it, first the short version. When I try to build my application it does that perfectly and my app works but when I try to rebuild it, that fails and gives an error message saying that 2 files are missing (bin/debug/MusicPlayer.exe and bin/debug/MusicPlayer.pdb). When I then try to build normally, it fails to with the same error. Now the longer version: The way this happened was quite out of nowhere, I program on 2 different locations (both in Visual Studio 2010 sp1) but to always have the recent version in the right place I copy the entire solution folder to a usb stick, this folder I copy over again on the other PC and use it to continue were I left off, I've done this many times without problem. Yesterday however, I got an exception while testing the app. But instead of showing this in my code, it was complaining that it could not find the program.cs file (it was there, but apparently it had a different checksum (md5) and it asked me to use this one. After a while I found what part of my code caused the exception and fixed it. Since then I haven't got that error anymore. But when I later tried to rebuild instead of build, it gave me the error described in the short version. I have tried to fix it, but apparently I was not very successful. Basically, what I think it does is delete the files in the debug folder that need rebuilding and then gives me the error of missing files (the files that it deleted) and thus failing to rebuild succesfully because these deleted files the normal build option won't work to. (What I then do is re-copy them from my usb to make the normal build work). Don't know if it's important, but I program in C# and I'm still learning. Also when I copied it to my usb I believe I had no errors and the app was working fine (except the part I fixed later, which I could not test at that location). And when I build the entire solution it gives some warning ==> "Assembly 'bun/debug/MusicPlayer.exe' is incorrectly specified as file" and this for 5 files. Does anyone know how to fix this rebuild problem and if necessary the warnings? Thanks in advance (and sorry for my bad English)
OK it seems like you might be confusing yourself with your directory structure here. If you want to add Content or Resources (Images, Text Files, etc.) you should place them in a folder within your project (not called bin or obj). All your build files will go here. Instead place the Content in another folder and Right Click -> Properties and Set the build action to "Content" or "Resource" and set the Copy to Output Directory (bin folder) to "Do not Copy" or "Copy if newer." The project is failing because you have the built executable "MusicPlayer.exe" in your project. So Visual Studio is trying to build an executable file in adding to the project. Restructure your directories or remove "MusicPlayer.exe" ever time your build your project.
Do you have any anti-virus software running? They can go way too aggressive on removable drives. You are actually continuously deleting and creating a runnable program on usb stick by recompiling. Just a guess tho...
Sounds to me like you have a pre- or post-build event with a hardcoded path in it. Fix that using variables and it should be ok.