Copy external linked file to a root of a web site - visual-studio-2012

In Visual Studio 2012
I have three web sites that all use the same set of database connection strings.
I keep database connections strings in a connectionStrings.config file which is in a common solution folder (external to all three web sites).
I included this file as a link (configured as Content and Copy Always) - which copies connectionString.config file to each web site's bin folder when I compile/run web site.
I would like to copy that file to the root of each web site instead. Is there an easy way to accomplish that?
One way to do this is to use xcopy in post-build step of the project.
The other solution would be to modify .csproj file (or a separate, external .target file) to copy linked file to the root (instead of to $(OutputDir))

I used a Post-Build event. It has macro's for the place you want the file to end up.
Just use the $(Macro) tags with a few "..", and you can "massage" the files to where you want them.
copy $(ProjectDir)..\connectionStrings.config $(TargetDir)connectionStrings.config

Related

How to trigger Azure Logic App when dropping file in Sharepoint folder

I created a Logic App that uses the Sharepoint trigger "When a file is created or modified in a folder". It works perfectly when I upload a file in Sharepoint online (in a Sharepoint browser tab). But, it doesn't work when I drop a file in my synced Windows explorer folder.
I read that someone faced the same problem: https://learn.microsoft.com/en-us/answers/questions/41215/logic-app-why-does-sharepoint-file-properties-trig.html. Here it says:
Move files and flow runs When you move one or more files from one
document library to another, the original file is moved from the
source library to the destination library. Moving the file does not
alter any custom metadata, including when the file was created and
modified. Hence, this action does not trigger any flows for those file
updates associated in the library where it was moved.
Syncing files to your OneDrive for business and SharePoint document
libraries When users sync one or more files from one document library
to another, the original file is moved (synced) from your client to
the destination library. Syncing the file will not alter any custom
metadata including when the file was created and modified. Hence, this
action will not trigger any flows for those file syncs in that library
or in your OneDrive for business.
The thing is that I NEED this Logic App to run by just dropping this file in a Windows Explorer folder (which is a Sharepoint folder shared with a certain person). Do you know how can I achieve this?
It started working for me when I used the OneDrive - When a file is created Connector because we use OneDrive for Windows Explorer and need to include the folder where the trigger should be invoked. We must set Include subfolder to true if we want the trigger to be fired while adding any file to the subfolders.
Here are the screenshots of the logic app working
When adding file in subfolders
When adding file in root folder

How to put files into Android/Data/com.mycomp.myapp?

I'm new to Android. Switched from .NET WPF/Windows Forms. I have some JSON files in my project. How to put them in the future /Android/data/[packagename]/
folder? In .NET WPF you just open properties for that file and select copy to application folder or so. Probably there is the same method in Android Studio, isn't it?
You put them in the assets folder if you just want them to be read accessible. If you need them to be writable, you'd put them in assets and then copy them to the filesystem on first run.

How to do Text file changes in a ZIP file in InstallShield Basic MSI project

How to do Text file changes in a ZIP file in InstallShield Basic MSI project. I am not able to do Text file changes in a file which is inside a zipped file.
InstallShield does not offer this capability, at least not now. You will have to either surround the call to the text-file-changing custom action with ones that extract and replace the zipped file (the text file changes would operate on the temporary copy), or implement the whole thing yourself in one step. I'm not sure which approach will be easier.
In your situation, I would reframe the design and requirement. Silverlight .XAP files are typically digitally signed. Any attempt to modify the archive would invalidate this. It's also needlessly complicated.
Instead, change your application to use an external configuration file. native InstallShield functionality can then be used to update this file. For a possible approach, see:
Creating and Using Silverlight web.config app settings (Web.config Configuration Applicatioin Settings) or app.config application settings configuration file for Silverlight

Can I deploy in SharePoint two Web Parts with the same DLL, but two .webpart files, at the same time

Is it possible to have two Web Parts with the same DLL, but two .webpart files, deployed in Sharepoint at the same time?
Background :
I am developing an application that will generate a ".cab" file containing a Web Part (ASP.NET 2.0 Web Part). After that, the user should be able to deploy this ".cab" file in a in a SharePoint server.
My application already includes the DLL of a Web Part. The "behavior" of this Web Part depends on the properties of the ".webpart" file which will be generated at runtime by my application (its content will change depending on certain user choices)
After generating the ".webpart" file, it packages it to a ".cab" file along a Manifest.xml and the DLL.
Imagine that the user creates two "cab" files using my application. And he wants to deploy them into SharePoint.
To test this, I create this two ".cab" files with my app, and in SharePoint I execute:
$> STSADM.EXE -o addwppack <cab filename #1>
$> STSADM.EXE -o addwppack <cab filename #2>
$> STSADM.EXE -o deletewppack <cab filename #1>
After the execution of the third command, the Web Part #2 doesn't have the DLL.
When I installed Web Part #2, SharePoint override the DLL file of Web part #1
The problem here is that the DLL of both files is copied to same location. That location is the Assembly name of DLL. That assembly name cannot be changed without recompiling again (I think).
Is there anyway to deploy two cab files independently, even if they share the same DLL?
You could split your application in 2 parts: a 'library' that contains only your dll. And something that deploys the .webpart file only.
Users must always keep the 'library' part installed..
Also, you might want to look at alternatives from installing a 'wpppack'.. the .webpart file is nothing more than a file in a library in your sites.. may be easier to add that than to install a .cab on the server.
This shouldn't be an issue at all. A .webpart file simply points to a class within an assembly, and provides the configuration values for a specific instance of that class. If you want to have multiple configurations of your webpart available from the webpart gallery, you would go about it by uploading multiple .webpart files which reference the same class. For example, every instance of the listview webpart can be exported to a .webpart file, but they are all using the same webpart class. Check this blog posting for more info on the contents of the .webpart file.

IIS Config file in virtual directory

I have multiple websites that all have the same code, but different app settings.
I want to place my app settings in a separate configuration file that is located in a virtual directory. This will allow me to have a single copy of all of the code shared across all of the sites with a different virtual directory for each site.
Unfortunately, when I try to configure this, IIS doesn't process the config file when it is in a virtual directory.
If you have a solution to this, I would appreciate your help.
Maybe using the machine.config file on your web server would be a suitable alternative? Otherwise you could create a web.config file in a global folder somewhere and open it using the WebConfigurationManager.OpenMappedWebConfiguration() method.
It's not possible to use a virtual directory (or even files outside of the current website; only the current folder, or a sub-folder).
One possible way to share setting across projects would be to do it at build-time - either by coping it in, or using a Linked File in VS to have it copied to the folder on publish.
If you really need this functionality on the server, you could try (though I can't say how well it would work) a Junction.

Resources