Friday, November 22, 2019

Error: Parser Error Message: Could not load type” in Global.asax

I resolved this error to change project OutputPath property to "bin" instead of "bin\Debug" or "bin\Release"

Go to the Project right click and select Property > Compile and change "Build output path" to "bin\"


or Unload project and open for Edit and Modify Outputpath property to "bin\" instead of "bin\Debug" or "bin\Release".
and also you can check IIS pool should be in correct .NET version (2.0 or 4.0)

Create Pipeline build to Push DLL into Nuget Repository using Azure DevOps


Here simple steps to follow and create new Automated Build using Azure DevOps to push your DLLs into NuGet Repository 

You mainly needed three task to Restore, Pack and Push library into NuGet repository.

Go to Pipeline > Build > Create New Build , Add following Task on your build 

  1. Get a Sources
    1. Choose Repository (TFVC or Git)
  2. Add Agent Job
    1. NuGet Tool Installer : leave all default
                                                    i.     Type: Map
                                                   ii.     Server Path: choose source code location
                                                  iii.     Clean: true
                                                  iv.     Clean Options: sources
                                                   v.     Label sources: OnSuccess
                                                  vi.     Label format: $(Build.BuildNumber)
    1. NuGet  for Restore
                                                    i.     Choose command : restore
                                                   ii.     Path to solution, packages.config, or project.json (.sln file path)
                               iii.     Use packages from this Azure Artifacts/TFS feed
                                iv.     Check: Use packages from NuGet.org
    1. Update AssemblyInfo
                                                    i.     Root Folder: $(Build.SourcesDirectory)
                                                   ii.     File pattern (AssemblyInfo.cs)
                                                  iii.     Version: $(Build.BuildNumber)
                                                  iv.     File Version: $(Build.BuildNumber)
    1. Visual Studio Build
                                                    i.     Solution :   .sln file path
                                                   ii.     Visual Studio Version: Latest
                                                  iii.     Platform : AnyCPU
                                                  iv.     Configuration: Release
                                                   v.     Check: Clean
    1. NuGet (for pack)
                                                    i.     Command: pack
                                                   ii.     Path for proj or nuspec
                                                  iii.     Pack Option: “Use the build number”
    1. NuGet (for Push)
                                                    i.     Command : push
                                                   ii.     Path to NuGet package to publish ($(Build.ArtifactStagingDirectory)/*.nupkg)
                                                  iii.     Target Feed: Select a feed hosted in this account. You must have Package Management installed and licensed to select a feed here.”

Go to this video for more details 

Common errors when you automate build using Azure DevOps build


Error-1
The nuget command failed with exit code(1) and error(System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Cannot determine the packages folder to restore NuGet packages. Please specify either -PackagesDirectory or -SolutionDirectory.

Solution
I observed this error when I was trying to create automated build using Azure DevOps Pipeline and I changed **/*.csproj  from **/*.Sln as a file to build.

To Resolve this error, in the Pipeline Task select  NuGet & use Pack Option instead of Restore Option, Restore Option work for Solution file only not for project file.

Error-2
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(775,5): Error : The OutputPath property is not set for project 'ABC.csproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Release'  Platform='Any CPU'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.

Solution
Again if you are switching from .Sln file to .csproj or .vbproj file to be build then make sure you are selecting the correct "Platform" property.

For Project file , Platform property value is "AnyCPU" and 
For Solution file, Platform property value is "Any CPU" (with space)

so, you need to open project file in notepad and check PropertyGroup section and OutputPath tag should look like below.

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <OutputPath>bin\Release\</OutputPath>
      .
      .
</PropertyGroup>

Error-3
Response status code does not indicate success: 409 (Conflict - The feed already contains “*.dll <Version Number>”)

Solution:
When you get this error that mean project is building correctly but not increasing the build number, so server trying to push same dll version into NuGet and it not allow duplicate version number, and throw 409 error
If you choose "Skip duplicate version" option then it will resolve the issues but that will not be correct because latest version never deployed into NuGet server. 

The best solution I found, in NuGet Task select following option 
Command : pack
Automatic package versioning : Use the build numbers 

This will create new version every time when new DLL build successfully, so No 409 error.

Wednesday, November 13, 2019

Error: The visual tree has been changed during a 'VisualTreeChanged' event.

Error: The visual tree has been changed during a 'VisualTreeChanged' event.

Solution: 
Go to Visual Studio, Tools >> Options and unchecked "Enable UI Debugging Tools for XMAL"

 

Tuesday, November 12, 2019

Error: The authentication schemes configured on the host ('Ntlm, Anonymous') do not allow those configured on the binding 'BasicHttpBinding' ('Negotiate'). Please ....

ErrorThe authentication schemes configured on the host ('Ntlm, Anonymous') do not allow those configured on the binding 'BasicHttpBinding' ('Negotiate').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

Solution:

I have done following two things in IIS setting to resolve following error

1) Make sure for Hosted WebSite/App two Authentication option is set to Enabled
     Anonymous Authentication = Enabled and Window Authentication = Enabled


2) Right click on Window Authentication >> Providers
     make sure you have NTLM and Negotiate is added as Enabled Providers, If not just add it.