I can't add the serilog.dll into sql Server assemblys - serilog

Actually, I'm working on developping an SQL project using visual studio 2019 within framework 4.8 . this project contains three dependencies (sub projects ) referenced as dll into my main sql project. one of them is a serilog project. So, i v generated all the solution and it s ok. but when i tried to create an assembly in sql server, i couldn't create it. i recieve a message shown below:enter image description here
can anyone help me resolve this issues.
thanks a lot

The error message is very clear: The Serilog assemblies reference a different assembly Microsoft.Extensions.Configuration.Abstractions, Version=2.0.0.0 which has not been added to SQL Server yet... So you need to add Microsoft.Extensions.Configuration.Abstractions to SQL Server first, before adding the Serilog assemblies.

Related

MvcSiteMapProvider.dll not working in Visual Studio 2013

I have a MVC 2 project created in Visual Studio 2010 that use MvcSiteMapProvider.dll and works fine. But when loading the project in Visual Studio 2013, everything else work fine except it crashes at
Html.MvcSiteMap().SiteMapPath
The error message is
An exception of type 'MvcSiteMapProvider.MvcSiteMapException' occurred in MvcSiteMapProvider.dll but was not handled in user code
I believe that MvcSiteMapProvider.dll cannot be loaded correctly. I need help on this. Thanks.
Note that there is a separate DLL for each .NET framework version, and I suspect you are targeting the wrong framework. This can happen if you install MvcSiteMapProvider into your project and then change it to a different .NET framework version.
NuGet does not automatically upgrade/downgrade packages to the currently set framework version. This step must be done manually. The best way is to completely uninstall and reinstall the package as per this document. Also be sure to read this before attempting it.
But do note that if you do this NuGet will not remove any files you have changed (like Mvc.sitemap) and then prompt you whether to overwrite them. You should normally say no to each prompt to ensure your custom configuration is not overwritten.
Also note that it is not sufficient to use Assembly Binding Redirection with MvcSiteMapProvider because with each .NET framework version we create a separate build (DLL) that takes advantage of features that are not present in prior versions.

Importing an UMBRACO site into Visual Studio

Is it possible to import an already existing Umbraco site into Visual Studio? (By means of getting all the site files and DB backup)
I've tried creating an empty project and copying the website files, but I get several errors when I try to compile the solution. The errors look like "Could not find scheme information for the element 'umbracoConfiguration'."
The same happens if I create an empty solution, add the UMBRACO nuget package, and then copy the website files.
I'm wondering if it is at all possible, or if once an UMBRACO website is running, how should one customize/develop on it?
THANK YOU!
After several attempts and trial and error, as well as reading other blogs, the way it worked for me was to go in Visual Studio -> File -> Open -> Web Site... and select the main folder containing all the files.
It is important to know that the web.config had to be modified in advanced for the website to work to point to the local server and off course attach the DB to the local SQL server.
Everything works perfectly just the way it was working on the host, and I have the solution in Visual Studio.
I like to start with nuget because it handles setting up all of my project references. I create a new MVC4 Web Application
Visual Studio->File->New->Project->MVC4 Web Application
After I create the new application, I open the Nuget Package Manager Console
Tools->NuGet Package Manager->Package Manager Console
I then enter the command:
Install-Package UmbracoCms.Core -Version 7.2.1
I find that installing the UmbracoCms.Core instead of the whole UmbracoCms nuget package is best because it only sets me up with the umbraco dlls and sets up the references for me. The UmbracoCms nuget package tries to do a lot more and is more handy if you are setting up a brand new umbraco site in Visual Studio.
Once I have nugetted the appropriate version of umbraco, I copy my existing umbraco site files over the files that were nugetted. When you copy all of the files over, don't copy all of the App_Data. Most of the files in that directory are TEMP files and cache files. From App_Data, only copy the following. This will save you time reindexing the site. I suspect a lot of the App_Data files were responsible for your Object Null Reference.
App_Data/access.config
App_Data/packages/*
In visual studio, in the solution explorer, click "Show All Files", and then include the appropriate files in the solution. Rebuild the solution, and you should be set up for development.

TFS Build Failing on System.Windows

I've been trying to run my build on TFS and I keep getting an error that kills my build. What's strange is that nothing except code change has been done since the issue started (Or at least that I'm aware about). I keep seeing this:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.WinFx.targets (268): Unknown build error, 'Cannot resolve dependency to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.'
I've googled this and the only thing I see is that it's because there's a Silverlight dll being used in a WPF application. My application is a WPF project, but I haven't been able to find any changes being done in any of my projects in my solution in regards to references.
For more information, this project is a branch from the main code. The main development branch runs fine, but for some reason, this build just fails.
Any ideas?
It seems like you're referencing the Silverlight version of System.Windows instead of the .NET Framework version. Have you tried installing Silverlight on the build server or changing the reference of your project to point to the normal .NET Framework version of that assembly (which .NET Framework exists on your build server)?

Debugging a nuget of an entire web installed into an empty web app

We are in the middle of development for a core ASP.NET MVC web project and a customer plugin in the form of an MvcContrib plugin web project -- a web project injected into the core web as an area. The plugin is a soft reference in the core project, so it can be developed completely separately and dropped in.
I am trying to generate a way to debug/code the plugin, so that the multiple custom plugins can be developed independent of the core web.
The developers should only have to worry about coding and testing the plugin code. Also, I don't want them to change the core code in this custom plugin project -- that should be done in the core anyway.
I created the core web as a NuGet package and included all the necessary files so I could include it in a web.
My thinking was that I could create an empty web, install my core web, and the developers could have an F5-driven debugging environment.
I tested by creating a blank Mvc project, installed my core package and included one of my plugins. I changed the namespace of this empty web app to the namespace of the core web, thinking that Visual Studio debugging would properly attach and my core assembly.
Simple VS debugging in the empty app does not work -- I receive an HTTP Exception, most likely due to my routes not being registered. I also see that my log4net is not creating its logs folder, so I know the assembly's app start is not being called.
So I see that VS is not attaching to and calling my core assembly.
Can I use this empty web as a host project for my nuget installed web and debug? If so, what configuration am I missing?
If not, how can I include the core web in each customer plugin project in such a way that I can drop my DLL into the bin and debug it?
Using:
Visual Studio 2010
ASP.NET MVC2
The way we are doing things that works pretty well is to use a combination of Web Activator and Razor Generator (available as a Visual Studio extension). In order to access the views within the core web application, the consuming client application needs to know about them, either because they are all included as file references inside the Nuget package (messy) or because they are compiled into the core web dll. You can do that using Razor Generator. Once installed via Nuget you would need to change the Custom Tool property for each .cshtml file to RazorGenerator, which will create a .generated.cs file for each view. This will allow your sample client to use the layout and views from the core web application.
David Ebbo has some useful blog posts on Razor Generator
Couple that with Web Activator to create a PostActivationStartMethod that runs your initialisation code (such as initialising Log4Net) and you should be good to go. We've had this running in 2 scenarios - consuming the framework package via Nuget and adding a project reference directly. Debugging was not working for the Nuget package consuming route but we don't include the pdb files in the Nuget package. We can debug when adding a project reference directly though.

NLog.Extended not copied to my Web Project

I have a solution with 2 projects:
Project 1: Wrapper.Dll which contains a NLog wrapper. NLog and NLog.Extended have been installed with Nuget.
Project 2: is an ASP.Net MVC project which contains a reference to project 1.
When I try to run the web project, it throws an exception because NLog tries to load a target renderer from NLog.Extended.Dll.
If I check the bin directory of Wrapper.dll, I have NLog.Dll and NLog.Extended.Dll.
If I check the bin directory of the Web project, I only have NLog.dll.
How can I tell Visual Studio to copy the NLog.Extended.Dll from project 1 to project 2?
EDIT: Adding some dead code that use something from NLog.Extended.Dll makes the file copied.
Is there any cleaner solution?
Thanks
Unfortunately no, there is no cleaner solution. If no objects from the NLog.Extended assembly are referenced (directly or indirectly) from your code, it will not copy it. This is of course a problem since the layouts are just strings and not a direct reference. You could use a post-build event, but that's an uglier solution in my opinion.
You could add a reference to NLog.Extended.dll in the web project if it depends on it.

Resources