When publishing my web application, I get the following error:
Done executing task "CopyPipelineFiles" -- FAILED.
Done building target "CopyAllFilesToSingleFolderForPackage" in project
"ServiceManagement.csproj" -- FAILED.
Done building project "ServiceManagement.csproj" -- FAILED.
I use Visual Studio 2015. I also tried opening it in administrator mode.
One possible cause is, if you have included some files in the project that are not necessary to compile (like PowerPoint files or word files), & then removed the files from the hard drive, but forgot to delete them in the "Solution Explorer" inside Visual Studio - then "Rebuild Solution" will work b/c those files were not necessary to compile - but "Publish" will fail b/c it cannot find those files when Visual Studio tries to copy files to the publish destination.
I was able to fix it with the following actions:
Remove all unrelated scripts and libraries that you are not using on your project.
Remove all src folders on your scripts.
Since I copied the whole project script files with its corresponding directories, this was I think the main issue that cause the publishing to fail as some filenames are long.
I retain only the one javascript file and one minified file, the same way with CSS files.
If you weren't able to still solve the issue after doing the actions above, try the following (Either of this actions works for us.):
Try to rebuild the project on a different machine.
I am using Visual Studio 2015 Professional Edition so I tried the Visual Studio 2017 to build and publish it.
I kind of had this issue and was because of a corrupted file that couldn't sync in OneDrive. I had a folder that coudn't be opened or deleted with the message "tag present in the reparse point buffer is invalid". By making a "chkdsk /r /f" in a Command Prompt (w/ admin permissions) my build was fixed and I could publish it again in Azure.
Related
I want to use C# in Visual Studio but I cannot execute any C# projects
And it just shows the error, which says "Failed to read NuGet.Config due to unauthorized access. Path ...." also says "you should restore the NuGet Packages before build..."
I don't know how to solve this problem, how to restoring packages.. and able to make access authorized...
the image when opening the project at first, the content in the green box tells all in that error message
Actually it is not about the code, the point is I cannot do anything due to the error above.
I found what was wrong in this problem.
Actually, from the error messages it was the point that VS cannot read NuGet.Config file in NuGet Directory in .config!
And (I am not sure exactly) VS could not make NuGet directory in my .config directory due to some access problems! So I make the NuGet directory like below picture by myself and now VS successfully restore the NuGet Packages!
I took a long time at this "simple" problem. I hope the others with same problem above not to waste pretty much time like me..
For macOS Big Sur the solution is easier. Because Visual Studio is not an Apple program you should give it full disk access in System Preferences > Security & Privacy
For Mac OS: Create Nuget folder inside .config folder.
.config is a hidden folder so access then using cmd+shift+..
And change the permissions of the config folder by right clicking on
.config->Get Info
I tried loading the solutions folder in Visual Studio Code however the build configurations are all wrong and I wasn't able to figure out how to tell VS Code which project to run.
To further complicate things I 'deleted' the folder structure in VS Codes solution explorer and now I can't see the folder structure when I try and load the same folder directory.
VSCode doesn't support the .sln files the same way as VS. It is a directory based editor first of all, not a full IDE. For example, the VSCode Explorer is used to browse, open, and manage all of the files and folders in your project (workspace).
All workspace settings are stored inside your workspace in a .vscode folder and only apply when the workspace is opened. Settings defined on this scope override the user scope. It may help to think about workspace as a root folder that was used to open the project in VSCode.
In general, to be able to build, debug and run the application in VSCode, you need to configure build task and launch configuration.
VS Code provides a conception of
tasks to allow actions like project building. Tasks are defined in task.json file;
launch configuration so you can run/debug app. Launch configs are described in launch.json.
VSCode looks for this files also in your workspace's .vscode folder.
During the configuration process, if you need to specify a path to something in your project, it is common practice to define it as a relative path to this workspace folder by using ${workspaceRoot} variable.
If you install C# for Visual Studio Code (powered by OmniSharp) extension, it helps you to generate appropriate configurations for .NET Core projects.
I changed jobs this year, so due to that i switched from Java to C#.In both jobs I work/worked on a large application that is deployed to a server and exposes various webservices.
With the Java job, an ant build process created a .ear file that contained a .war file and other objects. This .ear file was deployed by copying it into a directory within a JBoss/tomcat server. I understood the process fairly well.
With the C# job, I press a green triangle "play" button in Visual Studio and the application is compiled and somehow deployed to IIS, and Visual Studio then starts up a web browser pointing to the application's URL. I don't completely understand what is happening under the hood during this process. We have a build server that creates production builds that go out to production servers, but I don't understand a) what artifacts are produced by the build process, and b) how are those build artifacts deployed to IIS.
I would like to understand the process well enough to manually drive builds and deployments, re-automate the process, and also troubleshoot and modify our existing build and deploy process. I can drive a build with msbuild, but what does that produce, and how would I get it deployed onto another machine's IIS installation?
What happens when you hit Run (the green triangle) is probably not the best example, because it is using a specialized form of IIS (sometimes called Cassini) hosted within Visual Studio with a debugger attached.
To get a clearer picture of what happens when deploying, use the Publish tool to deploy to a folder on your desktop. In that folder you will see what is essentially the web root. Your project, minus any code files, and a bin directory with the compiled binaries.
Typically only static files such as html, css, and png, etc. will be deployed, while any code files won't. By default Visual Studio "knows" which files to build into the binary, and which to simply copy to the output folder (and which to ignore). But you can change this in cases where you need to override that behavior, or you have a file type VS doesn't know about. In your solution explorer, right click on a file, select properties. In the properties window for that file you'll see "build action", which shows what VS will do with that file.
Hope that helps.
Just add a note.
So,
If you are working with ASP.NET Website, it should enough to manually copy it to publish folder
If you are working with ASP.NET Web Application, so before publish it should be compiled. All compile operations is performed by MSBuild - command line utility to buld .net projects. But how MSBuild can understand, what it should build and in what way? Easy - there special files with instructions for MSBuild - is solution files (example howto build project from command line "C:\...\MSBuild.exe" /maxcpucount:10 MyAwesomeSolution.sln). Solution file contains references to project files (and build order for projects, etc), project files contains references to files, which included in project (and type of project - library/console/web app/etc, and framework version, and action for each file - build/content/resource, etc). If some file does not included to project, it will be ignored.
So, when you press green button, firstly VS will run MSBuild to build your solution. Inside solution should be written, which project will be used as starting point and what should be done before/after build. Inside project there information, howto debug project (via IIS, IIS express or smthg else).
So, when we working with some CI server, to compile our solution is enough to run MSBuild on CI server with path to solution. Ofcource, to publish compiled solution via CI, additional scripts should be written (to cpy files, etc).
Also, if you want to publish you website to some location, you can create "publish profile". It allows you to publis your website to IIS, FTP, etc, but you have to press "publish" button manually (right click on web project => publish)
I'm having a problem with a web application where the events in the global.asax class aren't being executed when I build the application through our build server and publish the website. In Application_Start is a single line of code sets up our logging, and in Application_Error I have some error handling code. Locally it all works fine, and if I copy the files directly from my development folder to the server rather than publishing it via the build server everything works fine.
From loads of Googling it would appear that this is a problem with the precompiledapp.config file being missing - sure enough it doesn't exist anywhere. However, nowhere can I find out how I actually get the TFS Build Server, or Visual Studio (2010), to create this file so that I can publish it.
Any advice on how I can generate this file would be much appreciated.
EDIT: A bit more information. I've just tried publishing the website through Visual Studio 2010 rather than the build server and this created the precompiledapp.config file. I copied all the files across to the server (except web.config which I left intact) and it logs successfully (which suggests the global.ascx events are being fired). What I need to do now is try and get the build server to do the same thing - any ideas?
Make sure your custom config file is set as a content file and Copy To Output is set to Always in the config file properties in Visual Studio.
I seem to have resolved this issue now.
As I mentioned in the Edit of my original message, when I published the website through Visual Studio 2010 to a local folder it created the Precompiledapp.config file, and copying the folder contents to the test version of the application got everything working. As I can't seem to get the TFS Build server to create this file, I decided to try just copying the file from my local publish folder to the test application, along with the rest of the files from the tfs build, and everything seems to be working as it should.
So although I've not managed to figure out how to get the build server to generate this file, my main issue is resolved and I'm able to use the global.asax file again.
I'm late to this question BUT you should probably verify that you have the correct SDK that visual studio would use to build the precompiled app (I think it's Azure SDK even if not doing anything with Azure but not 100% on that).
If you have visual studio installed on the build server you can just install the web workload (opening the solution will prompt it). I did this with Visual Studio 2019 today. MSBuild was ignoring not only my *.pubxml settings but even passed in properties via command line arguments to msbuild.exe (which overwrite the ones in the *.pubxml file).
I opened Visual Studio, it prompted me to install the necessary workload and I did. Everything started working as expected after that.
To precompile, in your pubxml file make sure to have this:
<PrecompileBeforePublish>True</PrecompileBeforePublish>
Also, this post refers to your Edit comment about how to get the build server to do it when it works on your machine.
So I made a C# program, and its great and all (its a Windows Form Application). The issue with it, is I don't know how to use it outside of the debug mode form. How do I publish it? My target goal is to create a two folders, put a shortcut to the application in one, along with the other folder which will contain the application and all outside programs (some of the buttons link to batch files). Then I'd want to be able to put it in a RAR compressed file, and upload it online for others to download it.
How do I publish it so that happens? How do I take it out of debug mode?
Go into your project folder, then navigate to /bin/Release. If there's an EXE file with the title of your project in there, copy it somewhere (along with any DLLs that you may have linked) and there's your program. If it's not there, first try Build -> Compile Solution in Visual Studio. If it's still not there, navigate instead to /bin/Debug and do the same thing. Then, copy all your batch files into another folder, put them into the same folder, and RAR it.
P.S. Try not to use RAR, few people can extract them. Use ZIP or SEA (self-extracting archive) if at all possible.
First off, you need to build your application in Release mode, in Visual Studio simply change the drop down near the top of the window to "Release." This will create a bin/Release directory where your sources are located. The folder will contain an EXE for your application and DLLs you need to include. It could (and probably will) include some debugging *.PDB files that you do not want to include -- as those include debugging information.
Copy the contents of that directory somewhere and RAR it up.
Building in x86 Mode
(You should only do this if you have a specific reason to)
If your application uses 3rd party DLLs that are not 64-bit compatible, you may need to do a release build in x86 mode. To do that, click the "Any CPU" drop down and click "New Configuration" (or something like that) and follow the steps to add x86. Then build with the x86 -- Release setting. That will output x86 binaries to a bin/x86/Release folder where your sources are located.
The Preferred Soltuion
Most users are going to prefer some form of automatic installer instead of a simple RAR or ZIP. Visual Studio (Standard/Pro) can create self installing MSIs that do all the work for you. A basic overview is here. You can add shortcuts/etc using the wizards Visual Studio provides.
If you need an even more robust installer you could check out solutions such as InnoSetup or NSIS
To build your application in Release mode instead of Debug, go to the Build menu and select Configuration Manager.
Change the Active soluction configuration to Release. Now, when you build your solution, it will put the executable in the /bin/Release folder.
If you need to automatically perform certain actions once the solution is built, like packaging into a RAR or ZIP archive and copying the distributable to another folder, then check out post-build actions.
After Visual Studio 2010 , Microsoft remove Make setup utility facility from the visual studio and,we have to downlorad that plugin seperatly from
Get InstallShield Limited Edition for Visual Studio
You Have to fill the application
After intalation, goto
Visual Studio-->New Project-->Other Project type-->Setup and Development
You will see follwing screen
Now you can goto InstallShield setup utility and change the things as you requirement.
add all file in debug folder of your project in follwing interface and build solution,
Final setup will locate in your setup folder-->Express\CD_ROM\DiskImages\DISK1**
hope this will help you