Refreshing scripts in Package Manager Console - visual-studio

I am working on a PowerShell script intended to be run in Package Manager Console. I am able to add a script at the location returned by $profile in Package Manager Console, but I am not able to get the script to pick up changes without opening a fresh instance of Visual Studio.
According to this article, you should be able to reload the script by typing & $profile:
When you make changes to this user profile while Visual Studio is open Visual Studio will not detect any changes. You can type & $profile in the Package Manager Console to reload the profile.
I can use & $profile to verify my script does not have syntax errors, but it does not load the changes into the console session, which requires me to open a fresh Visual Studio session every time I make a script change.
For example, if I set my profile script to:
function foo{
Write-Output "bar"
}
and then open Visual Studio and Package Manager Console, I can type "foo" at the prompt and get back "bar". If I change "function" to "functionX" and run & $profile, I will get a ParserError in the console. But if I change the script body to Write-Output "baz" and then run & $profile at the console prompt, and I then type foo, I will still get back "bar". The code change is only picked up in a fresh instance of Visual Studio.
Is there a setting in Visual Studio that changes this behavior or a way to force the new script to be loaded?

When a script is executed without dot sourcing the variables, functions, etc. defined in that script are not added to the parent scope. By adding a period in front of the command will dot source the script and therefore add things in that parent scope.
In your specific case the command will be:
. $profile

Related

How can I step into a second shell script using Bash Debug in Visual Studio Code?

Using RHEL 7.9 (kernel 3.10.0-1160.6.1.el7.x86_64) I have a folder under my home directory containing a project:
/home/myself/project
This project contains Bash scripts, with one serving as the entry point that invokes some of the other ones.
I am using Visual Studio Code 1.52.0, and I have installed Bash Debug 0.3.9.
I can step through the entry point script at /home/myself/project/entry.sh, but when I set a breakpoint in /home/myself/project/second.sh (which gets called), it never breaks there.
I know it calls it because I see the output of second.sh.
The docs state "Currently debugger stops at first command".
Does this mean what I want to do is impossible with this tool? You can only debug one script at a time?
In addition, some shell scripts end up calling Python, which I also want to debug..

Error opening installation log file. Verify that the specified location exists and is writable

Problem
Attempting to install an application in Windows produces the following message:
Error opening installation log file. Verify that the specified location exists and is writable.
Solution
When you try to install application, a temp folder will be created, e.g.
Administrator\AppData\Local\{F2234F94-BDEB-4DBD-9ACB-D3AB5C8526C5}
{F2234F94-BDEB-4DBD-9ACB-D3AB5C8526C5}. Go to this directory and double-click the .MSI file and installation will restart and succeed.
This is a super easy solution:
Task Manager to kill explorer.exe, and then start a new instance of it.
Source: https://support.software.dell.com/kb/134431
Hit CTRL-ALT-DEL to launch Task Manager or right-click Desktop Task
Bar and choose Start Task Manager.
Click Processes Tab.
Locate and select the explorer.exe, click End Process.
You may need to select Show Processes from all users.
Click End Process to the prompt.
Your Desktop Icons and Desktop Bar will disappear.
Hit CTRL-ALT-DEL to launch Task Manager again.
Click File -> New Task (Run...).
Type explorer.exe and click Ok.
Your Desktop Task bar and Icons should appear again.
You can encounter this error if TMP and TEMP directories are different. This can result in installer files being written to TMP but when attempting to read those files using the TEMP value you see in the error.
Confirm that both values are referring to the same path. For example, from a command prompt:
set TEMP=%tmp%
and then run the installation again
Otherwise, it looks like an operating system permission issue.
If the procedure with stopping and starting explorer.exe fails, you can try:
In Command Prompt type
echo %temp%
Go to the folder in the output and check whether it is accessible. In case it is a file, remove it.

Customize install-log location in Visual studio setup projects

The SetUp projects from Visual Studio will have their installation logs under temp folder with the name format like " %temp%\ .log "
Can I have some customization done here, so that these installation logs will go to a specific folder ?
You can change the location that MSI logs are written to by invoking MSIEXEC with the /L <logfilepath> argument. If you cannot change the command line arguments (such as if the MSI is invoked by a setup executable), edit the registry to change the default log location.

Syntax: Setting the environment variables in Visual Studio 2008

I have been trying to add some environment variables in the Visual Studio 2008 for debugging purpose.
This is because I got this warning:
Warning The following environment variables were not found:
$(DEV_PATH)
$(APPFRAMEWORK_INC)
Here's what I did:
I went to Project > Properties > Configuration Properties > Debugging > Environment
And I have tried adding the following (one by one):
DEV_PATH="\ProjectName\source\"
"DEV_PATH=\ProjectName\source\"
$(DEV_PATH)="\ProjectName\source\"
"$(DEV_PATH)=\ProjectName\source\"
Because this is the path I need to set.
But unfortunately it does not work.
What exactly is the syntax?
As per the link: http://msdn.microsoft.com/en-us/library/ms173406.aspx, it is:
DEV_PATH=\ProjectName\source
But, I need to add multiple such environment variables; so, what must be the separator?
Also, please don't tell me that I can right-click on "My Computer" and modify the environment variables there; I want these environment variables only temporarily for this workspace specifically.
I have written a script that looks like:
set DEV_PATH=\ProjectName\source
set APPFRAMEWORK_INC=\ProjectName\app\framework\inc
And I run the script in a command console before launching Visual Studio.
Hence, the environment variables are temporary, as they are lost as soon as the console and Visual Studio windows are closed.
I have found that this can happen if you have a pending Windows Update. Rebooting seems to fix the problem, as then the Update gets a chance to be applied.

How to connect to source control server using TF command line utility

I'm trying to run a commands using Tf Command-Line Utility I'm getting errors when trying to connect to TFS server. I'm not sure what tf tool is expecting as far as parameters.
It tells me to connect to workspaces by running tf /collection:TeamProjectCollectionUrl'
To get the TeamProjectCollectionUrl I went into Visual Studio Team Explorer, looked at properties of a project and copied URL property. The url starts with vstfs://
You want to use the standard HTTP or HTTPS URL to specify your project collection. (This is the same URL that's shown in the connection dialog in Visual Studio.) For example:
http://tfs.contoso.com:8080/tfs/DefaultCollection
TFS installs on port 8080 by default, and (beginning in TFS 2010), the name of your project collection is the suffix.
Alternately, you shouldn't need to specify the project collection - if you run the tf resolve command from one of your working folders, it will determine the server information automatically. That is, if you have the workspace mapping:
$/Project/Source -> C:\Work\Source
If your current working directory is C:\Work\Source and run the tf command line client, it should locate your TFS workspace automatically.
1- Add "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE" path into Environment variable path.
2 - Create a batch file (simply copy and modify the below commands and save into file with ext .bat)
CLS
tf get $/Project/Source /recursive /force
Pause
exit
3- Copy .bat file and place into your local Mapped folder and run.

Resources