How to debug a Release build of my WebAPI application? - c#

I use VS 2017 for building my WebAPI. In the Staging environment i have my visual studio installed as well.
I have a folder C:\WebApi where the published files live
From TFS i take the latest in the C:\Source folder.
Rebuild the solution in VS 2017
Publish the Project to C:\WebApi
Now when i check the C:\WebApi, i see the pdb file also
Now i need to do debug, the application.
I attached the debugger to the w3wp process, but it does not hit
Let me know how can i debug my application

Related

How to run the .net project in the local machine

Wanted to run the .Net project in my local machine. I have taken the backup of the live server as well as the DB. Now I have to run the project in my laptop.
As mentioned in my comment,
If you have the source code and visual studio install, great.
You should have an .sln file. Just double click on it and your visual studio will open.
There are lots of tutorials of how to run Visual Studio / c# code (You can also use Visual Studio code, or any other ligher software) you decide what is your preference.
Let me know if this helps
You didn't mention backup in dll form or source code,
if it is in source code you can simply load project in Visual studio and set as start-up project run that.
and if it is in in dll then you can locally host your project in your IIS server.

Visual Studio 2017 Publish doesn't update executable

I'm using Visual Studio 2017 and .NET Core 2.0 to create a simple console app which I want to run on Windows and macOS.
I'm running VS 2017 version 15.5.4.
I've followed the section: "Self-contained deployment without third-party dependencies" from that page.
I make changes to my .cs files and build and the changes are reflected when I debug and then I published the app and it changed it too.
I've now gone back after restarting my laptop and when I build and publish the console application .exe file has the earlier time-stamp and now runs "Hello World" default console app instead of my code.
I've published both Debugs and Release versions and tried creating different profiles and it either comes out as the Hello World App or my first completed publish, but never my latest version.
Any ideas?
Try Cleaning the solution
If this doesn't work, delete the files included in the .vs folder then try rebuilding the project

Change Published Project Install Directory in Windows8.1

I am trying to change the default installation directory of my projects when I publish them but I seem to have no choice over where the published setup.exe actually puts the program. It seems after setup.exe running and application installed, all the processed files are under the folder of C:\Users\{username}\AppData\Local\Apps\2.0\ (Something like that, I dont remember the exact directory as it is very long). This is not what i want as I installed the program in the C:\Program Files\ but all the log files go to the C:\Users\{username}\AppData\Local\Apps\2.0\. This is really really annoying.
The application I published is C# Windows Form Application
And I have looked through online and found that somebody suggested to create an MSI package for C# Windows Application Using a Visual Studio Setup Project instead of publishing the program:
Publish Windows form application how change the installation path
It is supposed that the above website can solve this problem. Are there any other suggestions to solve this redirection problem after publishing the C# Windows Form Application? Thank you.
When you use the Publish funtion in Visual Studio, you are creating click-once publication. This type of deployment has relatively fixed rules and not everything can be configured. It allways installs into an obfuscated folder under windows user profile. It is similar to the fact, that you cannot change location where windows-store modern apps are installed under Windows 8.1.
You can create MSI setup project for your app - but in Visual Studio 2012 this type of project is missing and it was re-introduced againg in Visuals Studio 2013. There you can specify install folder. You can also use Install Shield Lite with Visual Studio 2012.
You wrote:
This is not what i want as I installed the program in the C:\Program
Files\
It is not possible to install ClickOnce application using Publish button in Visual Studio into C:\Program Files\.
If you have just problem with the location of your log files, you need to specify a different folder within your application code. Make sure that user, who is running your app, has write access to that folder - it should be in some user's profile folder or in a public folder. Avoid %ProgramFiles% as a folder for your log files - it is not a good practice.
Instead of Application.StartupPath you should use path accessible to all users including non-admin, like:
Path.Combine(Environment.GetFolderPath(SpecialFolder.CommonApplicationData),"MyCompanyName")
You can use InstallShield to create installation wizards/Setup.
Here's the free version for Visual Studio

How to log a project that is being deployed from Visual Studio?

I have a C# project written using Visual Studio Express 2013 for Windows Desktop. When I run the project in debug mode via Visual Studio (on Windows 8 Pro) it executes just fine, and so does copying the files out of the bin directory.
I need to deploy to a Windows 7 Embedded System with the correct version of .NET Framework. I tried:
copying the files over with the .dll and everythig from the bin folder and when starting I get no error, but doesn't start at all. I get no information at all.
tried the one click installer (choosing the option to install from dvd) and it seemed to install fine, but when I start it, I get same issue. Not starting, and no messages.
I also tried the Advanced Installer (free version) and when importing the visual studio project files it fails with the message "Failed to start Visual Studio. Error: Invalid Class String"
[UPDATE] Advanced Installer cannot import VS Express solutions because the API from VS that provides assistance on import is not available for VS Express edition. Only solutions created with paid editions of VS can be imported in Advanced Installer.
So how can I log or see what is happening to debug this?

Dotfuscator post build for visual studio setup project VS 2010

I am using Visual Studio 2013. I have a .NET application that is getting deployed via Visual Studio Setup Project. Right now I have the Primary Output of the application begin used in the setup project. I want to use the Dotfuscator tool to obfuscate my code and then used the dotfuscated output for my setup project. Can someone lead me in the right direction?
I have tried the following
1: On my application post-build event, pass my .xml configuration file from Dotfuscator to the Dotfuscator application. This created an obfuscated exe, but it was still deploying the regular exe with my setup project
On my application post-build event, pass my exe to the Dotfuscator command line tool with the community edition...it would create a obfuscated exe in the Dotfuscated folder and then copy it over to my Release folder. However, the setup project was still deploying the regular exe with my setup project.
Any suggestions?
Found the answer via another thread...I was not aware the Visual Studio Setup Project pulled the 'Primary Output' from the obj folder instead of the bin folder. I copied by obfuscated exe to the obj folder before the setup project was built and this worked.

Categories

Resources