Receiving Build Error When Trying To Build EFModel - c#

As the title says, when I am trying to build the DLL for my EF model, I am receiving the following build error:
Error 9 An Exception was thrown while processing the template. The following Exception was thrown:
System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
at Microsoft.VisualStudio.TextTemplating.IDebugTransformationRun.get_Errors()
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessTemplateImplementation(TemplateProcessingSession session, String content, ITextTemplatingEngineHost host, String className, String classNamespace)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToSQL10.tt 0 0 Miscellaneous Files
I am using Entity Framework version 6.1.3 and the odd thing is that I have another copy of the same project elsewhere in my solution and it does not get this error.
Does anyone have any suggestions on how to fix this build error?

After looking around elsewhere, I developed a hunch that the problem was being caused by my Entity Framework installation. I went ahead and opened up the NuGet Package Manager console and ran the command:
Update-Package –reinstall EntityFramework.
After waiting for EF to reinstall, I restarted Visual Studio. Upon restarting I was able to build my EF Model project without any errors. Hopefully this helps anyone else who runs into the same problem.

Related

while VSbuild task getting error error MSB4057: The target "_IsProjectRestoreSupported" does not exist in the project.,

Working on wpf application, with Wix to create .msi. why am i getting error
D:\a\1\s\wpfsetup\wpfsetup.wixproj : error MSB4057: The target
"_IsProjectRestoreSupported" does not exist in the project
using msbuild version '17.2.1.25201
NuGet Version: 4.4.1.4656
Please check if the below steps help to fix the issue:
As per my research, it seems to be many bug fixes in every alternate version of the MS Build like 15.8.1, 16.11, etc.
There are some breaking changes and behavior changes mentioned in the MSFT official documentation of MSBuild 17.0. Please check this documentation to know more information if these changes with their resolutions helps to fix the issue.
And it might be the folder path in the build was wrong. Target Name must include the name of the solution folder. Refer this.
Try Restoring the MSBuild Nuget Package Version using this command:
nuget restore MySolution.sln -MSBuildVersion 16.11

Weird error: Microsoft (R) Visual C# Compiler version 3.5.0-dev-20359-01 (8da8ba0c)

I have a Unity 2020.3.22f1 project that was perfectly working at first. However, this error occured after editing and saving one of my scripts in Visual Studio (with no apparent bug in it):
I don't give details about my script or the project, because it doesn't seem to relate to the project itself or what I did, as the error appears now in all my Unity projects! I first tried to delete the script that triggered the bug, then I deleted the whole project. I even uninstalled/reinstalled Unity (different versions), Visual Studio and Unity Hub. But it seems that now I'm stuck with this forever.
Does anyone have a single clue about this? I saw one or two people having the same problem on the web, and with no other solution than formatting the hard drive. As I'm not working on my personal computer, I can't do that...I mean, there must be a rational explanation to this bug!!
I downloaded the latest version of Unity (2021.2.2f1), launched a brand new project, and the error now turned to: "The specified path can't be found" (rough translation from french), without more precision...still no idea what it means.
Ok, I found a solution from here: Unity 2019.3.0a7: Microsoft Visual C# Compiler Errors
I don't know how it's related, but it is suggested that the error can be triggered by uninstalling Anaconda and Python (which I happened to do recently), which leads to remaining artifacts in the Windows registry. I then deleted the following item in the Windows registry:
Computer\HKEY_CURRENT_USER\Software\Microsoft\Command
Processor\AutoRun
and restarted Unity. Now it works!
Got the same issue, the problem is in an incomplete path
Command line is : "C:\Program Files\Unity\Hub\Editor\2022.1.0a13\Editor\Data\Tools\netcorerun\netcorerun.exe" "C:/Program Files/Unity/Hub/Editor/2022.1.0a13/Editor/Data/Tools/ScriptUpdater/ApiUpdater.MovedFromExtractor.exe" "Library\Bee\artifacts\mvdfrm\UnityEngine.LocalizationModule.dll_9374ECE80455BEFE.mvfrm" "C:\Program Files\Unity\Hub\Editor\2022.1.0a13\Editor\Data\Managed\UnityEngine\UnityEngine.LocalizationModule.dll"
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\damos\project name is missing here\Library\Bee\artifacts\mvdfrm\UnityEngine.LocalizationModule.dll_9374ECE80455BEFE.mvfrm'.
This path is missing the project name between damos ans library

Issue with nuget package Xamarin.Firebase.iOS.CloudMessaging 3.1.2

I get many error messages if I install the Xamarin.Firebase.iOS.CloudMessaging 3.1.2 nuget package.
Error: linker command failed with exit code 1 (use -v to see invocation)
Error MT5210: Native linking failed, undefined symbol: _FIRLogBasic. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
Error MT5211: Native linking failed, undefined Objective-C class:
FIROptions. The symbol '_OBJC_CLASS_$_FIROptions' could not be found
in any of the libraries or frameworks linked with your application.
Error MT5211: Native linking failed, undefined Objective-C class:
GULAppEnvironmentUtil. The symbol
'_OBJC_CLASS_$_GULAppEnvironmentUtil' could not be found in any of the
libraries or frameworks linked with your application.
Error MT5201: Native linking failed. Please review the build log and
the user flags provided to gcc: -ObjC
Error MT5202: Native linking failed. Please review the build log.
I tried uninstalling and reinstalling the nuget package but I still get the same errors.
I use Visual Studio Community for Mac 8.1.5 (build 9).
I need Xamarin.Firebase.iOS.CloudMessaging because I follow this tutorial: https://www.robbiecode.com/setup-push-notifications-with-firebase-in-xamarin-forms-for-ios/
What is wrong with my project? What can I do?
The following two projects are in my solution:
InapppurchaseTest.iOS, MonoGame.Framework.iOS (develop)
Well, this is a well-known issue with Firebase and Xamarin, what basically happens here is the old bin and obj files while interacting with the new data override some existing files that are needed by iOS to synthesize the IPA while deployment and hence ends up throwing linking RELATED errors, follow the below steps and it will clear this mess.
Clean bin and obj
Delete the builds in the following path of your MAC machine - ~/Library/Caches/Xamarin/mtbs/builds/ProjNAME where 'ProjName' is the name of the project you are currently working on
Once you are done with both the above steps add the Xamarin.Firebase.iOS.CloudMessaging package and change linker setting to Don't Link (this is for the time being)
After installing these packages see to it that you build your project dependency wise which means PCL'S and .Net standards first then the native iOS project.
Clean bin and obj again if it does not work for the first build...
This should solve your issues in case it does not repeat the above procedure.
EDIT
If you check the GitHub comment by SotoiGhost here, it says adding the below line anywhere in your project should solve this issue...
var foo = Firebase.Core.Configuration.SharedInstance;
Feel free to get back in case of issues
Good luck!

System.Management.Automation dll throws ItemNotFoundException on Appx calls

I have a very strange issue. I have added a reference to System.Management.Automation in my project and I am trying to call the following code:
using (Powershell ps = Powershell.Create())
{
ps.AddScript("Get-AppxPackage");
ps.Invoke();
}
Note that I can run other powershell commands in this way fine, it is only the Appx commands that are raising an exception. Running the Get-AppxPackage command results in an ItemNotFoundException. The error is:
Exception thrown: 'System.Management.Automation.ItemNotFoundException' in System.Management.Automation.dll
Additional information: Cannot find path 'C:\Users\xxxx\Documents\WindowsPowerShell\Modules' because it does not exist.
My first assumption was that this may be a working directory thing, so I explicitly set the working directory before calling the command, but that did not change anything. I then checked, and that directory did not exist, so I created it just to see what would happen. After creating the directory and running the code again I got this error:
Exception thrown: 'System.Management.Automation.ItemNotFoundException' in System.Management.Automation.dll
Additional information: Cannot find path 'C:\windows\system32\windowspowershell\v1.0\Modules\Appx\Microsoft.Windows.Appx.PackageManager.Commands' because it does not
I honestly have no idea what is going on here. To make the issue even stranger, I tried this on another computer and the code works fine. So there must be something wrong with Visual Studio or my project on that one computer.
I've tried deleting the debug and obj folder, the suo and all of that. I've removed the reference to System.Management.Automation and re-added it, even rebooting in between. I am at a loss, I have no idea why this is happening or what else I can do to figure it out.
Note: I am able to run the Appx commands in Powershell ISE fine, so there is no issue on the computer. The problem is only with calling that command through the System.Management.Automation dll.
Any help would be greatly appreciated.
OK, it appears that this issue was caused by installing the incorrect version of System.Management.Automation as a nuget package via the package manager. I had uninstalled this and then added a reference to the latest version of the DLL manually before I started getting the issue described above.
But the uninstall for the nuget package clearly didn't work properly as the project continued to reference this version, and nothing I tried could get it to use the new one.
To solve the issue, I created a new project, added the source files, added a reference directly to the new version of System.Management.Automation and the error stopped occuring.
I can only assume that the installing and uninstalling the wrong version with the package manager corrupted the first project.

TFS 2013 Throws Lib2GitSharp Error During Build/Deploy (Intermittent)

For a while now, I have been having an issue with Team Foundation Server build/deploy process throwing the following error intermittently:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at LibGit2Sharp.Core.NativeMethods.git_threads_init()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject..ctor()
at LibGit2Sharp.Core.NativeMethods..cctor()
--- End of inner exception stack trace ---
at LibGit2Sharp.Core.NativeMethods.RemoveHandle()
at LibGit2Sharp.Core.NativeMethods.LibraryLifetimeObject.Finalize()
Exception Message: MSBuild error 255 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException) Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
This problem is very intermittent and it can be bypassed by simply retrying the build. Has anyone else run into this? Any solutions?
I know it is a little bit late for answer but it might help someone else
answer by Buck Hodges
We have now gotten to the bottom of this issue after debugging it with Manoj and customer support. It affected gated checkin of continuous delivery of Azure deployments as part of the build process when using the Azure SDK 2.5 or older. The workaround is to add /p:GenerateBuildInfoConfigFile=false to the msbuild arguments in your build definition. We are working on updating the build VM in production, but that will take 24-48 hours to propagate to all build pools.
You might want to read more in context here
https://social.msdn.microsoft.com/Forums/en-US/5a0d1950-1367-41a6-9171-676a0d0e93c1/tfs-online-getted-checkin-build-failures-vs-online-tfs-online-team-need-to-look-into-it?forum=TFService
Alternative solution based on comments
If you have VS installed on your build server, make sure you have opened it and licensed it. by #Phill
Strangely enough for me, I was getting the same error in the build logs:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\BuildInfo\Microsoft.VisualStudio.ReleaseManagement.BuildInfo.targets (147): The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception.
Unhandled Exception: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
I was able to simply RETRY the build, and it did not fail on the second try. So for me it was a transitory build issue.
Although late to the party, experienced this error recently and while the solution marked as the answer worked for that build, the error was fixed (and the switch removed) when Visual Studio 2012 was upgraded to Visual Studio 2015 Update 3 on the build server which was running TFS 2015 Update 3.
I hit this after I had upgraded my TFS 2013 XAML build machine to TFS 2015.
I had also changed the user that TFS 2015 XAML build used to run the build (service.
The Fix:
I had to log into the TFS 2015 XAML build machine as that new user and launch VS (I was using VS2013).
It ran through it's first time launch questions and setup.
I still saw the Lib2GitSharp Error issue sometimes after that.
Then I also logged VS (on the TFS 2015 XAML build machine) into a valid VS account.
I have not seen the Lib2GitSharp Error since and I never used the /p:GenerateBuildInfoConfigFile=false option.
I resolved this error by adding the build account to the local administrators group on the build machine.

Categories