Visual Studio 2015 Error "Cannot resolve Assembly or Windows Metadata file 'Windows.winmd'" - windows-phone

I have a project, on another PCs can build it.
But my main pc can't.
Errors:
1: "Cannot resolve Assembly or Windows Metadata file 'Windows.winmd'"
2: "Type universe cannot resolve assembly: Windows, Version=255.255.'255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime."
I tried reinstall the WIN10 SDK and the VS2015, but the errors are same.
It is an Universal Store App.

I could solve the problem. I uninstalled all SDK, all VS, all developer tool. After reinstall the VS can build my project.

Related

How to use Regasm.exe to register a COMl for an ASCOM project

I am trying to build a simple solution but always get the following error:
Severity Code Description Project File Line Suppression State
Error The assembly 'ASCOM.DeviceInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=565de7938946fba7' is not registered for COM Interop. Please register it with regasm.exe /tlb. ASCOM.ML16200.DeviceClass1
Error The assembly "C:\Users\tonyb\source\repos\ASCOM.ML16200.DeviceClass1\ASCOM.ML16200.DeviceClass1\bin\Debug\ASCOM.ML16200.Camera.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'ASCOM.ML16200.Camera, ASCOM.ML16200.Camera'. Error: Error loading type library/DLL. ASCOM.ML16200.DeviceClass1
I've tried using the following command within Visual Studio Powershell, but it always fails:
PS C:\Users\tonyb\source\repos\ASCOM.ML16200.DeviceClass1> regasm.exe ASCOM.ML16200.Camera.dll /tlb
Microsoft .NET Framework Assembly Registration Utility version 4.8.4084.0
for Microsoft .NET Framework version 4.8.4084.0
Copyright (C) Microsoft Corporation. All rights reserved.
RegAsm : error RA0000 : Unable to locate input assembly 'ASCOM.ML16200.Camera.dll' or one of its dependencies.
PS C:\Users\tonyb\source\repos\ASCOM.ML16200.DeviceClass1>
Can anyone please tell me how to properly register this .dll?
I can assume that this will help you:
1. Run Visual Studio as an administrator. And try to rebuild the project, then start debugging (so Visual Studio will try to register the .dll file). This method worked for me on Visual Studio 2015.
But when developing a driver for Focuser in Visual Studio 2019, this method did not work for me.
My screenshot Focuser error registration
2. Registering ASCOM .dll file in manual mode:
Open Developer Command Prompt as Administrator
Now using the regasm tool, register the .dll file
My screenshot example, manual register
Now you can start debugging the .dll file.
P.S.
Do not forget, you cannot debug .dll files directly, use other applications for this. For example ASCOM provides ready-made templates for such applications

msbuild GenerateDepsFile fails

All my projects are not failing to build on my Azure DevOps MacOS build host. It's a self-hosted build host. Suddenly, my projects are throwing this error when trying to build:
error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
error MSB4018: System.MissingMethodException: Method not found: System.Collections.Generic.IList`1<NuGet.Packaging.Core.PackageDependency> NuGet.ProjectModel.LockFileTargetLibrary.get_Dependencies()
I found this GitHub issue which seemed similar, but the posted solution didn't help me:
https://github.com/mono/mono/issues/13537
As mentioned in xamarin/xamarin-android#3155 this is caused by a version mismatch in nuget between msbuild and dotnet core. The solution is to update your dotnet core install to the latest stable version
I've installed the most recent .NET Core, and updated Visual Studio for Mac, but alas, the problem remains.
Another information:
When I build the same Xamarin.iOS project from my Windows machine coupled with the same MacOS build host, the app builds just fine. But I am guessing the process is probably different.
Updating both Visual Studio for Mac and .NET Core SDK again today seems to have fixed the problem.

Could not load file or assembly 'Microsoft.Owin in Visual Studio

I've got a fresh Visual Studio 2017 installation with a fresh .NET Core 2.0 installation. I've created a .NET Core 2.0 Web project in Visual Studio. Now, when I try to do almost anything in that project (try to open site.js, try to add some files to wwwroot, try to open site.css etc) I get this error:
Could not load file or assembly 'Microsoft.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
This is a fresh install of Visual Studio 2017, fresh install of .NET Core, and a fresh, untouched project with default settings. What am I doing wrong?
Restarting Visual Studio fixed it. Duh.

Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35'

In Visual Studio 2012 I created an ASP.NET MVC 4 project where the target framework is the .NET Framework 4.5. When I deployed my project to a web server it gave the following error:
Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file
specified.
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where
it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or
assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified.
Source Error:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237
I had the same issue today during deployment. I was able to fix it by marking the assembly to be copied to the deployment file.
In order to do this, in my Visual Studio project, select the System.Web.Http.Webhost assembly in your references and alter the 'Copy Local' property to True. I had to repeat this for a few other assemblies that were missing.
Thanks to this website for the tips - http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx/
Check the bin folder of your deployed project. It should contain System.Web.Http.WebHost.dll.
If this dll is in this folder, check it version. If it isn't 4.0.0.0, then you should deploy version 4.0.0.0 or change your web config to use other version (not really good idea because of dependencies)
Try to reinstall Microsoft.AspNet.WebApi package. Open Package Manager Console and type:
Update-Package Microsoft.AspNet.WebApi -reinstall
Be careful, this command will remove all dependencies and you will have to install them manually.
I had this error with an old project that I was going back to do a bit of work on. It turns out the project wasn't actually using WebApi so I uninstalled Microsoft.AspNet.WebApi using NuGet. That solved the problem for me.
If I'd actually have needed WebApi I'm sure installing it again would have fixed the error too.
I ran into this today after setting up a new Team City Build Agent. The new agent didn't have MVC 4 installed, perhaps part of the problem. Fortunately, I found this article which lead me to the solution. In Team City, I just updated the Build Step for the Nuget Restore so that it doesn't use the local cache.
This works because the cache may have been established by build runners with different (MVC) frameworks installed already.
I know this is answered but I thought I'd add something.
Every time I set "copy local" to true on a file causing the error I'd publish it and just get another one. So I just selected all of the files under references and set them all to true. This fixed the issue for me.
Important: This error message can be caused because you are deploying a 4.5 project to a server that doesn't have 4.0 installed. Make sure you have the .NET Framework version installed in IIS for the project you need. Some of these DLLs by default won't copy up, because it uses the core project DLL normally. Check to make sure your production server has the .NET version you're going with. I experienced this myself with a 4.5 project on a 4.0 server.
Ensure ASP.NET MVC 4 is installed on your server. Check it in the following location -
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4

Problems with builds on TFS 2010 and resolving dependencies

I have a project that works great on my machine (and production servers).
It's a VS2010 project running C#3.5.
When letting my build server build the solution it can't resolve a couple of my third party dll's.
Error message:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3268: The primary reference
"Third.Party.Assembly,
Version=50.11.2.0, Culture=neutral,
PublicKeyToken=0561a7c6dbd6f0ea,
processorArchitecture=MSIL" could not
be resolved because it has an indirect
dependency on the framework assembly
"Microsoft.VisualBasic.Compatibility,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which
could not be resolved in the currently
targeted framework.
".NETFramework,Version=v3.5". To
resolve this problem, either remove
the reference "Third.Party.Assembly,
Version=50.11.2.0, Culture=neutral,
PublicKeyToken=0561a7c6dbd6f0ea,
processorArchitecture=MSIL" or
retarget your application to a
framework version which contains
"Microsoft.VisualBasic.Compatibility,
Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
[d:\Builds\3\mySolution.sln]
Everything compiles and runs great on my machine, but the build server seem to struggle.
I think the Third.Party.Assembly is written in VB.net.
Since the assembly is third party I can't remove the reference to "Microsoft.VisualBasic.Compatibility" and since I don't get any warnings on my computer could it really be that I'm running v3.5?
Any suggestions?
/Jimmy
If you put your project on the build server manually will it run? Based on the error message, I would make sure you have the latest .net framework installed on the build server machine and give it another try. If that does not work try installing VS2010 on the build server just to get the builds running until you find out just exactly what assemblies you are missing.
So, I was having this issue also on a VS2005 project that we upconverted... The issue is that MS has never had a 64-bit version of the VisualStudio.Compatability DLL. Our issue was that we were targeting 'Any' CPU and building on a new W2008R2 server so it was using the 64-bit version of the .NET 4.0 Multi-targeting pack.
In the build properties under the 'Process' tab under the '3. Advanced' there is a 'MSBuild Platform'. Change that value to "X86" and it might work... assuming of course you aren't depending on any 64-bit libs...