Copy dependent projects needed files in Visual Studio - c#

I have a sample project that is structured like the below image:
The WebApplication2 has depended on ClassLibrary1 at publishing time like this:
I want to copy some needed file in ClassLibrary1 project after publishing in a specific folder, for example in Plug-in/ClassLibrary1/
If you've looked at Orchard you'd see something like this.
Thanks.

In general (regardless of the type of the application) you could define custom actions during deployment, if you build a setup application. I think that limited edition of the InstallShield is the default solution for VS2013. There you could create some custom actions writing a script. Inside this script you could deploy the specific file. An alternative against the InstallShield is the WiX which you could use to build an MSI file using an XML.
Regarding web applications in particular, you could use the publish mechanism provided by the Visual Studio. This tutorial describes how you could configure it so that it would copy all project files. Then you could add the specific file as a project file and copy it each time you publish your website.
Hope I helped!

Related

How to create an installer than runs a file after install?

I'm currently using Setup Project in visual studio 2015. It works well except I'm having an issue with a particular necessity. After the installer finishes I need to run my .js file that registers my server on my application. Currently with Setup Project if I add my .js file to the "custom actions" in the install folder, when I run the installer it runs my file halfway in the setup. This is no good because the server isn't ready to be registered yet. I need this .js file to run AFTER installation. If anyone experience with Setup Project can help me out I'd be so thankful. However if anyone knows a better installer maker that can do what I'm asking for I'd be very interested in that too. Maybe WIX could do this for me?
This appears to be exactly what you need:
https://www.codeproject.com/articles/15800/calling-javascript-from-a-visual-studio-installati
This will give you more info about installer project custom actions:
https://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup-projects-and-custom-actions/
Add an Installer class to your set up project in visual studio. you can override many stages of installation within this installer class
EX:
OnBeforeInstall()
Install()
OnAfterInstall()
You can override a relevant method and add logic within the method to execute the .js file.
You may have to get the directory where the MSI is being installed so that you can get the path of .JS file and execute it. following code should get the the installation directory. Add this code within the installer class.
string installationPath = Context.Parameters["assemblypath"];
Try the InstallShield 2013 with a limited warranty. It should be free for personal use, and it includes a functionality to run a script after the installation is completed.

Creating Sharepoint Web Part manifest file and dwp files

Could anyone please help me to understand the following for creating Sharepoint web part please?
Manifest.xml
a. What is the purpose of this file?
b. What happens if we specify the wrong *.wpd file as below?
<DwpFiles>
<DwpFile FileName="WebPart1.dwp"/>
c. How do I create file in Visual Studio as I can't see any template
*.wpd
What is the purpose of this file?
How does this loads the proper dll?
How do we create using Visual studio, any template exists?
If we have webpart project and it references to the dll on another project. Does another project's dll has to be signed?
What are the best mechanisms to deploy the Sharepoint Web Parts?
I use the WspBuilder Visual Studio templates. They are a little quirky but it makes creating the structure of SharePoint projects very simple.
It uses the convention of following the SharePoint folder layout for specifying file locations in the project. Take a look - it might help you get moving. Note there are two versions - one for Visual Studio 2008 and a beta for Visual Studio 2010.
To try to answer your specific questions:
If the file can't be found, no action is taken. It's an error but not one that will bring down SharePoint.
I thought WPD was the old package style. Maybe I'm wrong on this?
Should be same as WSP - a package containing files to be deployed.
Whatever DLL is contained in the package is deployed to the GAC if it's signed.
Take a look at previously mentioned WSP Builder project.
Anything that's loaded by SharePoint and leads to rendered content needs to be signed and possibly added to the SafeControls entry in the web.config (deploying WSPs created from WSPBuilder does this automatically)
"stsadm -o addsolution" then use Central Admin to deploy or continue with "stsadm -o deploysolution"

Create Setup Project DLL files Information

I finished a project.I am trying create a setup .
My Problem is that :after I create setup project dll files that I used in project added to same folder with my .exe file like
ApplicationFolder(Folder)
Devexpress.Data.dll
Devexpress.Util..dll
.
.
project.exe
but I want to get it different folder.
like
ApplicationFolder(Folder)
MYDLLFILES(Folder)
project.exe(exe file)
how can I make this? Thanks a lot
This is not only a problem of setup. unless you are already handling this in the app.config and/or with appdomain.assemblyresolve event your application will not work at all on the user's machines once those required references will not be available in the same folder if the .exe file.
Surely you could isolate every single file and tell the setup project where to put it but your program has to be modifief to then look for those files in those other locations.
I accidentally faced this problem today, I want to add some separate dll files into the setup package (I have to do this because I can't add reference of these dll files into my C# program , these dll files are of 3rd-party software).
I did as following:
Right click on Setup Project > Add > Assembly and then browse to dll which I need, then press OK button.
These dll files will be included into Setup project, and will be packaged into setup file also.
Hth.
The problem is that Visual Studio setup projects will automatically include referenced DLLs for you so you won't be able to customize their location with these setup projects.
See also the following articles by DevExpress:
How to deploy WinForms applications on client machines
How to distribute applications which use Developer Express .NET Windows Forms controls
The second article explains how to register DLLs copied to a different location.
By the way we're also also deploying a big app using these VS setup projects and our base installation folder is full of DevExpress and other DLLs. I agree that it looks totally ugly and I'd also prefer a clean structure with a lib subfolder, but nobody cares about that. Customers don't start our application from the installation folder, they use the shortcuts.

Can I Dynamically add files to deployment project?

I have an XNA 3.1 program and would like to create an installer that includes all the content files. I know I can create a ClickOnce installer but it does not package everything up in one file. Is there a way on build of the deployment project that I can look at the project folder and dynamically add the files and directories to the MSI? On the PreBuildEvent There is already an xcopy of the files I want from the game project folder to the deployment folder. What I want is a way to add those into the deployment project. Custom actions don't seem to fit since they are for install time, not build time. Should I give up and go the Wix route?
I did find this project on github. https://github.com/dump247/VDProjectXml It looks like a good start. I'll look into this and Wix.

How can I use from Setup Project

The development phase of my project has been completed and now I want create a setup file.
What shoud I add in Application Folder in File System section ?
Where and how can I add my icon of project, database, recource and essential dll file?
In Visual Studio, you add a setup project application to your solution.
Setup is a project type, so it's like adding another .exe.
Visual Studio has a wizard that takes you through most of the steps.
Well if your question is like "How do I create a setup of my project?" You should try reading some of the tutorials on internet:
Creating Setup and Deployment Projects in VS.NET
Setup and Deployment with Prerequisites Included in VB.Net 2008
Serial Number in Setup and Deployment

Categories

Resources