-3

I am coming from the Java world into the C# world so I'm sorry if this question doesn't make sense. But, overall, what I'm trying to do is figure out how the C# world handles packaging and publishing C# applications. Not a library DLL, but an application, which is basically what's ends up in the bin/Release directory.

I need this to run CI build environment. I've found a lot of references to clicking in Visual Studio to do this, but, that doesn't work in a CI build environment.

I need to "build", which is basically generate the contents of the bin/Release directory

Next I need to "package", which is basically zip up the bin/Release directory

Finally I need to "publish", which is take that zip file and put it somewhere which I can retrieve it by name and version.

"build" is easy. I think I have that figured out. I thought a Nuget would be used to package and publish the application similar to how Maven works for Java. But it doesn't look like Nuget is used for applications, only libraires? If that's the case, then where can I put application versions?

Michael Remijan
  • 687
  • 7
  • 22
  • https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs?tabs=vs156 – Nigel Feb 28 '22 at 21:03
  • Does this answer your question? [Best way to deploy Visual Studio application that can run without installing](https://stackoverflow.com/questions/16946173/best-way-to-deploy-visual-studio-application-that-can-run-without-installing) – Progman Feb 28 '22 at 21:04
  • The C# world is very different from the Java world in this regard. In particular, the rules for packaging are much more liberal (for example, namespaces can span _assemblies_ and classes can span source files). The other thing is that the Visual Studio solution and project structure are de facto standards, allowing things like what @d.fernandes shows in his/her answer. Create and manage your project in VS and then use the command line tools to do the rest. – Flydog57 Feb 28 '22 at 21:30
  • If you are trying to create a workflow environment for a desktop application, you can create Github Actions and configure some YML files for this purpose. Microsoft has a Github repo specifically designed to do this and step you through it. [Check it out here.](https://github.com/microsoft/github-actions-for-desktop-apps#workflows) – Icemanind Feb 28 '22 at 22:21

2 Answers2

0

You can check Microsoft's documentation on how to deploy your apps.

Publish a .NET console application using Visual Studio

I also suggest taking a look into the dotnet CLI documentation. It will help you setup your pipelines accordingly.

In my case, as I use Azure pipelines, I just need to publish like this

dotnet publish --configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory)
D.Fernandes
  • 130
  • 8
  • dotnet publish as I understand it will get me an exe of my application, but then how do you manage versions of the exe? Can it be put into nuget? – Michael Remijan Feb 28 '22 at 21:58
  • It's hard to say without knowing more about your environment, but this is how my pipelines are working now: https://blog.siliconvalve.com/2018/02/07/easy-release-versioning-for-net-project-using-vsts-and-tfs/ You basically will set a global variable that will be used in your yaml (or whatever file your pipeline uses), to handle the versioning. The same applies for nuget packages, but you'll want to use the nuget cli to pack it, and it's only for libs. Hope it's helpful – D.Fernandes Mar 08 '22 at 14:26
  • I've heard before that nugget is just for libs. So where do versions of applications get stored? Especially when considering ci/cd with automated deployments? – Michael Remijan Mar 09 '22 at 02:29
0

Just make use of Advanced Installer to avoid any error in packing your package. It's an easy way and faster way

Opus Corpus
  • 115
  • 1
  • 8