VS error message while scaffolding identity - c#

Can someone help me understand this Visual Studio error message and suggest a fix?
I am getting the error message while scaffolding Identity.
This is the error message I get:
There was an error running the selected code generator: 'Error: An
assembly specified in the applciation dependencies manifest
(Intacct.deps.json) has already been found but with a different file
extension: package:
'Microsoft.VisualStudio.Web.CodeGeneration.Design', version: '3.1.0'
path: 'lib/net461/dotnet-aspnet-codegenerator-design.exe' previously
found assembly:
'C:\MyPath\Users\MyUser.nuget\packages\microsoft.visualstudio.web.codegeneration.design\3.1.0\lib\netcoreapp3.1\dotnet-aspnet-codegenerator-design.dll

The issue was occurred due to the NuGet manager already has a reference for Microsoft.VisualStudio.Web.CodeGeneration.Design. in the C:\Users\Lenovo\.nuget\packages\microsoft.visualstudio.web.codegeneration.design\3.1.1\ folder in C drive.
As well as the reference was also available in the Project package
Follow the below steps to resolve the error,
Goto your project and Expand Dependencies tab
Expand packages and search for Microsoft.visualstudio.web.codegeneration.design(3.1.1) package
Right-click on the package name and Remove the package.
Build the project and try.

Only reinstall package.
open Tools-> NuGet package Manager-> Package Manager Console
Update-Package -reinstall

Related

Could not locate the assembly "System.Fabric"

Seeing the following build warning in command prompt,
D:\CxCache\MsBuild.Corext.14.0.23107.9\v14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3245: Coul d not resolve this reference. Could not locate
the assembly "System.Fabric". Check to make sure the assembly exists
on disk. If this reference is required by your code, you may get
compilation errors.
followed by the error,
D:\CxCache\MsBuild.Corext.14.0.23107.9\v14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3245: Could not resolve this reference. Could not locate
the assembly "System.Fabric". Check to make sure the assembly exists
on disk. If this reference is required by your code, you may get
compilation errors. For SearchPath
"{TargetFrameworkDirectory}".
Considered "D:\CxCache\DotNetFxRefAssemblies.Corext.4.6.0\System.Fabric.dll", but
it didn't exist.
Considered "D:\CxCache\DotNetFxRefAssemblies.Corext.4.6.0\System.Fabric.exe", but
it didn't exist.
My change,
From:
package id="Microsoft.ServiceFabric" version="5.2.207"
To:
package id="Microsoft.ServiceFabric" version="6.3.187"
I am new to Nuget and msbuild. Looking for starting pointers...Please help.
Okay, I did some research and nuget has Microsoft.ServiceFabric there are 2 ways to do this. Open the Package Manager (nuget) console, or open nuget package manager.
The Package Manager is located in visual studio (Tools > Nuget Package Manager > Package Manager) and/or around that area, that one is easy to look up. For installing you want to enter this into your package manager.
[Install-Package Microsoft.ServiceFabric -Version 7.0.466] or any version that follow in your visual studio project. Looking on nuget (dot) org you can find it easily and all the accepted versions, I already said this and I'll say it again. Be sure to be in your project when you do this and the reference will be added.

VisualStudio Online and pack Nuget packages

I'm creating a repository in Visual Studio OnLine when I have some class libraries. I want to create (pack) and push for each of them a Nuget package in my private repository.
In a project there is a dependency on Microsoft.ApplicationInsights. If I create on my computer a package, it is working fine. If I try to do the same on Visual Studio Online I have an error:
The nuget command failed with exit code(1) and
error(NuGet.CommandLine.CommandLineException: Unable to find
'Microsoft.ApplicationInsights.2.6.4.nupkg'. Make sure the project has
been built.
This is the full error:
NuGet Version: 4.1.0.2450 Attempting to build package from
'Vu.Common.Logging.AppInsightsEvent.csproj'. MSBuild auto-detection:
using msbuild version '15.6.85.37198' from 'C:\Program Files
(x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin'. Use
option -MSBuildVersion to force nuget to use a specific version of
MSBuild. Packing files from
'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release'.
Using 'Vu.Common.Logging.AppInsightsEvent.nuspec' for metadata. Add
file
'D:\a\1\s\Vu.Common\Vu.Common.Logging.AppInsightsEvent\bin\Release\Vu.Common.Logging.AppInsightsEvent.dll'
to package as 'lib\net462\Vu.Common.Logging.AppInsightsEvent.dll'
Found packages.config. Using packages listed as dependencies
NuGet.CommandLine.CommandLineException: Unable to find
'Microsoft.ApplicationInsights.2.6.4.nupkg'. Make sure the project has
been built. at
NuGet.CommandLine.ProjectFactory.AddDependencies(Dictionary`2
packagesAndDependencies) at
NuGet.CommandLine.ProjectFactory.ProcessDependencies(PackageBuilder
builder) at NuGet.CommandLine.ProjectFactory.CreateBuilder(String
basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded,
PackageBuilder builder) at
NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand() at
NuGet.CommandLine.Command.ExecuteCommandAsync() at
NuGet.CommandLine.Command.Execute() at
NuGet.CommandLine.Program.MainCore(String workingDirectory, String[]
args)
My configuration is easy. I added two Nuget, the first it is packing my nuget and the second push in the repository it.
I tried different configuration and also created manually the nuspec file but without result.
Any ideas? What is the right way to pack and deploy nugget packages?
Update
During the build the error I saw is like that:
Then I tried to create the same package on my local folder. I've only removed OutputDirectory, NonInteractive and the initial path. I can create the package without problem.
According to the error message, seems your nuget packages failed to download the referenced nuget packages from url.
Instead of using customize nuget command, you could try to use Package: NuGet extension directly and select Pack NuGet packages and try agian.
Also enable Verbose Debug Mode to get more detail log by add system.debug=true for troubleshooting and narrow down the issue.

Assembly from nuget has strong name but cause build error of 'strongly-named assembly is required'

I successfully installed 'LiveCharts.Wpf' & 'LiveCharts' packages from NuGet, I use them in my code but when I want to build the project I get this error:
Unknown build error, 'A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Note that those packages have a strong name. You can see it in the attached image:
Thanks.
I had similar issue, after publishing and trying to build a newer version with VS2017. I switched, in the properties->publish -> application files, for the nuget settings to include. From:
To:
I still don't know what caused this problem, but I opened a new project and installed the packages with 'package manager console' and not from 'NuGet Package Manager' and it's work.

Installing Nuget package throws "An item with the same key has already been added" error

I have an MVC3 application which has a mixture of directly referenced binaries with paths such as:
C:\Users\Nick\Desktop\app\AppNamespace\bin\ActionMailer.Net.dll
and binaries installed via NuGet like this:
C:\Users\Nick\Desktop\app\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll
I am trying to get the app to build only using NuGet so we don't have to move dlls into remote repositories
Taking ActionMailer as an example, here is what I am doing
verify the package isn't installed in the NuGet Package Manager
remove the reference to ActionMailer.Net
install the package via Package Manager Console which throws the following error:
Attempting to gather dependency information for package 'ActionMailer.0.7.4' with respect to project 'NameSpace', targeting '.NETFramework,Version=v4.5' Install-Package : An item with the same key has already been added.
This Stack Overflow post suggested finding what the stacktrace shows:
"$error[0].exception.stacktrace" An item with the same key has already been added. Unable to find type [T4Scaffolding.ScaffolderAttribute].[0].exception.stacktrace
I have tried looking up the T4Scaffolding.ScaffolderAttribute error but I haven't been able to find a solution

Error loading EntityFramework 4.3.1

I created an MVC application in C#. I created a new project in my solution called PhoneDomain. The purpose of this is to separate my data and domain layer from the actual problem. I right clicked on the project and went to "Add Library Package Reference" and I attempted to add the EntityFramework package (version 4.3.1). It said "Operation Failed" "This package contains an init.ps1 file and needs to be installed from the Package Manager Console".
So I opened the Package Manager Console in Visual Studio and typed the following into the console window:
install-package EntityFramework -project PhoneDomain
After a couple seconds, it installed the package and said Successfully added 'EntityFramework 4.3.1' to PhoneDomain
The problem is, when I run my application, I get the following error message: Could not load file or assembly 'EntityFramework, Version=4.3.1.0, Culture=neutral' or one of its dependencies. The system cannot find the file specified.
The reference in the PhoneDomain is definately there and the the Copy Local property is set to True.
Can anyone tell me what is going on here?
Check your web.config for assembly references. There may be a rogue reference in there.
UPDATE:
Also make sure ALL projects have the necessary reference...

Categories

Resources