Azure deployment issue after solution conversion to VS2017 - asp.net

I have a .net core web app written using VS2015 and deployed in Azure.
Recently I have moved to VS2017 and it forced me to convert my web app solution so that I can develop it in new VS. I did this and there were no issues.
Then I made a minor change in my app and commited that change to github. Once I did it, Azure has started to build new version as it is configured to automatically deploy current version of app from github.
the issue is that after solution conversion to VS2017 i cannot deploy it in azure. I constantly get an error:
D:\home\site\repository\WebApp\src\WebApp\WebApp.csproj(84,5): error
MSB3073: The command "dotnet bundle" exited with code 1. Failed
exitCode=1, command=dotnet publish "WebApp\src\WebApp\WebApp.csproj"
--output "D:\local\Temp\8d481c16c48679f" --configuration Release
Can any one help me, I'm not very experienced in VS IDE, I think it might be something with project properties or references.
thank you in advance

In the .csproj file, please get rid of any references to "dotnet bundle" as well as the NuGet package "BundlerMinifier.Core". When you've done that and it compiles correctly, you can install the NuGet package "BundlerMinifier" which will add build time support through MSBuild now in .NET Core apps too

Related

Building MSI in azure devops

We have for a while been building various web projects with AzureDevops and self hosted build agents.
Today I had to add a new build, consisting of a windows service written in .net core 3.1. This service has to be installed by our customers, so we have to provide it in a friendly installable way. As some of our developers were already used to handle MSI/*.vdproj projects, they added a vdproj into the *.sln to manage that. On a developper machine, this is not a problem even with VS2019: you just have to use the relevant VS studio extension...
But when it comes to building that in a CI/CD context, this becomes a real challenge. I quickly understood that we can't use MSBuild at all for that and found some alternative using directly Visual Studio (devenv)... Inspired by this thread (still opened), I came up with the following command line:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv" [...]\MySolution.sln /build "Release" /Project MyInstallationProject
This worked fine both on my developer machine and even on the build agent machine. But when I add it into a build pipeline as a command line task, it seems to hang, and after a while I get the following result for the job:
##[error]The job running on agent <MyAgent> ran longer than the maximum time of 60 minutes. For more information, see https://go.microsoft.com/fwlink/?linkid=2077134
What can I do to make it work?
What are the best practices for generating a self installable in a CI/CD context? (Is MSI still relevant? )
As a workaround, you can try to install the extension Build VS Installer and use the task DutchWorkz - Build VS Installer(s) to build Visual Studio Installer Project in Azure Pipelines.
Here are some tickets(ticket1, ticket2) with similar issue you can refer to.

Shared namespace not being recognized in Blazor Server project

I am trying to build a Blazor Server project that I have cloned from a repo. I am getting the message in the Output window of Visual Studio 2019 that the Shared namespace does not exist. The Shared namespace is created in the Blazor template and was not something I added to the project. This also happens if I create a new project and try to run it. Others on my team are able to clone this repo and run it. I have uninstalled and reinstalled Visual Studio 2019 Enterprise edition and also the Dotnet 3.0.1 framework. The only thing I can think that might be the difference is that I updated my VS 2019 to 16.3.10, but even after uninstalling and reinstalling, I have the same issue. I know I have read some things about mismatching of VS and Dotnet core framework SDK versions causing issues but not sure if this is the case here.
I was able to resolve this issue by rebuilding the project after clearing Nuget Caches.
Path: Tools -> Nuget Package Manager -> General -> Clear all Nuget Cache(s).

Clone & run existing project from github

I installed Visual Studio 2017.
I wanted to clone a repository and try in my local system.
Suppose i want to clone this. repo (Not mine.) Is it possible in one step?
Or else do i need to write step by step actions and necessary codes to run the project?
By checking NuGut package manager to auto download packages on build time will
work? I am new in ASP.Net. Is there any way to run the project in local system by just cloning.
EDIT:- Tried to restore packages
PM> dotnet restore
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't in
clude command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telem
etry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
ASP.NET Core
------------
Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other
platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
C:\Users\win7.system3\Documents\Visual Studio 2013\Projects\localhost_54920\localhost_54920.sln : Solution file error MS
B4249: Unable to build website project "SAMP". The ASP.NET compiler is only available on the .NET Framework version of MS
Build.
First of all, you'll need .NET Framework 4.6.1 installed in your machine.
Short answer
Having that installed, you should be able to open the project/solution with Visual Studio, build it* and run it from there.
Long answer
If that was a .NET Core project, without Visual Studio it would be as easy as:
git clone https://github.com/sarn1/example-aspnet-mvc
cd example-aspnet-mvc\ComicBookGallery
dotnet run
dotnet run will restore (dotnet restore) the dependencies, build (dotnet build) the project and run it.
However, that's not the case, so you can only:
Restore the nuget packages using Visual Studio or nuget.exe cli.
Compile it* using or msbuild (use Developer Command Prompt for Visual Studio to be able to easily access it).
Run it... from Visual Studio, which makes the rest of the process kind of worthless.
git clone https://github.com/sarn1/example-aspnet-mvc
cd example-aspnet-mvc
nuget.exe restore
msbuild /t:build
* You may need to apply these changes to make the project compile.

.NET Core 3.0.100 not working with Blazor

I just downloaded the .NET Core 3.0.100-preview-010184 (the lastest .NET Core so far). I wanted to generate a Blazor project to try it. So I did what's written here:
dotnet new -i Microsoft.AspNetCore.Blazor.Templates::0.8.0-preview-19104-04
And then:
dotnet new blazor -o Blazor.App
cd Blazor.App
dotnet run
But instead of running, I'm getting this error:
Unable to generate deps.json, it may have been already generated. You can specify the "-d" option before the tool name for diagnostic output (for example, "dotnet -d ": C:\Program Files\dotnet\sdk\3.0.100-preview-010184\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj
I tried running it with and without administrator privileges.
Any idea?
This is a know issue, mentioned in the release blog post.
"Unable to generate deps.json, it may have been already generated.": You may see this error when running a standalone Blazor app and you haven't yet restored packages for any .NET Core apps. To workaround this issue create any .NET Core app (ex dotnet new console) and then rerun the Blazor app.
All you need to do is run the following command
dotnet new console
This will generate a new console app. You can then delete it and you should then be able to run your blazor app.

Error: Unable to generate deps.json, it may have been already generated. when adding a Service reference to Xamarin forms

I have a Xamarin forms v3.1 project with the .NET standard approach.
I tried to add a reference to a web service I have using
"add connected service" and then from the pop up, I choose Microsoft web service reference provider.
I add the web service link, Visual Studio (2017 v15.8) discovers its structure, and then when I click finish, it takes a while but then shows this error:
Unable to generate deps.json, it may have been already generated.
You can specify the "-d" option before the tool name for diagnostic
output (for example, "dotnet -d ": C:\Program
Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj
Done.
Any idea why this is happening and how to solve this issue?
Execute tool-line command:
dotnet tool install --global dotnet-svcutil
What worked for me was running the "dotnet restore" command in VS 2019.
When I add a service reference to a regular.net core web application, I got the same error. After the investigation I came to know that, somehow svcutil was not installed. Once I installed svcutil using Nuget Package Manager (Install-Package dotnet-svcutil), this issue resolved.
More details about .net core and svcutil : Ref : https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-svcutil-guide
For a .NET Core 2 application you cannot install dotnet-scvutil ver 2.0.1. For me it worked with ver 1.0.4.
After you install this you need to update rest of the NuGet packages except dotnet-svcutil.

Resources