Makefile Tools doesn't work for some reason - visual-studio-code

I want to use the make command to compile my files. I installed Makefile Tools from the Marketplace, created a Makefile in my directory, but when I use the make command, it throws an error:
make : Имя "make" не распознано как имя командлета, функции, файла
сценария или выполняемой программы. Проверьте правильность написания
имени, а также наличие и правильность пути, после чего п овторите
попытку. строка:1 знак:1
make main.cpp
+ CategoryInfo : ObjectNotFound: (make:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
which means that make was not found. I didn't touch any configuration files. I searched the Net and found nothing about it.

It's helpful to us if the question provides more details about your environment: what is "Makefile Tools"? Which "Marketplace"? What operating system are you using? Also, when formatting command output in your question please use the "Code Sample" format, not the "Blockquote" format, so that SO doesn't reformat the text.
If you mean the Visual Code extension "Makefile Tools", then that extension only provides an interface to running make and managing Makefiles; it doesn't provide the actual make program itself.
If you're using a Windows system you will have to go find a make program and install it on your system before you can run it. There are various options depending on what environment you want to build in.

Related

Simplest way to pull a Microsoft DLL into a VS project?

I need to download Microsoft.IdentityModel.Clients.ActiveDirectory.dll v3.19.8.16603 into my .NET project. I would have thought this is a simple task, but I'm running into one problem after another, and I fear these are all noob problems. I have tried 3 different approaches:
APPROACH #1
VS2019 - NuGet Package Manager -> Manage NuGet Packages for Solution
Why "No packages found"? I know it exists.
APPROACH #2
VS2019 - NuGet Package Manager -> Package Manager Console
PM> Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Version 3.19.8
Result:
Attempting to gather dependency information for package 'Microsoft.IdentityModel.Clients.ActiveDirectory.3.19.8' with respect to project '_JunkTest', targeting '.NETFramework,Version=v4.7.2'
Install-Package : Package 'Microsoft.IdentityModel.Clients.ActiveDirectory 3.19.8' is not found in the following primary source(s): 'C:\Program Files (x86)\DevExpress
21.2\Components\System\Components\Packages,C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. Please verify all your online package sources are available (OR)
package id, version are specified correctly.
At line:1 char:1
+ Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Vers ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
APPROACH #3
VS2019 - Developer Command Prompt
dotnet add package Microsoft.IdentityModel.Clients.ActiveDirectory --version 3.19.8
Result:
Determining projects to restore...
Writing C:\Users\<redacted>\AppData\Local\Temp\tmpF88E.tmp
info : Adding PackageReference for package 'Microsoft.IdentityModel.Clients.ActiveDirectory' into project 'D:\Dev\Git\_JunkTest\_JunkTest.csproj'.
error: Error while adding package 'Microsoft.IdentityModel.Clients.ActiveDirectory' to project 'D:\Dev\Git\_JunkTest\_JunkTest.csproj'. The project does not support adding package references through the add package command.
In actuality, I don't even need a reference to that DLL in this project. I just need the DLL along with any of its dependencies so I can copy them into some other projects I have, but I don't want to muddy those by nugetting directly in. Or at least I want to figure it out in this junk project first. I'm really just looking for the easiest way to download the DLL(s).
https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/

Why is there an Error in ef Add-Migration

I have several class files. Now I am adding a new model class and tried to type add-migration InitialCreate but am getting the following error:
PM> add-migration InitialCreate
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Users\user\Documents\Visual Studio 2013\Pro
jects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operati
on is not supported. (Exception from HRESULT: 0x80131515)"
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 c
har:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
You cannot call a method on a null-valued expression.
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 c
har:50
+ $dispatcher = $utilityAssembly.CreateInstance <<<< (
+ CategoryInfo : InvalidOperation: (CreateInstance:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not load file or assembly 'file:///C:\Users\user\Documents\Visual Studi
o 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.PowerShell.dll' or one of its dependencies. Opera
tion is not supported. (Exception from HRESULT: 0x80131515)"
At C:\Users\user\Documents\Visual Studio 2013\Projects\DigitalHealthWebPrev\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:809 c
har:31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
PM>
Using the Package Manager, you need to re-install Entity Framework:
Uninstall-Package EntityFramework -Force
Then install it for each project:
Install-Package EntityFramework
Then do not forget to restart the studio.
https://stackoverflow.com/a/14994432/1845408
Used the command EntityFramework6\add-migration {migration name} instead. Microsoft changed the name of the command.
Just restart the visual studio and clean the solution and rebuild it again.
Make sure that VS in admin mode
In my case, it was a different entity-framework version between main project and the project containing DbContext.
I just updated version of package in both projects to v6.4.4
I had a slightly different case today, I'm wirting the details here in case that might help somebody. The error was referencing one of my assemblies instead, on which the assembly containing the EF DbContext was depending.
I solved it setting the referenced assembly to "Copy Local" "true" so it'd make a local copy when building for migrations and therefore be able to find it.
you need to re-install Entity Framework:
I went to "Manage Nuget Packages for Solution..." and updated all my packages. This worked for me.
Then I got another error Cannot bind argument to parameter 'Path' because it is null.
Setting another project as startup project other then my web app, before running any EF command in Package Manager Console, worked for me.
Whats missing are the dlls from (Solution Folder)/packages/EntityFramework.6.1.3/tools/.
Things I would try:
Nuget will keep a copy of the .nupkg you might find the missing files there ((Solution Folder)/packages/EntityFramework.X.Y.Z/) (Open the nupkg as zip)
If not you may have luck redownloading the package manually here https://www.nuget.org/packages/EntityFramework (Make sure you download the right packages. In your case it would be 6.1.3)
If that doesnt work you can retry one of the above solutions of completely removing and reinstalling EF but make sure you install the same version for each project.
Also there seem to be versions that dont include those files. For example as of writing this answer 6.3.0 actually doesnt include the dlls needed while 6.1.3 does. I also had success copying the dlls from an older version like 6.1.3 into the newer like 6.3.1 (Might give a warning but generally works as expected).

NuGet Pack .nuspec file returns "The replacement token 'version' has no value."

This is the error I got while trying to pack a project in Visual Studio 2013:
PM> NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Service.nuspec -Prop Configuration=Release
Attempting to build package from 'ITVizion.RTVizion.Service.nuspec'.
NuGet : The replacement token 'version' has no value.
At line:1 char:1
+ NuGet Pack C:\ITVizion\RTVizion\ITVizion.RTVizion.Service\ITVizion.RTVizion.Serv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The replacement...' has no value.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
What's wrong with this?
I found the problem:
Make sure you fill your project Assembly Information page.
You can access it right clicking your project in Visual Studio Solution Explorer. Select Application tab => Assembly Information... button.
In case anyone else has a similar error message, and finds that the error message does not go away even if the information is indeed specified in the Assembly Information, I figured out a fix. I don't see this documented in anyone else's answers, and note that this in fact contradicts what the docs say.
Once you've created SomeProject.nuspec with the various $id$, $author$, etc replacement tokens plus any any custom replacement values, the docs instruct you to then place SomeProject.nuspec** into the same directory as SomeProject.csproj, and run
nuget.exe pack SomeProject.csproj -Build
This did not work for me - I got errors about replacement tokens with no value.
However, what did work for me is to call
nuget.exe pack -Build
in the same directory as the nuspec and csproj files, without specifying which csproj or nuspec file to use. This successfully created the nupkg file with the replacement tokens appropriately substituted based on what I specified in the nuspec!
Hopefully this information will be useful to someone else out there!

Nuget scaffolding installation failure

I am trying to install scaffolding package in VS2010 SP1 in MVC4(aim is to user MvcMailer), here are the command I run
PM> install-package T4Scaffolding
PM> install-package MvcScaffolding
and installing T4Scaffolding gives me this error:
Import-Module : Could not load file or assembly
'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or
one of its dependencies. Operation is not supported. (Exception from
HRESULT: 0x80131515)
if I use installed it again, it installed but when I use Scaffolding command gives me this error
PM> Scaffolding Mailer.Razor UserMailer subs
The term 'Scaffolding' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and
try again. At line:1 char:12
+ Scaffolding <<<< Mailer.Razor UserMailer subs
+ CategoryInfo : ObjectNotFound: (Scaffolding:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I tried uninstalling and deleting the packages and re installing but no luck. I tried update command on both packages but nothing.
When I run import-module "dllpath"
I get same error message i.e.
Could not load file or assembly
'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or
one of its dependencies. Operation is not supported. (Exception from
HRESULT: 0x80131515)
Tried restarting VS after uninstall, install, reinstall all possible but nothing changed.
What I am doing wrong.
EDIT: I have tried to use power shell
PS C:\Windows\system32> import-module
"path\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll" Import-Module :
Could not load file or assembly
'file:///path\T4Scaffolding.1.0.5\tools\T4Scaffolding.d ll' or one of
its dependencies. This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded. At line:1 char:14
+ import-module <<<< "path\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll"
+ CategoryInfo : NotSpecified: (:) [Import-Module], BadImageFormatException
+ FullyQualifiedErrorId :
System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand
It gives error "This assembly is built by a runtime newer than the currently loaded runtime and cannot
be loaded." I believe here is the start failing point. Any idea? how to fix this first.
Solved, nothing new in solution but had to do a lot of search, hit and trial, I had VS2010 SP1, default installation. Project was loaded from network drive.
Import-Module : Could not load file or assembly 'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or one of its dependencies. Operation is not supported.
Above error message comes from VS, because it can't load things from remote source.
Fix: Go to your Visual Studio devenv.exe location. i.e. default C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE
in devenv.exe.config add line in runtime section i.e. :
<configuration>
<configSections>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<requiredRuntime version="v4.0.30319" safemode="true"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
I wish error message was more proper at first place but I should also read more.

Entity Framework Migrations Issue

I'm having an issue with EF Migrations, specifically with getting the "Enable-Migrations" command to work. When I execute the command in the Package Manager Console I receive the following error:
System.Management.Automation.PSArgumentException: Cannot find type System.Data.Entity.Migrations.MigrationsCommands]: make sure the assembly containing this type is loaded.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
Cannot find type [System.Data.Entity.Migrations.MigrationsCommands]: make sure the assembly containing this type is loaded.
It seems to me that the NuGet console can't find the MigrationsCommands type from my EF assembly. I've checked and the assembly is the most recent one (4.3.1), and from within object browser I am unable to find the MigrationsCommands type or namespace.
UPDATE: I still do not have a resolution, but it looks like the source of the issue is in the following output when I run the "Install-Package EntityFramework" command within the Package Manager Console. The error is here:
Unable to find type [ConnectionFactoryConfiguratorInvoker]: make sure that the assembly containing this type is loaded.
At C:\...\packages\EntityFramework.4.3.1\tools\install.ps1:36 char:39
+ [ConnectionFactoryConfiguratorInvoker] <<<< ::Invoke((Join-Path $toolsPath "EntityFramework.PowerShell.dll"), $project)
+ CategoryInfo : InvalidOperation: (ConnectionFactoryConfiguratorInvoker:String) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
After several hours of searching I have found the solution. They key is located Here in Phil Haack's response to "Chris" regarding Reflector 6.5. I had Reflector installed (version 7.0 curiously enough) and the Reflector Add-On enabled within VS2010. Upon researching the NuGet FAQ I uninstalled Reflector and disabled the VS2010 Add-In. This seems to have resolved the issue as I can now both "Install-Package EntityFramework" and "Enable-Migrations" without issue.
Disable the Add-in within VS2010
(Tools-Options-Environment-Add-In/Macros Security/Allow Add-in components to laod)
Disable the ReSharper if installed within VS2010
(Tools-Options-ReSharper-Suspended)
Restart VS2010, the issue will be resolved.