I am a little confused regarding dotnet build vs dotnet publish topic.
When I say difference, I mean what is the physical difference among them.
I see that dotnet build generates the same files as dotnet publish unless it is self-contained.
dotnet build will generate dll files in folder bin in your local project folder
dotnet publish will build, generate dll files and deploy in where you want.
For example, you can deploy to a hosting provider, to a file folder on your network (you can manually copy from there to a folder used by IIS), to IIS on your development computer as a testing environment, to a server on your company's internal network.
Read more "How to: Deploy a Web Project Using One-Click Publish in Visual Studio": https://learn.microsoft.com/en-us/previous-versions/aspnet/dd465337(v=vs.110)?redirectedfrom=MSDN
Related
I'm trying to migrate an old azure deployment that was previously run on windows and relied on using msdeploy into our CICD pipeline that is using a debian dotnet sdk. Is there a easy way to do this with a publish profile? I can no longer use the old MSDeploy profile, and it appears that using an FTP profile is not supported through the cli, it will only generate a local release folder.
My goal is to be able to call the follwing without additional steps
dotnet publish WebService/WebService.csproj -c Release /p:PublishProfile="sandbox"
I tried converting to an FTP profile using the ftps credentials in azure, however it only publishes into a local folder on the runner when using this profile.
I just finished my first C# console app on Visual Studio 2022 on Mac and I need to publish it to a standalone executable app. I am able to get the exe on Mac working fine. But my teacher needs to open it on Windows. How can I do that?
When publishing, VS on Mac does not ask for the target runtime machine at all...
Thanks.
Sure, you can always publish for a different platform, e.g:
dotnet publish MyProject.csproj --runtime win-x64
This should give you a publish\win-x64 directory with a windows exe file in it. You can give that folder to your teacher.
This is my current MVC Project setup for a project named ABC.sln
Project ABC.sln with following projects
A.csproj, B.csproj, C.csproj
I am trying to publish A.csproj to IIS via VSTS Visual studio build (version 2019)
Here is my msbuild arguments:
/p:SolutionDir="$(Build.SourcesDirectory)" /p:DeployOnBuild=True /p:Configuration=$(BuildConfiguration) /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl=serverpath.com /p:DeployIISAppPath=mysite.com /p:OutputPath=$(Build.BinariesDirectory) /p:AllowUntrustedCertificate=true /p:UserName= /p:AuthType=NTLM /p:DeleteExistingFiles=True /p:SkipExtraFilesOnServer=False
Solution:
$(Build.SourcesDirectory)/A/A.csproj
Platform: AnyCPU
Build runs successfully, and I do get the:
Successfully executed Web deployment task.
Package "A.zip" is successfully created as single file at the following location:
file:///C:/agent/_work/54/b/_PublishedWebsites/A_Package
To get the instructions on how to deploy the web package please visit the following link:
https://go.microsoft.com/fwlink/?LinkId=124618
GenerateSampleDeployScript:
Sample script for deploying this package is generated at the following location:
C:\agent\_work\54\b\_PublishedWebsites\A.deploy.cmd
For this sample script, you can change the deploy parameters by changing the following file:
C:\agent\_work\54\b\_PublishedWebsites\A.SetParameters.xml
PipelineDeployPhase:
Publish Pipeline Deploy Phase
Done Building Project "C:\agent\_work\54\s\A.csproj" (default targets).
However, I do not see where it was published. I do not see any of the files published in any folder on my IIS server for this app pool.
Why does it say package? Shouldn't the files from A.csproj be directly published to the mentioned p:DeployIISAppPath?
Why does it say package? Shouldn't the files from A.csproj be directly
published to the mentioned p:DeployIISAppPath?
One of the workaround you can follow,
To check if the .csproj file exist or not please check the scm site whether its available or not under D:/home/site/wwwroot . And make sure that deployed file structure is same as on Azure and IIS. Please find the reference image to check the scm site.
For complete setup to deploy ASP.Net MVC app to IIS on Windows please refer this BLOG by#Asma Khalid .
For more information please refer the below links for the similar issues:-
SO THREAD| How to deploy the entire project to IIS ,
Automatically publish web application on build from Visual Studio ,
How to deploy an ASP.NET MVC application on build using MSBuild in Visual Studio .
I wrote this small .net core app that backup and transfer mysql database from a server to a dockerized app. However, when I put it in docker and try to run it nothing happens. If there is an error in the app it should console.writeline the error message but nothing.
FROM mysql:5.7.34
COPY ./dbmover /tmp/dbmover
WORKDIR /tmp/dbmover
EXPOSE 3306
As you already figured out my released .net core app is contained in the dbmover folder and copied on the docker container.
Now if I connect to the container shell and execute the app I get no output of it. I run ./myapp.exe
There are my release settings for my app.
Note that this application is not meant to be dockerized it is just a tool to help build the container.
What am I doing wrong ?
SO I didn't noticed at first but I was publishing with visual studio instead of the command line tool. Once it is done publishing it is ginving you the path of the publish. What I ddin't notive is that it was the parent folder of the publishing folder which was linux-x64 folder. Once I took the linux-x64 subfolder instead of the main one it started working.
I have a hard requirement from the developer to use a website project instead of a web app project for a .net deployment. I am able to connect and use continuous integration just fine with a web app project, but when using website, it fails to find the compiled files for deployment:
#[debug]check path : D:\a\_tasks\PublishBuildArtifacts_2ff763a7-ce83-4e1f-bc89-
0ae63477cebe\1.142.2\task.json
##[debug]set resource file to: D:\a\_tasks\PublishBuildArtifacts_2ff763a7-ce83-4e1f-bc89-0ae63477cebe\1.142.2\task.json
##[debug]system.culture=en-US
##[debug]PathtoPublish=D:\a\1\a
##[debug]check path : D:\a\1\a
##[debug]ArtifactName=drop
##[debug]ArtifactType=Container
##[debug]system.hostType=build
##[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.
Looking at the build process, it's compiling a copy of the deployment to the PrecompiledWeb folder instead of the debug folder, which seems to explain why it cannot find the results. Has anyone had luck deploying with a website project or have you run into the issue above?
Azure DevOps Continuous Integration with asp.net website project instead of web application
Since the project is asp.net website, you may need use the website.publishproj file instead of the .sln file when you publish the asp.net website project with MSBuild.
The command line like:
msbuild.exe "<PathToTheFile>\website.publishproj" /p:deployOnBuild=true /p:publishProfile=WebsiteTestDemo /p:VisualStudioVersion=1x.0
With this setting, MSBuild does not create the PrecompiledWeb folder and the publish uses the setting in the profile.
Check my previous thread for some more details.
The website project the publish process is not plumbed into the build
process. For website project since there is no formal build process
there was nothing for us to really extend.
Hope this helps.