I have c# class library that it is a part of a big web site. After build, generated dll file copy to bin folder automatically by post-build event command line:
copy $(TargetPath) "C:\MyWebSite\bin"
My web site run under IIS and I want to debug my class library that its in a separated solution. How can I debug it?
In solution with your DLL which you want to debug, set break point and choose from menu Debug - Attach to Process..., then choose w3wc process with your site pool
Related
I have this WinForms application that uses an external dll file (Winppla.dll) so I can print tags in my Argox printer. Since I cannot add the dll file as a reference to the project, I use the command [DllImport("Winppla.dll")] on my class.
When I run the project in Visual Studio, it works perfectly.
Then I published my application using ClickOnce and when I try to run the application, I get the message error saying that the Winppla.dll could not be found, even though I am running it on my machine.
I tried to:
copy the file to the bin folder of the project before publishing
copy the file to the packages folder of the application before publishing
copy the file to the latest version folder on the Application Files folder (on the publishing location of the application)
add the file as a resource on the project
add a folder with the file as a Reference Path on the project
but none of these worked.
This project also uses SAP CrystalReports, and it works just fine.
Any ideas about how to make it work?
Following #Bearcat9425 instructions in the comments section of the question, I finally solved the problem:
Copy the file to the project folder and include it on the project
(on Solution Explorer, click on 'Show All Files', then right-click in the file and select 'Include In Project')
Mark the file as one of the application files on my publish tab
(right-click on my project and select 'Properties', then go to Publish tab and click on 'Application Files' and make sure the Winppla.dll is marked as 'Include')
Copy the Winppla.dll file to a shared folder in our server (I placed it on the same folder where I placed the setup of my application)
On each DllImport command write the complete path to the file shared location: [DllImport(#"\\the-path-on-the-server\Winppla.dll")]
Publish!
I have created a Console Application where I've added Microsoft.AnalysisServices dll. I want this App to be Scheduled for every 30 minutes.
I've Published the Application but when I give setup.exe path in Windows Task Scheduler, the task not runs
When I give the applicationname.exe path from the bin/Debug Folder, the application runs
reference: https://www.c-sharpcorner.com/UploadFile/manas1/console-application-using-windows-scheduler/
but I don't want to carry the project folder to the Production server, I need a single exe/setup file
I have also tried copying application.exe file from bin folder on desktop but it throws exception 'cannot find Microsoft.AnalysisServices', here is the Screen shot:
Please Help
For a (simple) console application, the easiest solution is to use what Microsoft propagated right from the start of .Net: "xcopy deployment".
Depending on your build target (Debug or Release) take everything from the [project dir]\bin\Debug or [project dir]\bin\Release and copy it to a application folder of your choice.
In your Scheduled Task, reference the executable in this application folder.
You can streamline your deployment by adding an automated copy task as a Post-Build task to your project configuration.
You need to copy the whole output folder (publish artifact). You can omit things like the pdb files or xml documentations... You can also use tools like ILMerge to merge dependencies like the Analysis dll into one file, if you really need to.
i want to deploy mvc web site that build with visual studio,to the specific folder location.
how can it done with project post-build event command.
when project build should publish website to the specific folder location.
Two steps:
Create a publishing profile for your project using deploy to file system as a publishing method
On your postbuild event call the msbuild.exe with the DeployOnBuild=true parameter specifying you publishing profile.
I am assuming project is building successfully & has resolved all external references.
1. First set Target Location for a Directory like below image in web project:
this is optional but better than change debug/release from build path again & again.
2. Add something like below in Post-build events:
copy "$(ProjectDir)\bin\*.*" "c:\check\"
Hope it helps.
Update
Is this asp.Net mvc Web project or website? Web project can set output path to bin as in step 1. If you don't want that command in step 2 need path of compiled code as first parameter & path where you need to copy as second parameter, wherever they are. It uses copy command which is as old as DOS & Linux. Refer
https://technet.microsoft.com/en-in/library/bb490886.aspx for copy command.
I am getting below mention error in VS 2010. After getting this, Just restarting my machine and its working fine. But while hosting my application in windows server 2008 + IIS 7.0 its not working. Could you please suggest.
Error 107 Unable to copy file "C:\Inetpub\wwwroot\solution\Data.dll" to "bin\Debug\Data.dll". The process cannot access the file 'bin\Debug\Data.dll' because it is being used by another process.Services
Error 106 Unable to copy file "C:\Inetpub\wwwroot\source\Business.dll" to "bin\Debug\Business.dll". The process cannot access the file 'bin\Debug\Business.dll' because it is being used by another process.Services
You are compiling the application while it is running and IIS is using the DLLs.
The result is that the compiled DLLs cannot be copied because IIS is using them.
Reset IIS (or at least recycle the relevant application pool) before compiling.
You may want to reconsider setting the IIS web application folder to the project output folder.
Please check your Build Configurations under (VS2010) Build->Configuration Manager.
All projects should be in Debug or Release mode, and also check that the project Build check box is checked correctly.
Command prompt
copy source destination give full path of destination
copy C:\Inetpub\wwwroot\solution\Data.dll" "bin\Debug\Data.dll"
this is for copying file on the the same computer
I have several ASP.NET web projects and their Output folder are set to "C:\Builds\[ProjectName]bin" (instead of the default "bin\" folder). This makes "F5" Debugging not working because the ASP.NET Development Server expects the "bin" folder under the project folder.
I then changed to use Local IIS Web server (http://localhost/webproject1") and manually updated the vdir physical path to my custom output path. However the VS2010 will not load the csproj because it detects the url is already mapped to a different folder location.
I know I probably shouldn't change the Output folder. But wondering if there is an easy way to workaround this? The goal is to make "F5" debugging work with custom build Output folders.
Update due to Aristos' answer:
Thanks Aristos. Unfortunately that won't solve the problem. All my projects already use the Project Reference, so all the reference dll's are correctly copied to the output folder. The reason why F5 debugging does not work is because the output folder is not the normal "bin" sub folder, but in some other path say C:\BuildsOut\Foo\bin.
It seems that in order to use F5 to debug the web project in VS2010, it has to use the default Output path "bin". If you change that, then F5 will not work and even worse your project may not even load.
Ian,
I have been frustrated by the same problem. I finally gave up and put this dirty little fix in place. I added the following to the "Post-Build" event:
copy "$(TargetDir)MyWeb.dll" "$(ProjectDir)bin"
copy "$(TargetDir)MyWeb.pdb" "$(ProjectDir)bin"
This at least lets me debug the site properly and hit my breakpoints.
You place them all on one single solution, you set as the started project your web project, and then you add on your web project the rest dll as reference (right click on web, select on menou "add reference", and automatically gets the latest version of dlls and place them on bin.
Now when you ress F5 if anyone dll project needed is automatic build it, then run the subproject with the new dll inside.
Delete all items in your bin folder for the solution in question, shut down your system and restart. This fixed it for me at least.