How to build asp.net core stack from source? - powershell

I am trying to build asp.net stack from source, i followed instruction documented here but when running build command i ended up with The module '.build' could not be loaded. For more information, run 'Import-Module .build'. error message.I googled for the issue but with no luck.Could anybody shed some light on this?
Here is an attachment from powershell console :

Related

Custom Powershell Module fails to import in Azure Funtion

I have an Azure function app that runs some Powershell and as part of it I am importing a custom Powershell module I wrote. I had tested it and it worked, but when I went to test it again it no longer imports the module correctly, it instead gives the following error and I cannot determine why. Because the Powershell on the Azure function is Powershell Core 7.2 and my module requires Windows Powershell 5.1 (its accessing funtions from the AzureAD Powershell module to update a users password and assign a license to that user) I am calling the Import-Module with the -UseWindowsPowershell parameter to enable compatibility.
I've tried several solutions but none of them seem to address the problem, so any help would be greatly appreciated.
ERROR: Failed to generate proxies for remote module 'AzureCon'. The -OutputModule parameter does not resolve to a path, and a user module path cannot be found for the provided name.
I believe this error is not due to PowerShell Code issue.
It is an environment setting variable (PSModulePath) has to be checked.
($env:PSModulePath).split(";")
It was an issue with PSModulePath. Something put in Windows\System32\WindowsPowerShell\Modules into the PSModulePath. I'm guessing when 7 tried to load utility it loaded 5.1 utility instead and blew up. Fun troubleshooting though. Now need to find root cause.
Refer to the Import-Module: Failed to generate proxies for remote module
Update:
Similar ticket raised in MSFT Q&A and it is identified as a new function runtime release broke this functionality.
Thanks to #MayankBargali for the workaround given to fix this issue.
Apology for the inconvenience due to this issue. The workaround is to update the runtime version to 3.8.2.0 by updating the FUNCTION_EXTENSION_VERSION in tha application configuration of your function app if you are running PowerShell function version 7.
The product team will be fixing the issue in the latest runtime.
For the tracking of this issue, refer to the MSFT Q&A 920865.

Why does running a .NET Core application from VS Code cause an error to occur?

I am trying to run a .NET Core version 1.1 application from inside VS Code version 1.8.1. When I push the F5 button, the console appears at the bottom of the screen. After enabling tracing, I get this output:
Reading fx resolver directory=[C:\Program Files\dotnet\host\fxr]
Considering fxr version=[.]... Considering fxr version=[..]...
Considering fxr version=[1.1.0]... Detected latest fxr
version=[C:\Program Files\dotnet\host\fxr\1.1.0]... Resolved fxr
[C:\Program Files\dotnet\host\fxr\1.1.0\hostfxr.dll]... Loaded library
from C:\Program Files\dotnet\host\fxr\1.1.0\hostfxr.dll Tracing
enabled
--- Invoked hostfxr [commit hash: 928f77c4bc3f49d892459992fb6e1d5542cb5e86] main Own DLL
path=[C:\Program Files\dotnet\dotnet.dll] Checking if CoreCLR path
exists=[C:\Program Files\dotnet\coreclr.dll] Detecting mode... CoreCLR
present in own dir [C:\Program Files\dotnet] and checking if
[dotnet.deps.json] file present=[0]
--- Executing in split/FX mode... Detected a non-standalone application, expecting app.dll to execute. Application 'build' is not
a managed executable.
Also, a bar appears at the top of the screen that says:
The preLaunchTask 'build' terminated with exit code 2147516564.
When I click the "show problems" option, a blank problems tab appears that contains the message:
No problems have been detected in the workspace so far.
Why is VS Code refusing the build the project, and why are there no problem messages? I am only posting this on SO, because Google was not helpful, and because the VS Code GitHub page recommends asking questions here first.
UPDATE
This problem was caused by me having put coreclr.dll in C:\Program Files\dotnet. I did this, because of a different problem related to building the app. I thought that, since the output mentions it is looking in this directory, it might be helpful to put this file here. It turns out that this was a very bad idea, as it just complicated the problem! LOL!
You can get this error if you have problems in:
packages - please check if all packages are ok and restored successfully
core version - check that core installed with correct version
.net tools - please check if version of .net tools correct.
Can you try visual studio?

How can I run an Entity Framework 7 migration on a remote database using Powershell?

In a standalone entity framework 7 project (note, not a MVC project with an entity context where the command DNX might be used), how can I run a migration on a remote database using Powershell?
I am currently using Entity Framework 7.0.0-rc1-final with Visual Studio 2015 (14.0.23107.0).
At the moment there is no way you can use pure PowerShell to do this because a utility like migrate.exe does not exist yet and importing the EF PS modules is not possible as they require a Package Manager PowerShell Host.
Here are some ideas how you can update a remote db in EF7:
One thing you could do is use the package manager console commands from within VS as usual to update the remote db. You can create a second context that has the remote db connection string and use the update-database command specifying the context to use. These commands require the following package in EF7:
https://www.nuget.org/packages/EntityFramework.Commands/.
I have done this successfully in a class lib project.
Another solution would be to use DNX commands by creating a DNX project instead of a classic one. DNX projects are not just for web sites, it is just another type of project. Here is a link that shows how to create a console app DNX project:
http://docs.asp.net/en/latest/dnx/console.html.
So with this type of project you can use the provided DNX commands that you seem to be aware of.
I hope this helped. Maybe we can give more help if you describe your situation and your end goal in more detail.
Answer too long as a comment, so adding it here...
Have you looked at this article and the links in the answer?
From that answer
The problem with importing the module into a PowerShell console is that I believe the module expects to run in a context where it has a Visual Studio DTE object available. That environment is the NuGet Package Manager Console. This issue has been brought up before. Check out this blog post and this SO question.
This blog post shows how to write code that does migrations.
What might be helpful for readers of this question is what you have tried, what is not working, and other information that might help solve your problem.

System.IO.FileNotFoundException: Unable to resolve assembly 'nameOfDll'

Have a Visual Studio 2010 application that use Entity Framwork to bind controls. After publishing the application to IIS 7.5, I get the following error stack trace message.
This does not happen when run local!
System.IO.FileNotFoundException: Unable to resolve assembly 'nameOfDll'.
After many hours and days of research and following all suggestions, the error still is rendered.
I made sure that all references were loaded locally and set CopyTo: to true for each reference. The only other suggestion was to set the ContextTypeName in the EntityDataSource definition. I am not certain the correct value to enter.
I have also encountered this on IIS 6.0.
You will often get this type of error when there is a version or culture mismatch for a DLL where a specific version and/or culture is demanded.
Use the Fusion Log Viewer (Fuslogvw) to log binding errors. NOTE: You must run it as Administrator or it will silently fail to log.
http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx
The output of Fuslogvw will tell you exactly what attempts were made to satisfy binding requests, and why they failed.
If this is in an environment where you can do so, stop IIS, start Fuslogvw, start Fuslogvw logging, then start IIS again and browse to the problematic website. If you cannot stop IIS, I believe it should be sufficient to recycle the relevant application pool with Fuslogvw running and logging.

TLBIMP.EXE - Error TI0000 - *.dll is not a valid type library

While building our project on the Build Server, the compilation fails with the error message:
TlbImp: error TI0000 : The input file 'C:\*.dll' is not a valid type library.
We tried to manually invoke the TlbImp command thru the VS2005 Command Prompt and the same error message appeared.
To investigate, we tried to create a clean build environment in a Virtual Machine (Vbox), then we run the build there. It went fine.
We also tried to invoke the same TlbImp command thru the VS2005 Command Prompt and it succeeded.
With that, we are assuming that there is nothing wrong with the DLL. Do you have any idea what scenario(s) can cause this problem?
EDIT:
Found the problem, see my answer. ;)
If it is working on one machine and not on the other, then most probably some dependency of this DLL is missing in your machine. Inspect the dll through DependencyWalker and you will get to know that which dependency hasn't been built properly.
After closer inspection, we found out that the environment variables on the official build server is FUBAR.
The official build server was installed with both VS2003 and VS2005. Our project is VS2005. The build script is using components from VS2003 instead of VS2005 because the VS2003 paths (Path, LIB, LIBPATH and INCLUDE) were first declared before the VS2005 paths.
A simple SET command to override the environment variables with the "correct ones" fixed the build!
Thanks!