Visual Studio 2017 Publish doesn't update executable - c#

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

Related

Visual Studio 2017 - How to get the "New publisher Wizard"

I have a problem with publishing an app in VS 2017 with the Publishing Wizard. I found a stackoverflow post:
Compile a .NET Core application as an EXE file using Visual Studio 2017
But when I want to go to this menu it only opens an old Publishing Wizard that doesnt have the options I need.
I tried to update my VS 2017 to the newest Version, but it didnt help...
After that I tried to use the first approach of the stackoverflow post above, but I didnt have dotnet(???) so installed .NET 7 SDK. Tried the command in the project directory (where the .csproject lays), but I got the error: MSB4062. So Im back trying to get the new publisher, because I really dont know how to fix MSB4062.
Picture of my Publishing wizard:
Picture of the one I want:
[]
The Publish Wizard is usually the first time you publish a project and will guide you to publish the project to the specified location.
After completing the Publish Wizard, you will find Publish Settings in the Publish view and configure it. Hope it can help you
I needed a .NET Core / .NET console app, but I had a .NET FRAMEWORK console app.
And to create a .NET Core / .NET console app I needed Visual Studio 2022 (maybe 2019 is enough), but I had Visual Studio 2017.
This fixed everything for me.

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.

How to debug a Release build of my WebAPI application?

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

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?

Categories

Resources