What is the purpose of Microsoft.AspNetCore.Razor.Tools? - asp.net

What is the purpose of Microsoft.AspNetCore.Razor.Tools?
I'm using visual studio code on os x
From the git hub page https://github.com/aspnet/RazorTooling I can see
The Razor syntax provide a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content. This repo contains tooling that interacts with the DNX Design Time Host to provide a Razor editing experience.
Does visual studio code use this assembly? What is a DNX Design Time Host? When would I need to include this assembly in a project?
I found a reference to it in the project.json of a web application project that I generated using yo aspnet.

At least here: https://www.nuget.org/packages/Microsoft.AspNetCore.Razor.Tools/ you can see a brief description of library:
TagHelper tooling for .NET Core CLI. Contains the dotnet-razor-tooling
command used to resolve TagHelperDescriptors for projects at
design-time.
And here you can find a bit more details: https://docs.asp.net/en/latest/mvc/views/tag-helpers/intro.html#intellisense-support-for-tag-helpers
On mac you can run the same command:
dotnet razor-tooling
but it doesn't make any sense because for now VS Code doesn't provide any intenseness for Razor views. So probably you can remove this dependency from project.json.

Related

Azure Pipeline : ASP.NET and .NET Core applications under one build pipeline

Background:
I have several ASP.NET projects under one solution file. I have a build pipeline for ASP.NET projects and building it with .sln.
Now, we have added a new project to the same .sln which is in .NET CORE.
Problem statement:
In my build pipeline, when I try to build the whole solution, it throws an exception to the newly added project. (.NET CORE)
"The type or namespace name 'Entity' does not exist in the namespace
'System.Data' (are you missing an assembly reference?)"
I believe this is due to framework versions.
Question:
Is it possible to have both projects under one build pipeline, if yes, how can I achieve it? if not, what would be the ideal solution?
Additional information: From the visual studio, everything is building and working fine, but I build the project pipeline it's throwing this error.
Initially build the code from visual studio to avoid errors while building in the azure pipeline.
Used different projects in azure pipeline
Create a repository using Visual Studio or Azure Devops.
Fill the necessary fields while creating a repository
Then it enters into a Git Credential Manager screen and have to choose the account from which you want to create and proceed further.
Create branches if required.
Using Visual Studio, we can sync and push the changes made from the specific branch
Create a pipeline with azure subscription and build the code.
Refer this link for more info.
You could add a reference to System.Data.Entity to test if the exception is thrown again.
Or you could refer to this document for more details about Organize your project to support both .NET Framework and .NET
================================================================
updated on 11/30
This error message indicates the build process can't find the assemblies coming from the restored nuget packages. So you should check the log of the restore task in build-pipeline to make sure the packages are restored successfully.
Make sure you have use nuget tool install and nuget restore tasks before your build task like this, if your build include private feed, please add the nuget authenticate task to restore the project correctly. (Avoid using dotnet related tasks cause your project targets .net framework, and dotnet task could not recognize .sln projects)
I was able to resolve this by updating the NuGet package version for the pipeline. Same as the application version.

Having trouble referencing .NET Standard class library using SQLProvider from .NET Core project

Reproduction of problem here: https://github.com/Arrow7000/SqlProviderTest
I'm fairly new to the .NET world so am having trouble wrapping my head around exactly what the problem is.
I've tried to use the SQL type provider directly in an F# .NET Core project, but had a bunch of problems getting it to work. From what I can tell that's due to incompatibilities between .net core and type providers.
So what I am trying instead is to have the SQL type provider code encapsulated in a .NET Standard project that I can reference from my main Core project.
I've managed to reproduce the problem in a minimal GitHub repo located here which demonstrates both that
the type provider is working in Visual Studio 2019 with IntelliSense, but
despite this I still get a build error when I try to start the Main project
The build error is
Unable to find the file 'C:\projects\SqlProviderTest\SQLStuff\bin\Debug\netstandard2.0\SQLStuff.dll' in any of
C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.netcore.app\2.2.0\ref\netcoreapp2.2
C:\projects\SqlProviderTest\Main
C:\Users\Aron\.nuget\packages\fsharp.core\4.6.2\lib\netstandard1.6
Why isn't the project reference simply working as expected? I've tried adding <Private>True</Private> to the project reference but that didn't make any difference
P.S. in case it matters, I'm developing on Windows but the app gets deployed on a Docker container.

Was the ability to run a .NET Core app from source code removed?

In previous versions of what is now .NET Core, using the dnx toolchain, it was possible to run an application straight from source code, without compiling to a DLL on disk. This capability was also present on Azure, allowing you to edit code on the server and have those changes reflected in the live site.
The new dotnet CLI run command seems to automatically create the familiar bin and obj folders with compiled DLLs in them, and the publish process from Visual Studio to Azure now no longer includes the C# source, just the DLL.
Is it no longer possible with the new CLI and other tools to run .NET Core code without creating a DLL on disk?
Short David Fowler response:
Dynamic compilation is gone in RC2. It only exists for views now. There are no plans to bring it back.
Why?
Architectural challenges and changes require to implement it on both .NET Framework and .NET Core. We did it with dnx and there were some problems (like some things being completely broken with in memory assemblies) that we chose to just avoid.

How to Add Reference to System.Data.Services.Client in .Net 5 Project

I am trying to add search to an Asp.Net 5 project. The search uses the Bing Search API.
As per the instructions in the "Bing Search API – Quick Start and Code Samples" I have downloaded a file called "BingSearchContainer.cs". This file has references to System.Data.Services.Client. The file is too big to put here but can be downloaded at https://datamarket.azure.com/dataset/explore/getproxy/5ba839f1-12ce-4cce-bf57-a49d98d29a44.
I added references to System.Data.Services and System.Data.Services.Client as they were not included in the generic Asp.Net 5 (RC1) template I have used (in Visual Studio 2015) to create the site.
Although this removes the errors in the files themselves, the errors are still present in the error list and the project won't build or run.
If I hover over the using statement for System.Data.Services.Client at the top of the BingSearchContainer file it says ....DNX Core5.- Not Available.
Does anyone know how I can solve this?
You need to be aware of the platforms you're targeting. .NET Core is a new runtime, and there are no built-in libraries. Everything must be added (generally as a NuGet package), even things that were previously available from the Standard Libraries.
Check and see if the library you want is available on NuGet. If not, you'll need to find some sort of workaround or stop targeting .NET Core and just focus on the full .NET Framework.
Some workarounds
Locate a different package that does what you want and is available for both .NET Core and the full .NET Framework
Use System.Data.Services.Client on full .NET Framework and an alternative framework for .NET Core, and use compiler directives to target specific blocks of code at specific versions of the framework
Location the source for System.Data.Services.Client and try porting it to .NET Core. You should probably double check with Microsoft about this to see if they have plans to move it over already, as well as to see if there's anyone else that might help you with it
Just compile your project for .NET Framework, and don't compile for .NET Core

Configuring existing ASP.NET project for DNVM, DNX environment on a Mac

I have an ASP.NET Web API project created on Windows using Visual Studio. How can I set this up for use with DNX/DNVM (on a Mac)?
Switching to Git solved the source control compatibility with TFS. But I wasn't able to find references to getting a project working across both these development environments.
I'm assuming as a first step the project will have to be migrated to ASP.NET 5/vNext but wondering other problems lurk around the corner with different project members using different environments.
I get an error when I run - git:(master):dnx . kestrel
As you mentioned yes you will have to migrate any namespace changes. I have a project that is developed across both. Also changing csproj files to xproj. Support is coming for some kind of interop between the different project types but its not here yet.
For build, publish, deploy from git without relying on VS publish capabilities or MSBuild you can follow my blog post here.
Basically you use DNU to publish and then kudu to deploy.

Resources