Build solution and start IIS Express with .bat file (without opening Visual Studio) - visual-studio

For local development purposes, I'd like to just run a .bat file to build my solution and run it on iis express.
Here's what I've got:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
devenv "C:\Path\To\Solution.sln" /build debug
echo "Web build completed. Launching IIS..."
CD "C:\Program Files (x86)\IIS Express\"
iisexpress /path:C:\Path\To\Webroot /port:58389 /clr:v4.0
This does indeed successfully build the solution and start iis express.
Here's my output:
[vcvarsall.bat] Environment initialized for: 'x86'
Microsoft Visual Studio 2017 Version 15.0.28010.2050.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: PDS.Utilities, Configuration: Debug Any CPU ------
2>------ Build started: Project: PDS.Ibex, Configuration: Debug Any CPU ------
...
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
"Web build completed. Launching IIS..."
Copied template config file 'C:\Program Files (x86)\IIS
Express\AppServer\applicationhost.config' to 'C:\Users\CXSVH9\AppData\Local\Temp\2\iisexpress\applicationhost2018116141435830.config'
Updated configuration file 'C:\Users\CXSVH9\AppData\Local\Temp\2\iisexpress\applicationhost2018116141435830.config' with given cmd line info.
Starting IIS Express ...
Successfully registered URL "http://localhost:58389/" for site "Development Web Site" application "/"
Registration completed
IIS Express is running.
Enter 'Q' to stop IIS Express
When I fire up localhost, I get the following output in Command Prompt:
Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0
Request started: "GET" http://localhost:58389/login.aspx
Request ended: http://localhost:58389/login.aspx with HTTP status 200.0
200's. So, that's good.
But in the browser, I get the message: "Requested view is not available" (a message peculiar to my environment, I'd guess — I just started with this codebase).
Of course, if I start the project from inside Visual Studio, everything works fine. But, as a frontend dev, I'd rather skip that and just fire the project up with a script and use VS Code to edit my static files.
Any thoughts on why this is not loading assets from my web project?
The really frustrating thing is I had this working before, but accidentally deleted my original .bat file and can't get things sussed again.
UPDATE
When I clear cache in the browser, it does GET all my assets with 200's. But still, "Requested view is not available."

Let me somewhat sheepishly answer my own question: I needed to start an additional web service that our website depends upon. This was as simple as writing another batch file to start that web service using the same technique above, but changing the path and the port to their appropriate values.

Related

not able to install visual studio 2022 using visual studio installer

I have downloaded visual studio installer from "https://visualstudio.microsoft.com/downloads/"
once its downloaded the installer file, when I click on install it says "Getting visual studio installer ready" and nothing happens after that. my internet connection is good and able to browse and download other files.
Tried this solution as well https://learn.microsoft.com/en-us/answers/questions/216897/visual-studio-2019-error-unable-to-download-instal.html and also tried after restarting machine. still having the same problem. you can find the screenshot for more information.
can anyone suggest what could be the issue. thanks
I could find the following log
[5/11/2022, 16:53:28] === Logging started: 2022/05/11 16:53:28 ===
[5/11/2022, 16:53:28] Executable: C:\Users{username}\Downloads\vs_Community.exe v15.9.28307.1974
[5/11/2022, 16:53:28] --- logging level: standard ---
[5/11/2022, 16:53:28] Directory 'C:\Users{username}\AppData\Local\Temp\481074b13093fff3a2' has been selected for file extraction
[5/11/2022, 16:53:28] Extracting files to: C:\Users{username}\AppData\Local\Temp\481074b13093fff3a2
[5/11/2022, 16:53:28] Extraction took 265 milliseconds
[5/11/2022, 16:53:28] Executing extracted package: 'vs_bootstrapper_d15\vs_setup_bootstrapper.exe ' with commandline ' --env "_SFX_CAB_EXE_PACKAGE:C:\Users{username}\Downloads\vs_Community.exe _SFX_CAB_EXE_ORIGINALWORKINGDIR:C:\Users{username}\Downloads"'
[5/11/2022, 16:55:43] The entire Box execution exiting with result code: 0x0
[5/11/2022, 16:55:43] Launched extracted application exiting with result code: 0x138c
[5/11/2022, 16:55:43] === Logging stopped: 2022/05/11 16:55:43 ===
in your host file(C:\Windows\System32\drivers\etc\hosts) insert this line and enjoy
93.184.215.201 download.visualstudio.microsoft.com
There is currently an issue with Microsoft's Installer Backend.
Have a look here for the Microsoft ticket.
I had this problem when trying to install VS 2022 in a virtual machine. Later on ended up in getting an offline layout of the whole installer into a folder in host machine.
Try the below command to create an offline installer in the disk.
VisualStudioSetup.exe --layout C:\VSLayout --add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --includeRecommended --includeOptional
You will get the whole installer in a folder such as shown below.
Refer this link for more options.
Try to turn off windows firewall and relaunch the visual studio installer, it works for me.

ASP.Net Core launch website via Visual Studio vs. Command Line

Environment:
Microsoft Visual Studio Community 2019
Version 16.3.9
VisualStudio.16.Release/16.3.9+29509.3
Microsoft .NET Framework
Version 4.8.03752
I created an EMPTY ASP.NET Core 3.0 web project (just learning .Net Core - so trying to keep things simple).
When I build the project (Configuration = Debug) and then launch the website, the Visual Studio output window shows the following:
Starting IIS Express ...
Successfully registered URL "https://localhost:44308/" for site "website0" application "/"
Registration completed for site "website0"
IIS Express is running.
The output shows the website is running on port: 44308, If I understand correctly, the port number comes from the launchSettings.json file which VS uses when the website is launched:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64501",
"sslPort": 44308
}
However, I typically use COMMAND LINE tools to build, deploy and run (much easier to document text commands rather than take screen snapshots of GUI tools that change every year).
When I build and publish the website to a test directory, and then launch the website using the dotnet command:
> dotnet website0.dll
The console output shows the following:
info: Microsoft.Hosting.Lifetime[0]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
Now listening on: https://localhost:5001
My questions:
I cannot find the port numbers in any configuration file (.json or web.config) within the published directory - so where are these port numbers coming from?
How can I configure / control which ports are used when the website is published to either a test or production environment (using command line tools)? - is this done via a .pubxml file? If so, what node(s) must be included within the .pubxml file? ... Or is this done via some other config file when the website is launched, i.e.: web.config?
Thanks in advance.
May have found the answer to the 5000 and 5001 ports at:
Endpoint configuration

Failed to start process with commandline VSIISExeLauncher.exe

I just updated my project from ASP.Net Core from 2.1 to 2.2.
When I start debugging my application using visual studio.
My application compiled and run.
Suddenly, it stopped and exited debugging mode.
When I checked Event Viewer, there is an error displayed:
Application '/LM/W3SVC/2/ROOT' with physical root '(my project path)' failed to start process with commandline 'c:\program files (x86)\microsoft visual studio\2017\community\common7\ide\extensions\microsoft\web tools\projectsystem\VSIISExeLauncher.exe -argFile "(temp)\tmpED0C.tmp"' with multiple retries. The last try of listening port is '44386'. See previous warnings for details
Any helps ?
Thanks,

HTTP Error 502.5 - Process Failure - .net core 2.0 to AWS EB

I'm getting this error after deploying my API to AWS Elastic Beanstalk.
Steps to reproduce
File -> New -> Project
ASP.NET Core Web Application
ASP.NET Core 2.0
Web API
F5: OK
Publish to AWS Elastic Beanstalk... (via AWS Tollkit for Visual Studio 2017)
HTTP Error 502.5 - Process Failure
Additional info
Visual Studio 2017
64bit Windows Server 2012 R2 v1.2.0 running IIS 8.5
I've already tried looking up many other questions, but to no success.
Log
2018-01-15T13:27:21.000Z Error 0:(0) IIS AspNetCore Module - Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical root 'C:\inetpub\AspNetCoreWebApps\app\' failed to start process with commandline 'dotnet .\WebApplication2.dll', ErrorCode = '0x80004005 : 8000808c.
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
Adding the above code to the .csproj solved the problem.
I faced the same issue. After contacting AWS support, it turns out that there was a bug in my code [Release version].
I suggest the following steps to debug locally:
Publish your solution to a file
Open Command Prompt in the published folder
Run "dotnet Your.Main.App.dll"
Most probably you will see an exception
Sometimes we forget to test our solutions in Release mode.
Cheers!

Playback.initialize() method failed in test Agent 2013 installed machine

I have created a Winform App to Run Coded UI test scripts recorded in VS2013. Its finely running in the VS2013[update 4] installed machine. But when try to run this in Test Agent 2013 installed machine, the exception has been thrown at Playback.Initialize() method , as "The following package failed to load: "C:\Program Files (x86)\Common Files\Microsoft Shared\VSTT\12.0\Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll"
I tried adding this dll in the reference but still the problem persists. I have added the following references. And I am sure that these dlls are available in the mentioned path.
Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Microsoft.VisualStudio.TestTools.UITest.Common.dll
Microsoft.VisualStudio.TestTools.UITest.Extension.dll
Microsoft.VisualStudio.TestTools.UITest.Extension.IE.dll
Microsoft.VisualStudio.TestTools.UITest.Framework.dll
Microsoft.VisualStudio.TestTools.UITest.Playback.dll
Microsoft.VisualStudio.TestTools.UITesting.dll*
In that machine, only Test agent 2013 is installed and Configured for "Interactive Process" . Neither Test Controller is installed nor configured with any other test Controller installed machine.
I tried to Run the scripts with MStest using Command Line. Its running.
I have tried a lot by adding/removing many Coded UI dlls. But still the problem persists. Did I miss something? Thanks in advance.

Resources