I have asp net core 2.1 and integrated web services too. All works fine in my development environment. But on live environment I have an error:
System.IO.FileNotFoundException: Could not load file or assembly
'System.ServiceModel.Primitives, Version=4.5.0.3
I installed System.ServiceModel 4.5.3 and it is included also in the runtime folder but it is not finding it. Why? What I am missing?
Thanks
Your Reference to the package is probably local. If you are using ReSharper it sometimes references Nuget packages locally (I also had similar experience).
check your references under .csproj file, if they are referenced locally remove them and reinstall using Nuget Package Manager. This needs to solve your issue.
Related
My project fails to build on a build server.
I recently added a new ASP.Net Core (2.2) MVC project with razor pages. The project and the rest of the solution target the .Net Framework 4.7.2.
In Visual Studio on my dev-machine this works fine, but the build server cannot build it. It shows this error.
C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161):C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161,5):
Error : Assembly location for Razor SDK Tasks was not specified. The
most likely cause is an older incompatible version of
Microsoft.NET.Sdk.Razor, or Microsoft.NET.Sdk.Web used by this
project. Please target a newer version of the .NET Core SDK.
I made my coworker install the .Net Core SDK 2.2, since I remembered installing that on the dev-machine to be able to create the project. But this did not help on the buildserver.
What could cause this? Why is the behaviour different from the development environment?
It worked on the build server, after I added this Nuget package:
Microsoft.NET.Sdk.Razor
Since I added the Net.SDK.Razor package, it builds successfully.
I had also added Microsoft.AspNetCore.Razor.Design, but only Microsoft.NET.Sdk.Razor is actually needed.
I got the below error while building the Enterprise Bot Template Project in VS2017. Not sure what i 'm doing wrong here.
Severity Code Description Project File Line Suppression State
Error CS1703 Multiple assemblies with equivalent identity have been imported: 'C:\Users\XXX.nuget\packages\microsoft.netcore.app\2.1.0\ref\netcoreapp2.1\System.Runtime.Serialization.Json.dll' and 'C:\Users\XXX.nuget\packages\system.runtime.serialization.json\4.3.0\ref\netstandard1.0\System.Runtime.Serialization.Json.dll'. Remove one of the duplicate references. SovereignBot C:\Users\XXX\Documents\Visual Studio 2017\Projects\SovereignBot\SovereignBot\CSC 1 Active
Any ideas how to fix?
I'm not able to replicate this issue with a fresh install of the Enterprise VSIX template. This leads me to believe the issue is either in your code or on your machine.
After researching, it appears there could be a couple of problems and solutions:
Your Local/Development and Build servers use different versions of Visual Studio
Update Visual Studio for both environments
If you're still experiencing issues, try installing the Microsoft.CodeDom.Providers.DotNetcompilerPlatform NuGet package.
NuGet or .NET Core is out of date
Update NuGet
Update the appropriate .NET Core SDK. Currently, Bot Framework is supported well on .NET Core 2.2. Keep in mind that if you have 2.2 installed, you may need to update to the latest sub-version (v2.2.104, as of now). Keep in mind you may also need to upgrade your NuGet packages within the project in order to be compatible to the .NET Core SDK.
Ensure your bot is using the correct .NET Core Target Framework by right-clicking the Project > Properties > Application:
Your Visual Studio version doesn't handle dependency version collisions on its own
Update your Visual Studio
You have a duplicate reference to the same package (but possibly different versions) in your .csproj file
This is more likely if you're using code brought in from another project.
Delete or comment out the duplicate by right-clicking on your Project in Visual Studio, and clicking Edit .csproj:
You have a package installed via both NuGet and locally
(I don't believe this is the issue for you, since both of your packages appear to be in the NuGet directory)
Go to the file path of one of the dependencies and delete it.
When I build my .NET Core 2.0 console app, I move it over to the server and I then try and run it. I am getting the error "An assembly specified in the application dependencies manifest..."
I add the dlls to the local folder that it is searching for, but it ends up still needing system dlls like Data.SqlClient.
How do I build the project where it includes all the dependencies in the output files? I've published the project with Visual Studio 2017, however, it still says things are missing when I copy all those files over. I've tried building and publishing with VSCode and have the same problem.
I faced a similar problem. When I deployed my application in host environment and executed with dotnet command like "dotnet myapp.dll" it worked fine using the host environment's .NET Core runtime.
But when I packaged the same application as a Standalone application with an .exe file included to start the application, I faced this error for Newtonsoft.json Nuget Package when .exe file is executed.
My observation is as below, and I was able to solve the problem accordingly.
Framework-dependent deployment:
If the application uses third-party libraries and intention is to use the .NET Core runtime in the host environment, then the checkbox in the "Manage Packages for Solution" has to be checked in the Nuget Package Manager (as shown in the screenshot).
Self-contained deployment:
If the published application is supposed to be a stand alone application in the host environment (even with an .exe file), then the application's .csproj file should include the RuntimeIdentifiers (.NET Core RIDs) specified. Also the third party libraries have to be included in PackageReference. For example,
Reference: https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs
You need to publish the application to have all the dependencies included
I seem to have a problem loading .Net Core Web API assembly in NSwagStudio. I have a reference package (NuGet) for 'Microsoft.AspNetCore.Mvc (1.1.2)'
in my project but this seems to break the load process on NSwagStudio.
See this example:
I am using VS 2017 and the project is running .Net Core version 1.1. I also tried doing the following:
https://github.com/NSwag/NSwag/wiki/WebApiAssemblyToSwaggerGenerator
It did not work, any advice would much be appreciated.
Just publish the project to filesystem so that all required dlls are in the output directory. For .net core you need to add the publish path to the references setting.
Or add the nuget cache to the references path.
I have created an empty project in MVC 4 with .Net Framework 4.5 and integrated with sitecore
When I tried to run the project getting below error:
Could not load file or assembly 'System.Web.Http' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040
You may need to add in some assembly binding redirects, although that's not usually one to redirect. As you haven't stated which Sitecore version you're running you may be trying to use older/newer assemblies compared to the Sitecore install. It's probable that you're using older binaries, Sitecore 8, 7.5 & 7.2 use MVC 5.
Resolved :
You need the Microsoft.AspNet.WebApi.Core package.
To install Microsoft ASP.NET Web API 2.2 Core Libraries, run the following command in the Package Manager Console
PM> Install-Package Microsoft.AspNet.WebApi.Core
and you could add the below line before your class declaration
using System.Web.Http;
Hope its working for you.
This happens when your system assemblies from the sitecore install get replaced by a different version from your build. Make sure you set your system assemblies to "do not copy" in your project if they already exist in the sitecore bin.
Thanks everyone for your reply!
Actually, I am using Sitecore 8 in VS 2012 which is not having MVC5.
So after installing MVC5 package in VS2012, it works fine !