I'm trying to create a Visual Studio plugin, it's a menu item that executes batch files. I have no idea how to include the batch files (or any other additional files) with the VSIX when publishing so that they are available to all users that install the extension.
In solution explorer right click on the batch file (in this case I called it BatchFile.cmd) and choose 'Properties'
In the properties window change:
Build Action: Content
Include in VSIX: True
When the solution is built in release mode it creates a VSIX file in the bin/Release folder. This is the package and it contains all the assets required. When the package is installed on another machine, the batch file is included in the install location and can be referenced using:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "BatchFile.cmd"
You can just include the batch file as content in your project, and use GetAssembly() to find the location of your adin dll at runtime
Related
Summary
Does SourcePath property of a file that is added to a setup project support variables? If yes, How can I ask it to pick the file from the folder corresponding to the current build configuration?
Detail
I'm deploying my VSTO add-in using MSI installer, which requires me to include MyAddin.vsto and MyAddin.dll.manifest files to the application folder. I include them manually using Add File command. The problem however is that if I change build configuration from Debug to Release and build my installer, it will still pick those two files from the Debug folder (becuz their paths are hard-coded in the setup project), potentially bundling an old version of the files in the installer. Therefore I want to use some macro/variable that would evaluate to the current build configuration.
The setup project file (.vdproj) adds files like this:
"SourcePath" = "8:..\\MyAddin\\obj\\Release\\MyAddin.vsto"
The path is relative, but the build configuration is hard-coded. I'm looking forward to something like:
"SourcePath" = "8:..\\MyAddin\\obj\\[$BUILD_CONFIG]\\MyAddin.vsto"
I'm using VS2015 community and .NET Framework 4.5.
Given a working copy that contains multiple Visual Studio solutions in different directories, how can I configure the working copy so that restoring packages in any solution will result in the packages being downloaded to one and the same directory?
The setting in NuGet.config that controls where packages are downloaded and expanded, is called packageRepository (reference).
Here's the places where I added a NuGet.config file (or added the setting to an existing file) and it did not have any effect:
the same directory as the solution file
a parent or ancestor directory of the solution file
the .nuget directory that is in the same directory as the solution file
I am looking at two ways of restoring packages:
Using Visual Studio (the magic 'restore' button in the Package Manager COnsole)
Using MSBuild (where .csproj files are altered to include the $(SolutionDir).nuget\nuget.targets file)
Is it possible to configure NuGet package restore (either or both methods) to download and expand packages to the same location?
My Visual Studio 2013 Custom Build Tool step is failing because the directory in which the step is being executed is not the directory where the project file is (which was by default the case up until recently). I can patch it by adding a cd command to the start of the step to change to the project directory but I was wondering if anyone could tell me
how this directory path is set
how to change it.
The build always assumes the project directory as 'base' directory.
This gives msbuild a set location (Builds to bin\debug is a subfolder off 'Base', reference hint paths and a lot more besides).
I would just change the execute of your tool to be reference based (i.e ....\tool.exe or similar) or make use of the path environment variables ($(OutDir),$(TargetPath),$(ProjectPath),$(TargetDir) etc).
Another option that I make use of is to have a batch file called 'post.bat' that has the necessary steps to execute a custom tool. This is then placed in the project folder and added to the project as an artefact.
Without knowing exactly where your custom tool resides relative to the project (or solution) or what the 'working directory' requirements of the custom tool are I cannot suggest more.
I have some custom made XML files and a read me file that I've included in my project.
How do I make it so that these files are copied to my debug/release folders automatically when I build my project? I've tried setting the Copy to Output Directory property to "Copy Always" but this doesn't seem to do the trick.
I'm using VS2010
I've found the answer. The build action needs to be set to Content if you want to just directly copy the file to the output folder.
I have a bunch of files and need to build MSI file /setup.exe file that put them on specific folder and run one file of them that install a win32 service is that possible with micorosoft visual studio 2008 setp project ?
suppossing i have the following files:
file1,
file2
file3
file4
I need to put file1,file,file3 under c:\documents and setting\all users\my directory
and run file4 which install a win32 service while running the setup or the msi is that possilbe ?
Yes, that's all possible. Create a new deployment project and in the File View add the files from your project in the correct places. You may need to mark your files as Content = True in the file properties (from the solution explorer) then I think they'll appear in the dropdown in the file view.
For a windows service, the executable needs to be able to install itself as a service from the command line anyway, so installing it from the MSI is easy as you just need a custom step to call your .exe.
Yes. You can do this with a standard Setup Project. To add custom files and folders, check this link: http://msdn.microsoft.com/en-us/library/x56s4w8x.aspx
For the base "All Users" folder, you will need to specify a Special Folder, specifically the CommonAppDataFolder.
Specifying how to install a Windows Service involves using a special component. I'm not too happy with it, I much prefer Wix.