Script Task - Add existing file as link - ssis

I've been looking for an answer to this for a bit now but couldn't find anything. I was wondering if it is possible to add an existing file to the project created under the script task in an SSIS package. What I want to be able to do is to add one file called Helper or Utility to the solution and then add that file to all the script tasks for common functions. This is so if I change the class, it gets pushed through to all script tasks.
I know that I can add a reference to a DLL and add it to the GAC. I have tried this and it works. I've also tried adding the file to the projects and that works too.
This is just another solution that I'm trying, just in case I'm not able to deploy the DLL in prod. Any help will be appreciated. Thanks.

Firstly you need a master copy of your classes, you can copy them from an existing Script Task using the same process below but in reverse.
Open the Editor for the Script Task and on the Property Explorer click on the Project File (the st_[Guid] ), in the Properties window you’ll see the Project Folder location. (This location gets recreated every time you edit the script task)
In explorer, copy your classes to this folder
On the Project Explorer, click on the “Show All Files” icon
Right click on your files and add to Project

You can use regular VS functionality for linking files:
Right click your script project
Add > Existing item...
Select files to be included in your project
In the bottom right corner of the Open file dialog box you have a drop-down with 2 options: "Add" or "Add As Link" - select the latter one and you are done (see image below)

We can not use relative path after adding pages using Add link. Each user need to correct the path before running the project. The script task uses its own path.it doesn't run from package path which is the problem.

Related

How can I configure sublime to always open to the same folder?

I have a folder that I want Sublime to always open to ...
my_folder
Is there somewhere I can set this so that when ever I click on the Sublime Icon it opens to this folder?
For some reason if I manually quit sublime text through the menu it will open my last folder on re-opening.
However, if I just click the close X button, it will not ... it will open a blank window.
Is there somewhere I can set this correctly in the JSON file?
Well not sure if you are aware of it, but ST has a quick switch project (usually ctrl+alt+p) that will show you your recently opened projects.
Of course it has its own drawbacks:
Unable to remove one instance from it without removing all (clear recent projects cache)Can’t open the project in a new window… instead it only replaces the current project
But AFAIK this would be the most optimal way to work with multiple projects. you just need to go to the folder of the desired project and open it once and it will be available as recent project in the future…
The point of having to choose where to save the project file, IMO is because you may want to share the same file with other people or just have them wherever you want… maybe having all in one place is good for you (it is for me as well) but other people might like to have it in separate folders. 
I usually work with the project replace window… or just go in “Project -> Open recent -> …” which opens a new ST window for me!
Hope this helps you

Adding Slow Cheetah transformed config file as a reference in another project

I have a class library project with a Slow Cheetah'ed config file.
In the past, it was easy to use 'Add As Link' to add the config file to other projects. How could this be achieved with Slow Cheetah because config files are dynamic?
I need some kind of add reference for config files or if there is no way of doing this, I have to copy the config file and Slow Cheetah it again.
I found out that you can 'Add As Link' as normal, but link the main config file only, not the Slow Cheetah created files. Right click the link in the solution explorer and select "Add Transform" from the menu. Slow Cheetah creates links back to the Debug.config and Release.config files.
Adding to Mark's excellent answer...Custom Slow Cheetah transforms (ie. other than Debug.config and Release.config) can be added to your "other" project with a couple extra steps.
Add as link the main app.config file.
Right click app.config and select "Add Transform". Debug.config and Release.config will show in your solution explorer.
Right click the project and select Unload Project.
Once unloaded, right click again and select Edit .csproj
With the .csproj open, scroll down to where you see something like this:
<None Include="..\AppName\bin\Dev\App.config">
<Link>App.config</Link>
<TransformOnBuild>true</TransformOnBuild>
</None>
Simply duplicate this code and modify the path and config name for each existing transform to be shared.
Reload the project and the transforms should show beneath App.config
This approach works for using dynamic Linked configs between the application and a test project or library.
Side note:
After implementing the transform, go to Build --> Configuration Manager. Confirm your build environments reference the desired configs.

After moving my Windows Store App project I can't compile it because .resw not found

I have a Problem with a Windows Store App.
I moved the folder and now I cant compile it, I get the error:
Fehler 2 File C:\[old path]\Strings\en-US\Resources.resw not found. C:\[new path]\MakePRI
I dont know how to fix it because the app is in the same relative path in the project as before.
any hints for a solution?
This item was probably added to the project with absolute path. You can fix that in one of two ways:
In SolutionExplorer remove Resources.resw from the project. Then click on Show All Files icon to make the file appear in its folder although it's not included in the project (I understand you did copy it over when moving the project). Now right click on the file and select Include In Project. After that you can again turn off Show All Files.
In Solution Explorer right click on the project and select Unload Project. Now right click on the project again and select Edit ProjectName.csproj. In the file find Resources.resw and replace the existing tag (and any subtags) with <PRIResource Include="Strings\en-US\Resources.resw" />. Save the changes and close the file. Right click on the project again and select Reload Project.
I got into this problem and I found an easy solution. Open the project and it will show the error. Now right click on the App name in Solution Explorer (on the right hand side) and select Build.This will set the path again and the project can be run now.

WIX: Using a temporary file during install

I am writing a WIX installer and I have a following requirement:
During installation, I need to pass an absolute path to a file (lets call it A) included in my installer to a COM component, which already exists on the hard drive and is a part of another program. I have already written an appropriate Custom Action which expects a path to the file A. I don't want to include A as a file installed in the Program Files folder and removed during the uninstallation process. Instead, I would like to put A only temporary on the hard drive, call my Custom Action which will cause the COM component to use the content of A, and then remove A from disk. Is there an easy way to accomplish this goal?
I have tried to utilize the Binary Table and store A there, however I don't know how to reference A using absolute path. I know I could put A outside of MSI file but I would like to keep every file installer needs in a single MSI.
Any help would be appreciated.
Deleting a file that MSI installed means that MSI will consider it "broken" and try to auto-repair it if called on to do so. That happens automatically in several cases (e.g., advertised shortcuts and COM registration) so I'd recommend against it. Leave the file there instead -- it's done its job and there's no harm in leaving it there.
I would take this approach.
Install the file "A" into any directory. Run your custom action needed to update the COM component. Then run another custom action or modify the currently written one to remove the file after it is no longer in use. This would leave no trace of the file "A" and if you schedule the custom action to only run during the install you won't have to worry about it on uninstall.

How to edit preference file for Notepad++?

My open source project uses spaces, not tabs, in its code.
A contributor to the project has his own website which uses tabs, not spaces.
He uses Notepad++ in Windows to edit files for both projects, and is frustrated when he forgets to manually set the Preferences correctly and thus inserts tabs into my project's files.
Is there a way to edit this Preference via a script? That way he could click one icon to start Notepad++ in mode 1 (running a batch script to modify the Preferences file and then start the program) or click another to start in mode 2.
Or if there's any other way to make him not have to remember this chore, that would work too. Maybe having a Preferences setting that depends on what folder the edited file is inside of?
Any help would be appreciated. Thanks!
The notepad++ setting for replacing tabs with spaces is stored in following xml file
%USERPROFILE%\Application Data\Notepad++\config.xml
The following is the line that needs to be changed
<GUIConfig name="TabSetting" size="4" replaceBySpace="yes" />
Now I don't know how we can edit a file by batch script in windows, but if it is not possible, then he can keep two config files config-tabs.xml and config-spaces.xml. And in the script you can copy appropriate file depending on what he needs to work on.