Developer forum

Forum » Development » Fresh NuGet install error

Fresh NuGet install error

Ambert van Unen
Reply

Steps I followed:

  1. New (Empty) Visual Studio project: ASP.NET Web application
  2. Go to NuGet, install Dynamicweb.Admin 9.7.5.
  3. Fails with Roslyn error, as per documentation I run the 'Install-Package Dynamicweb.Admin -Version 9.7.5 â€“IncludePrerelease' command
  4. ReadMe.txt exists, pressed A for yes to all
  5. Wait
  6. Rebuild project
  7. Run project
  8. Get invalid web.config error ' Only one <configSections> element allowed. It must be the first child element of the root <configuration> element'
  9. Fixed error by moving the section
  10. Merged dynamicweb.web.config with web.config
  11. get error when running project: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
    LoaderExceptions information:
    Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
  12. ??

When downloading the project, Microsoft.Build.dll's are included, in the nugetpackage, they are not referred. Should I just merge the DLL's ? Looks to me that something essential is not being referred in the NuGet..

Attached: Web.config and packages.config

 


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Ambert,

I'm not sure how you ended up with that result. I was unable to reproduce that.

Your web.config does not look right. It contains multiple assembly redirects for the same assemblies and some other configuration is missing completely.

I tried to install Dynamicweb.Admin and got another runtime error which was related to the version of Microsoft.CodeDom.Providers.DotNetCompilerPlatform. This can be fixed by reinstalling that package after fixing web.config.

So try this...

1) Create a new empty Web Application project which targets .NET Framework 4.7.2

2) Use NuGet Package Manager Console to install Dynamicweb.Admin

Install-Package Dynamicweb.Admin -Version 9.7.5 –IncludePrerelease

3) Replace the contens of web.config with the contents of dynamicweb.web.config (no merge).

4) Use NuGet Package Manager Console to reinstall DotNetCompilerPlatform

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -Reinstall

This worked for me. Let me know if it works for you too.

Best regards,
Morten

 
Ambert van Unen
Reply

The readme explicitly states to update the web.config, not replace the web.config, so get that me on the wrong foot

You need to update the web.config with the content of dynamicweb.web.config

However, it does work. But now its missing some DLL's.

 

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
...
Could not load file or assembly 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
 
Nicolai Pedersen
Reply

What is your Visual Studio version?

 
Ambert van Unen
Reply

Visual Studio Professional 2019

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I don't know what could cause this. It looks like the package installation is incomplete or there is still something wrong with the web.config file.

The Microsoft.Build assembly should have been installed along with the RazorEngine.Roslyn 3.6.1-rc1 package and its dependencies.

Are there any errors reported in NuGet Package Manager Console during the intallation? 

When installing Dynamicweb.Admin one of the last lines in the console should be something like this:

Successfully installed 'Dynamicweb.Admin 9.7.5' to MyCustomWebApplication

Is your Visual Studio configured to use the nuget.org feed at https://api.nuget.org/v3/index.json and are you using that as source in the console?

Make sure that your Visual Studio is updated (Help > Check for Updates).

Best regards,

Morten

 

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

If it still doesn't work you can try to install Microsoft Build Tools 2015, reboot and create a fresh install after that.

https://www.microsoft.com/en-us/download/details.aspx?id=48159

 
Ambert van Unen
Reply

Installation went fine, only when building I get a few warnings:

Updates VS2019 to the latest (from 16.4.1 to 16.4.3), still the same.

I tried adding the MSBuild references manually, but sadly to no avail. I'll probably try to make a new solution again, who knows it now magically appears ;-)

 

1>------ Rebuild All started: Project: dynamicweb2, Configuration: Debug Any CPU ------

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "HtmlAgilityPack" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "LumenWorks.Framework.IO" that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

1>vbc : warning AD0001: Analyzer 'Microsoft.CodeAnalysis.VisualBasic.Analyzers.FixAnalyzers.BasicFixerWithFixAllAnalyzer' threw an exception of type 'System.TypeInitializationException' with message 'The type initializer for 'Microsoft.CodeAnalysis.Analyzers.FixAnalyzers.FixerWithFixAllAnalyzer`1' threw an exception.'.

1>  dynamicweb2 -> C:\Users\xxxxx\source\repos\dynamicweb2\dynamicweb2\bin\dynamicweb2.dll

========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
 
Ambert van Unen
Reply

Redid everything, but sadly the exact same outcome.. The database installs, and then poof, msbuild error again :( I'll try to manually reinstall the msbuild tools.

 
Ambert van Unen
Reply

Got it working!

I've downloaded a fresh copy of DW9, and copied the msbuild.*.dll files to the /bin in my solution.. Now it runs. Not the best way, but it works for now.. :)

 
Jan Sangill
Reply

Hi,

Just for reference - I am having the same issues.

I need to follow these steps after a fresh install:

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -Reinstall

Then I need to copy the roslyn folder from a downloaded application into the bin folder.

And then it works.

 

 

You must be logged in to post in the forum