0
votes

I have a solution with three projects. The structure is Like this:

>myApp //solution
    >myApp.domain //class library
    >myApp.data   //class library
    >myApp.web    //web app 
>.gitignore
>.deployment

In local environment project works fine. Even if I deploy from Visualstudio it works perfectly fine, however when I deploy it using github, deployment fails. here is the log message:

Handling .NET Web Application deployment. All packages listed in packages.config are already installed. All packages listed in packages.config are already installed. myApp.Domain -> D:\home\site\repository\myApp.Domain\bin\Release\myApp.Domain.dll CSC : error CS2001: Source file 'obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs' could not be found [D:\home\site\repository\myApp.Data\myApp.Data.csproj] CSC : error CS2001: Source file 'obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs' could not be found [D:\home\site\repository\myApp.Data\myApp.Data.csproj] CSC : error CS2001: Source file 'obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs' could not be found [D:\home\site\repository\myApp.Data\myApp.Data.csproj] Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\myApp.Web\myApp.Web.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:\local\Temp\6bb414c0-d47f-480d-8db4-9a08459a55b5";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository.\" An error has occurred during web site deployment. C:\Program Files (x86)\SiteExtensions\Kudu\45.40609.1605\bin\scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd

It seems deploy process couldn't find some files inside objdirectory. I downloaded my .gitignore from github gitignore repository, also according to this microsoft documentation there is no need for including build files.

I changed .gitignoreto include that specific folder (obj/Debug), but it also failed.

Finally, I copied my entire project somewhere else. Then I deleted both .gitignoreand .git. I created another github repository and I pushed everything. This time Azure deploys it successfully.

Also here is .deployment file:

[config]
project = myApp.Web/myApp.Web.csproj

My question is Do I need to include build output files to my repository?

1

1 Answers

0
votes

TLDR: anything in the bin/ or the obj/ directories (or anything else generated at the compile stage for that matter) of any of your projects should not be required to deploy to Azure.

For my azure projects I have set my git ignore file to completely ignore both the the bin folder and the obj folder - also the suo files amongst many others. However simply having these folders listed in your gitignore file will not automatically remove any files from these folders that you have already committed.

Personally I would completely delete the bin and obj folder from your disk and then ensure that if git status lists any files from those directories as removed - that you commit those deletions to your repository. Then because those folders are in your .gitignore file - any future files created in bin or obj directories will not be included in your repository.

A good example of a .gitignore file customized specifically for Visual Studio is the one you've already found at https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - a git ignore file from (or at least in a repository maintained by) the developers of github.