Change temp post-build visual studio folder - visual-studio

I want to add post build event to sign some project outputs by my signer app - this is the simple console application with the one action inside.
I had added this in the Post-build event command line window
$(OutDir)\Tools\SignTool.exe $(TargetPath)
On this command Visual Studio (2015) create a temporary exe for some reason in temporary folder and try to run it. My company's security settings block it and I think they right but build has failed.
Can somebody help to explain how to prevent VS to do this odd action and just run the *.exe or how to change the temp folder for VS without changing the global environment temp?

Not sure, if you still need an answer on this. We had the same issue here in our company (with VS 2019). Every Pre- or Postbuild event in your project will be automatically packed into one Batch-file (*.cmd). VS creates this batch file in the global temp path. As far as I know, you can't change this temp folder only for Visual Studio.
What we have done was creating a group policy for developers to enable batch creation by Visual Studio 2019 in temp folder. Now we are able to sign our EXE with Postbuild event (as you mentioned), and we can debug / run our applications with Visual Studio, finally.

Related

VS2015 annoying message about IIS Express

I use devenv.com to build my projects from the command line. For various reasons I do not use msbuild for that.
The problem I have with VS2015 (not VS2013) is that I sometimes get a dialog like this:
The only way known to me to make it go away is open the VS 2015 GUI and build the solution there. It needs to be done just once, but it is annoying in the first place, because the command line build is stuck until OK is pressed. Plus this could happen again.
A few notes about my setup:
IISExpress. Please, do not suggest moving to IIS.
We do not use the local applicationhost.config from the .vs folder. The global one from %USERPROFILE%\Documents\IISExpress\Config is used instead. We enforce it for all the projects in all the solutions by including <UseGlobalApplicationHostFile>True</UseGlobalApplicationHostFile> in each and every project (through a common targets file).
My command line build script knows to create the web application site in the global applicationhost.config, so in VS 2013 the script could be used even if no sites were initially configured - they are configured on the fly, just like VS 2013 GUI does. However, this no longer works in VS2015 - it opens this bloody dialog.
What additional command line configuration needs to be done to avoid this dialog?
When you open VS 2015 for the solution, the first thing it does is to repopulate the applicationhost.config file inside the local .VS folder. But if you rebuild your project using Devenv.com command line, it will not automatically regenerate the .vs config file correctly.
So I agree with Lex Li, we might ignored a few inconformity. You can try to closed Visual Studio and then deleted the entries for your site in the applicationhost.config. Then opened project in Visual Studio and reconfigured everything before trying to run it. Or using devenv.com to build a new projects from the command line.
I just copied the applicationhost.config file from the project directory ...\.vs\...\configfolder to the IISExpress config folder located under %USERPROFILE%\Documents\IISExpress\config.
So I overwrote the global config applicationhost.config file, but in my case it was OK as it is the only VS project on my computer.
Careful when doing this when you've got more projects on your computer as connections may break.

Force extension installation in Visual Studio

We're working in quite a large project and is having a hard time getting people to configure their Visual Studio correct (tabs instead of spaces etc.). We found a great solution in using the EditorConfig extension for Visual Studio.
However there are still some developers that seems to ignore our request to install this extension to their Visual Studio and hence I'm wondering if there is any way to force an extension to be installed before a solution can be opened, maybe some setting in the .sln file?
No there is no such option built-in. If your machines are domain joined, you could push out the installer through System Center or domain logon scripts.
You could cheat and create a solution level pre-build step. Create a target file named: before.{solutionname.sln}.targets and store it next to your solution file. Check it into source control. In the targets file you can use standard MsBuild to see if the extension is installed (you'll need to check the file system probably) and if not present force the installation by calling vsixinstaller.exe to trigger the install.

Publishing windows application without delete file

In my windows application, there's a file (option.xml) created by my application on the user's computer. It's created run-time with option selected by the user.
This file is in the bin directory.
When I make a new release, the installation (that I make publishing to a shared directory with visual studio wizard) delete this configuration file, so the user have to save the option again.
How can I publish a new release without delete this file?
I'm using visual studio 2013
I hope that the issue is clear.
thanks

Add reference deselected in visual studio 2010

I am trying to open a existing project in visual studio 2010 using
new->project from existing code
and selecting visual c# as the language. When I run it, I get errors. Later I heard from the person who created the project that I have to add few references, which are present in the references folder in the project itself. It comes in the side window - solution explorer.
However, when I right click on that folder to add as references, that option is 'greyed', or disabled. How Can I correct this?
The DLLs named freeglut.dll and glut32.dll are not COM or NET components. You cannot add them as references to your project (You have 4 solutions in your archive, I have choosen the one named fwa_annimate but I think the problem is the same).
The DLL named Tao.FreeGlut.dll needs these files in the same directory where you application run to work. So the easiest way to resolve your problem is to select the two DLLs inside Visual Studio and change the property Copy to Output Directory from Copy Never to Copy Always.
In this way, when you start to debug your app, the VS IDE will copy the two files to the BIN\DEBUG or BIN\RELEASE directory where you app runs when launched inside the VS IDE.
Of course, you need to deploy all these file when you distribute your application.
(By the way, I have no idea what is supposed to do)

SharePoint development in visual studio without having to deploy/debug on every code changes

I'm using VS2010 connected to a local SP2010 installation, I edit the code in VS2010 (i.e. of a WebPart) and then in order to see the result on a browser I deploy the solution.
This is very annoying since it is a big project and it takes a couple of mins to deploy the solution.
I was wondering if it is possible to have the "edit -> save -> F5" approach even for SharePoint.
Thanks!
I'm gonna to integrate here the answer i get from the kind ppl and what i've actually done to solve/mitigate my slowness problem:
Installed CKSDev Visual Studio plugin from here: http://cksdev.codeplex.com/
On the SharePoint project properties tab set to 'True' the property 'Auto copy to SharePoint root', with that on each time you do save a 'visual' (ascx, aspx, js, css, ..) source file, it will be automatically copied over the SP hive without having to manually push it using the Quick Depl. option
On SharePoint project properties page (right-click, properties), add the following post build event command line:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe" /i "$(TargetPath)"
iisreset
The previous commands will:
Install the project dlls into the GAC
Restart IIS in order to catch the new dlls
Now each time you do save a change in the visual or build the code it will automatically pushed to the SP installation.
For newer source files i still need to normally deploy the project.
You can do that by copying the modified file to the corresponding folder inside SharePoint Hive[14] (Or you can edit it there directly), and recycle the application pool.
Note that it this solution is only applicable to web parts, pages and xml files and it cannot be done for code files.
If you have modified your code files you have to recompile them and copy the dlls to GAC[%systemroot%\assembly] or BIN[14\bin] folder depending on your settings.
Download CKS: Development Tools Edition (aka CKSDev) from here and install into VS 2010. You will see new context menu "Quick Deploy" in solution manager which will speed up requested tasks: deploy to GAC/BIN, Recycle App Pool and more (shortcuts are accessible!). Very handy tool.
Use CKSDev, and separate your solution into smaller solutions so you can work on a subset of your projects, I would be very surprised if your webpart is dependent on every project in your master solution. If you are developing on a virtual machine without internet access also ensure that you are not waiting for timeout on your certification checks everytime you recycle the apppool (happens when you deploy). Read here for how to: http://joelblogs.co.uk/2011/09/20/certificate-revocation-list-check-and-sharepoint-2010-without-an-internet-connection/
I am going though below step during debug code.
1) if you are changes only code assembly than Build Your Project after changes code.
2) Open Assembly folder(run > assembly) and drag and drop your project's dll(will be found it out from Your Project Directory\bin\Debug).
3) open IIS (run > inetmgr) and goto Application Pools and find it out your sharepoint we-app's Pool. after selecting Application Pool (Recycle) it.
4) now come back on VS SharePoint Project.Debug > Attach to Process > w3wp.exe.
should be hit your break point.
that's it.

Resources