I am facing a strange issue. I have created 5 projects in a solution which are of type Windows Class Library, Windows Console Application, Windows WPF Application, Workflow Activity Library and Sequential Workflow Console Application. I have added reference of same dll in all five projects. Without writing any code I build the projects.
Three of them Windows Class Library, Windows Console Application and Windows WPF Application build successfuly while two Workflow Activity Library and Sequential Workflow Console Application projects gives this error.
XC1020: Build error occurred in the XAML MSBuild task: 'Could not load file or assembly 'assembly name' or one of its dependencies. The specified module could not be found.'
The DLL i am referring to has runtime version 2.0 and setting specific version = true doesn't change anything.
So is this issue in Vs beta version or something is wrong with DLL?
Related
When i deploy the application from Visual Studio to Azure app service using Framework/Runtime dependent mode, then app service run properly.
But when application is deployed using CICD (using VSTS), then app service fails with above mentioned error in title and following error is logged in stdout log files :
Error:
An assembly specified in the application dependencies manifest (App.deps.json) was not found:
package: 'System.Diagnostics.PerformanceCounter', version: '4.5.0'
path: 'runtimes/win/lib/netcoreapp2.0/System.Diagnostics.PerformanceCounter.dll'
But the dll is present in mentioned path under .netcoreapp2.0.
I am publishing the application using VSTS agent.
If i restart the app service then it works fine.
This is one of those errors that can come up for a thousand unrelated reasons. -Everytime- I get this error it's because I've upgraded Nuget packages in my project and one of those packages uses a version of the .Net Core SDK I haven't installed locally. I suspect since you're using the Framework dependent mode it could be an issue if it sandboxes you away from other SDK's (not sure if it does, just thinking out loud).
Make sure your .Net Core SDK's are up to date.
Try publishing it and sending the whole framework with it if you're using .Net Core as the backend (and not the old framework).
Check your NuGet's and make sure they're all supported on the framework you're specifying. I've seen cases where a 4.5 framework assembly 'might' work locally but then error out on the server. If one of them targets an SDK that isn't on the server you'll get this.
https://www.blakepell.com/asp-net-core-http-error-502-5-ancm-out-of-process-startup-failure
Since it works fine when you restart the app service, you could add a Azure App Service manage task to restart Azure App Service in your pipeline:
steps:
- task: AzureAppServiceManage#0
displayName: 'Restart Azure App Service'
inputs:
azureSubscription: azureSubscriptionName
Action: 'Restart Azure App Service'
WebAppName: AppServiceName
It seems that the first time you try to run, your application can not find this .dll that is required on the server. What you can do is to add this in your .csproj file:
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Adding the above snippet will export all DLLs needed to run the application (assuming SDK is not available, and runtime is quite lightweight to contain non essential libraries).
I have some existing functionality in unmanaged C++ which I wanted to use in a Web App. This code was already wrapped in C++/CLI and used via desktop C# apps. So there is already an existing mixed mode .NET assembly containing the functionality I want to use in a Web App. I also already have Azure hosted web apps that are composed of assemblies containing only C# and I can publish them from Visual Studio 2017 to an Azure App service with no problem.
So I tried to add the mixed mode assembly and started getting errors from the publish about the dependencies of the mixed mode assembly. The only dependency of the mixed mode assembly is on the VC++ runtime so I assumed that was the problem. To prove this I created an Azure VM started IIS on it and published to that and got exactly the same error. I then installed the VS 2017 C++ runtimes on the VM and published again. The error went away and the Web site works fine.
I them logged onto the machine hosting the Web service using Kudu and it appears to have the VS 2017 C++ run time already installed. So I am baffled why I get the error when I publish to it. I have tried adding the runtime DLL's like vcruntime140.dll to my publish but this didn't fix things. I also tried re-installing the runtimes with no luck.
So does anyone have any insights as to why I am getting DLL dependency errors and what I can do to fix it. Ideally I was hoping for a Hello World example of using C++/CLI in a Web App from Microsoft but have not been able to find one.
Note there is a similar question here multi-file c++/cli .net assembly in ASP.NET web site without an answer.
When i Publish my project i m getting this error:
error CS0009: Metadata file
'D:\home\site\approot\packages\Microsoft.ApplicationInsights\1.1.1-beta\lib\net45\Microsoft.ApplicationInsights.dll'
could not be opened -- Invalid COR20 header signature.
(I m using asp.net core 1)
Did Someone knows or has experienced the same problem?
Thanks
This problem can occur when you have added a third-party DLL to your application and have not properly added it to your compiler’s project file or references list.
If that's the case this might work:
Open your project in Visual Studio .NET. Make sure the DLL exists and has been properly added to the reference list. If you are using VBC or CSC to compile your project, check your application’s CompileApplication.rsp file to make sure the DLL is in the /references list like the other DLLs.
Your DLL may not be compatible with .NET or with .NET’s 32-bit mode. Ensure that your DLL is .NET compatible.
If your project still won’t compile properly, try switching your application’s compiler selection in Iron Speed Designer’s Application Wizard from 'vbc.exe' or ‘csc.exe’ to Visual Studio .NET or vice versa. Using Visual Studio .NET will take longer to build than .NET’s VBC or CSC built-in compilers, but Visual Studio .NET will resolve all of the references properly without having to change your application’s CompileApplication.rsp file.
I have downloaded published (code behind files are no there, combined with dll in bin folder) web application from Window Server 2008 where it is hosted, and open it with Visual Studio when I debug that application it shows following error:
"Could not load assembly because this assembly is built by a runtime newer than the currently loaded runtime"
I don't know how can I solve this problem and test application locally.
Please help me.
This errors happens when the DotNet framework you are using is of older version than the one used to build the assembly. You need to check which version of framework is used to build those assemblies and then use the same or higher to debug too.
I was getting this same error when running an installer for a Windows service, even when running the installer on the PC the installer was built on.
It turned out that although the Windows service project had been updated to .NET 4.5, the Setup project that was making the installer was still set to use .NET 2.0.
To check if the Setup project is using an older version of .NET than the project to be installed, in the Visual Studio Solution Explorer:
Expand the Setup project;
Under the Setup project, expand Detected Dependencies;
Under Detected Dependencies select Microsoft .NET Framework and check the Version property. Select the appropriate .NET version from the dropdown list;
Re-build the Setup project to create a new version of the installer.
This error can have a lot of other reasons, too. I had the same problem, and nothing helped until I stumbled across this:
TlbExp.exe error:This assembly is built by a runtime newer
I just ran into this issue when the assembly was built with a target framework of .NET 4, and v4.0.30319 was installed on the server, and other 4.0 apps were running successfully.
The problem arose because the app had originally been built targeting 2.0, and new 4.0 assemblies were pushed, but not the app.config file, which we generally update separately.
This means the supportedRuntime attribute was not updated in the config and caused the error. Adding the following to the app.config fixed our issue:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
One the the assemblies reference in the project might be built using a newer version of .net, check version of every assembly reference and correct accordingly.
Also check the application pool that this web site is running as. It could be framework 2.0 default on some older windows servers. Change it to framework 4.0.
I have a ASP.NET 2.0 web application. To that solution I add a Report (Reporting Services).
I make no further changes to that report. When I try build the application the build fails with the following error originating from that report file:
A namespace does not directly contain members such as fields or
methods
The problem was Visual Studio. I've restarted the IDE and could compile the application without problems.