Visual studio, Download file on Debug - vsto

I'm working on a VSTO excel addin.
When debugging the solution we automatically open an Excel file located in the solution.
The working version of this file is hosted on a corporate sharepoint.
I would like to update the solution version with the sharepoint version each time I launch a debug on my local machine.
But I really don't know where to start. Is there a way to execute a powershell script on debug?

Look at the Build Events. We'are using Post-build for copying a file from one folder to another - something like
xcopy "$(ProjectDir)\$(OutDir)file.dll"
"$(SolutionDir)$(SolutionName)\Folder*.*" /R /Y
So every time you build your project, it will get the latest from SharePoint to your project folder and then you start debugging

Related

Is there a way for using SFTP tool for Visual Studio 2017?

I am looking for a tool which helps me to see the folders of a server in Visual Studio 2017 without doing this outside the IDE, actually Notepad++ with the NppFTP plugin can do this and i am taking this as an example, basically you can open a file from the server, edit and upload it automatically upon it is saved.
Thank you
You can install SFTP in visual code 2017 by going to extension and type SFTP then installing it. to use the sftp just right click the file and click upload or download base on your needed.
PS:after installing it, place the json file inside your core project. set the hostname, username and password.

regsvr32 msinet.ocx Error

(Trying to solve my ultimate goal- Connecting to FTP from Excel to automate file sharing (VBA Beginner))
I'm trying to add Microsoft Internet Transfer Control but it doesn't show up in Excel VBA when I go to Tools>Reference so I followed this site.
msinet.ocx was not in my system32 or SysWOW64 folder so I think I'm supposed to install it at command line so I initially tried running regsvr32 msinet.ocx at C:\Windows\System32 and C:\Windows\SysWOW64 and I get the same error for both: "The module msinet.ocx failed to load. Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .dll files. The specified module could not be found."
Then I tried running cmd.exe as an administrator and trying it again in both System32 and SysWOW64 and I still get the same error popup. I don't know what to try now. Do I need to do a System Restore? And is that a safe thing to do on my work laptop?
P.S. I'm on Windows 7 Enterprise 64 bit
You properbly need to run the CMD as administrator to get your regsrv32 to work.
I had the same problem in windows 2012 server and it only works when you run the CMD as administrator and then type the regsrv32 "C:\Windows\sysWoW64\msinet.ocx"
I got it finally through this link - https://social.technet.microsoft.com/Forums/windows/en-US/ee5696aa-c94d-481a-bbbe-4dad30ccae7f/vista-error-message-msinetocx-not-correctly-registeredfile-is-missing-or-invalid?forum=itprovistaact
Using Peter's and BVBravo's posts

How to make .exe setup in visual studio 2010 including excel template files

I have developed a tool that will extract data from xml file and drop in formatted excel file.
For this I have 3 types of formatted excel files.
so my question is that whenever I m building .exe file, and try to install this file on another (user's) machine, it will not find that excel files.
and my code give me an error.
How can I include that excel files with .exe setup?
so that I do not need to give that files separately.
I m using Visual studio 2010 express
thanks in advanced.
try to compile your code with Advanced Installer
Here are a couple of options.
1) With respect to a setup tool, Microsoft depreciated their own Setup projects and started including Install Shield Limited Edition. This link should help if you want to check that out: InstallShield Limited Edition is available for download in Visual Studio 2010 I tried it for a few projects and found it ok. It does about as much as the prior Microsoft Setup projects.
2) A less conventional option may be to package the excel templates into your exe as a resource file and then write them to the file system when you run the first time. To do this...
In VS, open My Project and click the resources page on the left.
Click the Resources page and used the Add Resource item in the toolbar to add an existing item. Select your excel file and repeat this for each file.
In your code you can save the resource to disk with code like this:
My.Computer.FileSystem.WriteAllBytes("excel filename.xlsx", My.Resources.ExcelFile1, False)
This option will understandably make your exe larger.

the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first

I have a small windows forms application created in Visual Studio 2012 that uses ReportViewer version 11.0.0.0.
The application target framework is .NET 4.0 and its deployment method is ClickOnce
On my PC it installs but on client machines, intallation fails with error
the application requires that assembly microsoft.reportviewer.processingObjectModel version 11.0.0.0 be installed in the global assembly cache first.
On the client machines, i have installed
.NET 4.0
ReportViewer 2010
Microsoft Report Viewer 2012 Runtime CTP
SQLSYSCLRTYPES.msi
in the project application files settings, i have set microsoft.reportviewer.processingObjectModel publish status to Include(Auto), in the references i have also set its Copy Local property to True.
what am i missing?
I have even followed the instructions here http://msdn.microsoft.com/en-us/library/ms251723.aspx
Here is (arguably) the best way to deal with this issue... without downloading or installing any extras. This worked with Visual Studio 2012 (Ultimate)
Goto the main project within your solution(default/statup project)
Right Click and Click Properties / Select "Your Project">> Project>> Properties
Click on "Publish" Tab to see publishing options
Goto "Install Mode and Settings">> Click "Application Files" and Dialog opens
Go down and look for the items set with "Publish Status" > Prerequisite
You will find ReportViewer and Several Other Files set to Prerequisite
Change all the Publish Statuses to "Include" in the drop down
I know you only need the ReportViewer Only but this will eliminate other potential problems I came across
Now all the required files will be added to your installation setup good to go!
For interest, you can change include a desktop icon under "Install Mode and Settings">>Options>Mainfests>Create Desktop Short Cut
you are missing the ProcessingObjectModel.dll file find the version 11.0.0.0 in gac assembly C:\windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel and add it to bin dir.
We had the same issue, but the thing is, its automatically adding it to the references (microsoft.reportviewer.processingObjectModel), if u EXCLUDE it from the publishing properties(properties->publish->application files), It might fix it.
A better option would be to install the Microsoft Report Viewer 2010 SP1 Redistributable Package at:
http://www.microsoft.com/en-us/download/details.aspx?id=6610
Your users will need to have this package installed as well. If you just copy and paste a MS DLL, you'll have to redeploy it every time you upgrade your application.
If you are using WinForms, to me it seems pointless to worry about installing this DLL in the GAC when it's being used for a report viewer that is deployed via click-once. This isn't a big file and you're probably using it as a report viewer control on a form, nothing more. One possible solution is to do the following:
In Visual Studio, go to the reference in your project for the assembly Microsoft.ReportViewer.ProcessingObjectModeland locate the file path to the folder for that assembly. Mine was version 12 and so my file path was C:\windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\12.0.0.0__89845dcd8080cc91
Copy the file path of the folder the assembly is in and remove the reference from your project (right click the reference and select "Remove").
Win + R to get a 'Run' prompt. Paste that folder path in there and execute to jump right into the folder of that DLL.
Find the DLL, it should be the only file in that folder, and copy it to your Visual Studio project folder. You shouldn't care about 100kb of extra space on your drive consumed, and I don't think this DLL is one you'll need to update.
Back in Visual Studio, right click References, Add Reference, and browse for that DLL in your project folder. After adding the reference, make sure that the Copy Local property is set to true.
Clean and rebuild, test the application on your local computer, than Deploy your ClickOnce again.
Now when users install your application with ClickOnce, the reference will not refer to the GAC at all and there won't be any need to rely on the prerequisite check/installation process for this DLL because you have included it directly in your published application.
It depends on the setup type you are using but basically, it means the required library is missing from your server or computer. To enable the application to download from the server (In a client-server architecture), you need to include the file(s) in the project.
Go to your application option and locate the "Publish" tab
Click on "Application files"
In the ensuing dialog, select to include all the libraries you want included (or that are required to run your application on the client machine and click "Ok")
Build your application and then publish to the server.
I hope this works for you, it worked for me in Visual Studio 2010 Professional
In case of Windows 10 it won't work installing Microsoft Report Viewer 2010 SP1 as describe by user1236560. First you need to install Prerequisites for SQL Server Management Objects (SQLSysClrTypes.msi) need to choose between x86 and x64 depending on your hardware. You could find it on: http://origin.www.ms.akadns.net/downloads/en/details.aspx?FamilyID=16BC778C-357B-46E9-8356-D575903AC831
After that you need to install MICROSOFT® REPORT VIEWER 2012 RUNTIME that you could find on: https://www.microsoft.com/en-us/download/details.aspx?id=35747
Both of this package will have to be installed.
I encountered this error
System Update Required
Unable to install or run the application. The application requires that assembly
Microsoft.ReportViewer.ProcessingObjectModel Version 11.0.0.0 be installed in the Global Assembly Cache (GAC) first.
Please contact your system administrator.
this error popped out when installing an application made from Visual Studio
meaning I am one of the client
I have Visual Studio 2015 and a Microsoft SQL Server 2014 and didn't know about Crystal Reports and other related stuff to it. I do check the version of my .NET Framework which is version 4.6.2.
I have several extension files and distributable files downloaded and yet doesn't solve my problem.
I do not know if I solve the problem generally but I do become successful in installing the application
so I downloaded and installed the ff:
SAP Crystal Report for Visual Studio 2015(latest, just to make sure)
Microsoft System CLR Types for Microsoft SQL Server 2012
Microsoft Report Viewer 2012 Runtime.
the problem took me about 2 days to trouble shoot, Be careful on downloading and installing extension files and distributed files cause it will munch some space too.
The Best answer is:
Here is (arguably) the best way to deal with this issue... without downloading or installing any extras. This worked with Visual Studio 2012 (Ultimate)
Go to the main project within your solution(default/statup project)
Right Click and Click Properties / Select "Your Project">> Project>> Properties
Click on "Publish" Tab to see publishing options
Go to "Install Mode and Settings">> Click "Application Files" and Dialog opens
Go down and look for the items set with "Publish Status" > Prerequisite
You will find ReportViewer and Several Other Files set to Prerequisite
Change all the Publish Statuses to "Include" in the drop down.
I know you only need the ReportViewer Only but this will eliminate other potential problems I came across
Now all the required files will be added to your installation setup good to go!
For interest, you can change include a desktop icon under "Install Mode and Settings">>Options>Mainfests>Create Desktop Short Cut
It reduced all of my head aches.

How to deploy custom files on remote PC via Visual Studio Remote Debugger 2012

Debugging on Remote PC can be tricky if you need to deploy many files on that PC.
First of all you need to configure PC, i.e. share folders, configure security to easily copy files from your to test PC.
Then you need a deploy script to actualy copy files. And you need somehow to send target PC ip to it.
In Visual Studio 2012 there is Deploy step then studio can deploy your project's files onto remote PC, but it seems it is only working with "easy" cases then no need to copy files on different folders or rename it to start debugging.
It seems that new Remote Debugger has new hidden api to copy files. But it is unavailable from outside of Visual Studio.
If there is a way to use Visual Studio Deploy function to implement "One click Deploy/Debug" procedure?
The answer to the question is somewhat dependent on the type of project you want to deploy. For example, in the C++ project system under Project Properties->Configuration Properties->Debugging->Remote Windows Debugger you can specify a Deployment Directory and Additional Files to Deploy.
If you want to implement your own deployment system, then the answer is yes, you could write a Visual Studio extension, use the deployment API to both copy files and execute anything you required such as a configuration script on the remote machine.