Cant Build c# asp.net mvc application - visual-studio-2010

When I try to build the application i get:
Error 1 Unexpected error reading metadata from file 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll' -- 'Index not found.' NHMDLive.Models
I cant figure out what the problem might be. I have checked the mscorlib.dll and did a checksum and it is not corrupted. Must be something else.

you can't code for the version 4 of dotnet with vs 2008.
You will have either to upgrade to VS 2010, or use 3.5 or less version of assemblies

Related

Libjna build - LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

I'm re-posting an issue from github (https://github.com/libffi/libffi/issues/538) I had since last week.
I'm currently having issue getting some JNA libraries built as jar deployables using Ant build script (FYI: https://github.com/thepaul/libjna-java). in order to use the APIs from this library for my other project. (The sole purpose of me going through the hassle building it is to be able to use its API. Due to lack of documentation and absence of existing build artifact provided, I had to do it myself. Importing the whole libjna repo as a project into my other project maybe another approach but I don't think it's appropriate. That said, if there're any better ways to use the libraries in libjna, do let me know!)
So here's what I did trying to build it into deployable jar file:
I already have the source project downloaded.
Tried to compile using Ant (which I downloaded the latest version) on cygwin. Failed because it requires libffi.
So I downloaded libffi source from here (https://github.com/libffi/libffi).
Tried to compile again using Ant. Failed because it couldn't find "/c/Program Files (x86)/Microsoft Visual Studio 9.0/vc/bin/cl" as mentioned in the config.log
So I inspected cc.sh and found that it refers to an older version of Microsoft Visual Studio. I have an existing installation of Visual Studio Express. So I changed the path to "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64" in cc.sh file.
Tried to complile again using Ant. Seemed the fix worked but failed with different error because it couldn't find "mspdbcore.dll". I found this file in "..\x86" so I copy the file across to ..\x64
Tried to compile again using Ant. Failed with similar error but different file because it couldn't find "mspdb140.dll". I found this file in "..\x86" so I copied over
Tried to compile again. Failed with different error because now it says
"LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'"
, although I could confirm this file is definitely in "C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64"
To tackle this error I tried (in vain):
adding microsoft visual studio paths to PATH
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\bin\Hostx86\x64
C:\Program Files (x86)\Microsoft Visual
Studio\2017\WDExpress\VC\Tools\MSVC\14.16.27023\lib\x64
C:\Program Files (x86)\Microsoft Visual Studio\2017\WDExpress\Common7\IDE
Downloaded MS Visual Studio 2019 both Community and Professional (couldn't find those dlls for some reason)
Downloaded both mspdb140.dll and mspdbcore.dll separately, config.log says it can't find these files
Note I also did some research online, however:
I don't use visual studio IDE as I"m only trying to build it with Ant, so this post didn't really help much (LINK: fatal error LNK 1104: cannot open file 'LIBCMT.lib')
I don't really understand the answer to this post either (https://social.msdn.microsoft.com/Forums/en-US/cbedc1ba-c50b-499e-aa2e-12b0ce6a40ba/lnk1104-cannot-open-file-libcmtlib?forum=vclanguage)
So this is where I'm stuck.
See latest config log attached.
config.log
Also Ant build log attached.
ant_compile_error.txt
Anyone can help would be much appreciated!
Cheers
Dale

Build failure in Qt 5.8 project in VS2015 community edition

I got this error while building a Qt 5.8 project in Visual Studio 2015 community edition, and am unable to resolve this.
1>------ Rebuild All started: Project: analogclock, Configuration: Debug Win32 ------
1> Generate moc_predefs.h
1> Reading Qt configuration (D:\Qt\Qt5.8.0\5.8\msvc2015\bin\qmake.exe)
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error : The source file for this compilation can be found at:
"C:\Users\Dan\AppData\Local\Temp\25ee8a4c-842c-4329-96bc-cd757b4f3616.txt"
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB3758:
An error has occurred during compilation. warning CS1668: Invalid search path 'Lib\um\x86'
specified in 'LIB environment variable' -- 'The system cannot find the path specified. '
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB3758:
An error has occurred during compilation. c:\Users\Dan\AppData\Local\Temp\qmousnkh.0.cs(88,26) : error CS1061:
'System.Collections.Generic.IEnumerable<string>' does not contain a definition for 'ToHashSet'
and no extension method 'ToHashSet' accepting a first argument of type 'System.Collections.Generic.IEnumerable<string>'
could be found (are you missing a using directive or an assembly reference?)
1>C:\Users\Dan\AppData\Local\QtMsBuild\qt_vars.targets(246,5): error MSB4036:
The "GetVarsFromMakefile" task was not found. Check the following:
1.) The name of the task in the project file is the same as the name of the task class.
2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface.
3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks
files located in the "C:\Program Files\MSBuild\14.0\bin" directory.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I had the same error and I hope my solution can help you (despite of that almost one year passed from time when you asked:-)) or others having it. Shortly - try to update .Net Framework at least to version 4.7.2.
After some investigation I found that QT VS Tools use pieces of C# code in custom build scripts. One of them is GetVarsFromMakefile in file qt_vars.targets. I copied this code to new C# project, added missing variables and had the same error as during compiling of QT project: 'System.Collections.Generic.IEnumerable' does not contain a definition for 'ToHashSet'... The problem was that this method was added to the mentioned class only at .Net 4.7.2 (https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ienumerable-1?view=netframework-4.7.2) and I had .Net 4.6. Probably during install of newer versions of Visual Studio newer .Net version is installed automatically, but I have VS 2015. After updating to latest .Net version (I tool 4.8) this issue has gone.

May I get help resolving Package reference for .NET 4.7.2 Project?

2/3 of projects in a solution I have is running on .NET 4.7.2, the other project is a reactJS project running on .NET Core. The other two run well except one of the .NET 4.7.2 projects which seem to be trying to call packages that are not compatible with the project. The file it keeps hanging up on is the System.Threading.Tasks.Extension. The current version it is stuck on running is 4.5.2, of which I cannot downgrade and seems to not be compatible with .NET 4.7.2. I noticed that from the build logs. Here one line from the output file which seems to stand out to me:
Unified Dependency "System.Collections, Version=4.0.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Using this version instead of original version "4.0.0.0" in "C:\project\packages\System.Threading.Tasks.Extensions.4.0.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll" because there is a more recent version of this framework file.
Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.2\Facades\System.Collections.dll".
(ResolveAssemblyReferences target) -> C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "System.Threading.Tasks.Extensions" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed.
When the browser comes up this error is shown:
Could not load file or assembly 'System.Threading.Tasks.Extensions' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have been looking around at solutions which include meddling with the .csproj, web.config or package.config and not successful.
My goal is to have the project run successfully and resolve this conflict. Any help in resolving this issue would be greatly appreciated.
This was resolved by cleaning out all the packages and readding one by one.

Migrating code from VS 2005 to 2013 causes error LNK1104 error?

I'm attempting to migrate a solution file from VS 2005 to VS 2013. The majority of the projects within the solutions rebuilt just fine.
However, some of the projects are coming up with the error:
error LINK1104: cannot open file 'mfc80.lib'
I have searched for mfc80.lib on my computer and it does not exist.
I cannot follow the solution from here fatal error LNK1104: cannot open file 'gdi32.lib' because the file does not exist, therefore I cannot add its path in "Additional Library Directories".
I have:
Deleted all the .obj and .lib files for the problematic project
Ensured Visual C++ MFC MBCS Library for Visual Studio 2013 is installed
Followed Error LNK1104 cannot open file ';.obj'
What else do I need to check?
Thanks.
It appears your project is attempting to include mfc80.lib explicitly. This is the version that VS2005 used; you need mfc120.lib.
Also, double-check that none of your source has a declaration like the following: #define _MFC_FILENAME_VER

MVVM Light obtained via NuGet - RelayCommand.cs not found

My program incorporates a copy of MVVM Light via NuGet. Up until about 5 minutes ago it worked without a hitch, but now I'm getting an error saying "RelayCommand.cs not found". Since I got the package from NuGet, I don't have RelayCommand.cs itself, just the dll. I have tried uninstalling and reinstalling MVVM Light and the problem persists. Right now I really am at a loss. If anybody could help me fix this so that I can continue working I would greatly appreciate it.
Locating source for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'. Checksum: MD5 {9c e1 3c 59 78 15 34 23 2b e 9b 39 ef 5d eb d0}
The file 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs' does not exist.
Looking in script documents for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'...
Looking in the projects for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: d:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs.
The debugger could not locate the source file 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'.
Update: At this point I'm thinking that this is a problem with VS. I downloaded the dll files manually and referenced them and I'm still getting the same error. I'm thinking it might just be worth it to make a new project and migrate my data. If anybody has any ideas on how to fix this, though, I'm all ears.
Update: I don't know if this could be the issue, but it appears that the program is looking for MvvmLight (NET35). The version I obtained (and had working up until now) is WPF45.
Update: When I open packages.config in my solution, I get a warning that says "The 'packages' element is not declared." Could this be relevant?
Got just the same Problem with Galasoft and found your post. - Finally I figured it out, or at least the error no longer pops up:
Go to Tools-Options...-Debugging-General and tick Enable Just My Code and the error disappeared. I assume MVVM-Light is compiled in Debug Mode and now Visual Studio Looks for the MvvmLight pdb and cs file which are of course not there when installed via nuget.
I don't know why this would cause such an error, but I believe it was caused by trying to read in data from a file that didn't exist. I removed that code and the error went away.
When I got this error it was because of an invalid cast exception. I had this:
MyCommand = new RelayCommand<int>((i) => MyMethod(i));
But the property I was Binding in my XAML was a long. I changed it to this and it worked:
MyCommand = new RelayCommand<long>((i) => MyMethod(i));

Resources