Error "SolutionDir property not found in project" when installing SlowCheetah - nuget

I wanted to try out SlowCheetah so I:
Created a test web project (ASP.NET MVC 4 Web Application in Visual C#)
Enabled Package Restore by checking "Allow NuGet to download missing packages during build"
Installed SlowCheetah via Package Manager Console with Install-Package SlowCheetah.
Since I'd like this to work with a build server later on, I got a bit worried when this error message shows up:
SolutionDir property not found in project [TestWeb].
Have you enabled NuGet Package Restore? This is required for build server support.
You may need to enable it and to enable it and re-install this package
What does it mean and why can't it find SolutionDir?

Related

#postsharp Unable to compile after adding PostSharp.Community nuget package (on a Mac)

I'm using a Mac with Visual Studio 2019. I've added nuget packages: PostSharp and PostSharp.Community. I have NOT changed any code. I wasn't NOT prompted to select a license. I'm simply trying to compile, and I get the following errors.
/var/tmp/postsharp/cache/DependencyRestore/6.0.101/net6.0-sdk6.0.101-osx-x64--ps6.10.6.0-cf0d89f.deps.proj
: error NU3034: Package 'System.ValueTuple 4.4.0' from source
'https://api.nuget.org/v3/index.json': This package is signed but not
by a trusted signer.
/var/tmp/postsharp/cache/DependencyRestore/6.0.101/net6.0-sdk6.0.101-osx-x64--ps6.10.6.0-cf0d89f.deps.proj
: error NU3037: Package 'System.Security.Cryptography.ProtectedData
4.4.0' from source 'https://api.nuget.org/v3/index.json': The repository primary signature validity period has expired.
My project is targeting framework NetCore3.1. I don't know why PostSharp mentions net6.0.
As soon as I remove the PostSharp packages, it compiles fine.
Any help, would be greatly appreciated.
Thanks,
Jason
You probably have .NET 6.0 SDK installed on the machine and it is the active SDK (the highest version is usually used by default). PostSharp always executes under the runtime associated with the current SDK.
You should use the global.json file to specify SDK for .NET Core 3.1. This would cause PostSharp to run on .NET Core 3.1.
If this does not help, it means that PostSharp's dependency packages cannot be installed from nuget.org.
You can disable PostSharp's dependency restore by setting DependencyRestoreDisabled=True (either as env var or MSBuild property) and make sure that the project that was generated into /var/tmp/postsharp/cache/DependencyRestore/<SdkVersion>/<id>.proj has all it's dependencies present in the \var\tmp\postsharp\NuGetFallback directory.
Disabling the dependency restore disables automated checks and presumes that PostSharp can find all its dependencies on the machine.
I added the global.json, removed SDK 6.x. Set PostSharpDependencyRestoreDisabled=True and then I had to manually add all the referenced Nuget packages. It was annoying, but at least it works now.
Daniel, wetween both your responses, I was able to get it fixed!
Thanks!

NuGet Installation of EntityFramework

I have been doing some testing between VS2015 and VS2017. I created a .NetFrameworkApp and a .NetCoreApp website in both systems. I then installed a couple of packages in all four websites; in particular EntitytFramework. It installed in both VS2015 websites and the VS2017 .NetFrameworkApp website without problem but it wouldn't install in the VS2017 .NETCoreApp website. I got the following error messages.
net45 (.NETFramework,Version=v4.5)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'.
Time Elapsed: 00:00:01.4470850
Error Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'. 0
Anyone any idea why that should be. I am assuming it should install otherwise how would you use CodeFirst etc.
The "EntityFramework" package is not supported with .NET Core App, use the:
Microsoft.EntityFrameworkCore.SqlServer
package instead

NuGet cannot restore AutoMapper 5.1.1 on TeamCity 10

With NuGet 3.3.0 we get the following error when restoring AutoMapper 5.1.1. Other packages restore successfully:
[11:49:53] [restore] Unable to find version '5.1.1' of package 'AutoMapper'.
[11:49:53] [restore] Process exited with code 1
There was an issue we had where we were unable to restore this package in Visual Studio 2013 on our dev machines unless we updated the NuGet package manager.
If we build the project in Visual Studio 2013 on the TeamCity server, the package restores successfully, leading us to believe that it's the NuGet version on the build agents that needs updating.
We tried to upload the NuGet.CommandLine.3.4.3.nupkg via the TeamCity | Tools menu, however TeamCity complains that it's not a valid NuGet package because it doesn't contain tools\NuGet.exe, even though it does!
We did manage to successfully upload Nuget.CommandLine.3.6.0-beta1.1839.nupkg, however that gives us a different error when the build step attempts to run.
So we're stuck. Has anyone out there had this issue and managed to resolve it?
Uploading NuGet.CommandLine.3.5.0-beta-final.nupkg to TeamCity (Administration => Tools => NuGet.exe => Add Version) and setting the NuGet build step to version 3.5.0-beta-final successfully resolved our issue.
I got the package from: https://dotnet.myget.org/feed/nuget-build/package/nuget/NuGet.CommandLine/3.5.0-beta-final

Visual Studio 2013 - Error occurred while trying to restore packages. The underlying connection was closed.

In Visual Studio 2013, NuGet package manager fails to restore packages. When clicking Manage NuGet Packages on the project, NuGet states "Some NuGet packages are missing from this solution. Click to restore from your online package sources.". After clicking "Restore", the following error appears...
Manage NuGet Packages Window
Error occurred while trying to restore packages. The underlying connection was closed.
If you build the project, the output window shows the following errors...
Build Output Window
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
NuGet Package restore failed for project MyProject: The underlying connection was closed: An unexpected error occurred on a send..
NuGet package restore failed.
Any ideas?
This turned out to be an issue with the CDN host that Microsoft was using didn't have SSL enabled. Trying to access the CDN URL for the RazorGenerator.MVC package was failing. If I changed the response returned to non-SSL via Fiddler it worked just fine.
It seems Microsoft just fixed their CDN issue - case closed.

Why do I get InvalidDataException installing from local Nuget.Server?

So I installed a local NuGet server using the NuGet.Server package and VS2012. Everything seems to work fine, I have a package that I created based on a web application. The server knows about the package (i.e. I can list it using "nuget list"), but when I try to install it on the target machine, I get an InvalidDataException with a message the the Archive file cannot be size 0.
I am using Win7 x86 and the command-line nuget.exe utility from within PowerShell. Nuget.exe is in \windows.
Also, I can install packages from the public nuget.org server on this target machine.
In an interesting twist, I am able to install the very same internal package from the very same internal server when I run the same command from within the Package Manager Console in VS2012. I have verified that the nuget.exe versions are the same.
Any help on this?
Thanks,
Matthew
Turns out there was an issue with the local Nuget cache. Once I cleared it out, the package installed correctly.