How to change asp .net web service application build path instead of bin folder? - asp.net

I am working asp.net web service application.
Normally running time my application dll taken from bin directory.
now i want to add some XML file and folder,so i want to change web service build directory.
I changed directory like this [ex:bin\Common],but this kind of issue came.
Parser Error
Parser Error Message:** Could not create type 'WebService.MainLogic'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="MainLogic.asmx.cs" Class="WebService.MainLogic" %>
Source File: /MainLogic.asmx Line: 1
How can I change the directory?

you can copy bin folder to specific folder after build project.
Right Click on project and go to properties => Build Events
in Post-build event command line write below command :
xcopy /Q /Y "$(TargetPath)" "C:\path\to\somewhere\"
for more information see this link : Copy bin files on to Physical file location on Post Build event in VS2010

Related

Visual Studio looks for dll in the wrong directory

I am getting an error of "Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies" in the browser of my asp.net app. Microsoft.AI.Web is from Microsoft.ApplicationInsights.Web NuGet package.
I noticed this:
LOG: Appbase = file:///D:/Source/Workspaces/AppName/Branches/Main/Application/WT/
LOG: Initial PrivatePath = D:\Source\Workspaces\AppName\Branches\Main\Application\WT\bin
the dll in question is located at D:\Source\Workspaces\AppName\Branches\Main\Application\packages\Microsoft.ApplicationInsights.Web.2.4.1\lib\net45\Microsoft.AI.Web.dll
As for personal dll's -- In the project-->properties-->build-->output path--> I have it set as "..\Any\Debug\". When I build the project the DLL's populate there.
I checked References and code in .csproj file and all the dll are located where I specified to.
I am not sure why it's trying to look at the bin file of the project when I told the output is somewhere else AND to look for the dlls in that same folder(through references and .csproj file). How do I make it so that VS will look for the dlls in the folder path I want instead of "WT\bin"?
When I change my project output path to "bin", it can detect the dll's there EVEN though the path of the dll remains the same( D:\Source\Workspaces\AppName\Branches\Main\Application\packages\Microsoft.ApplicationInsights.Web.2.4.1\lib\net45\Microsoft.AI.Web.dll).
Since it's a Microsoft strong signed DLL, add it to the server's GAC.
If you place it in the GAC, it'll find the file automatically. Another plus there is that if you need it for another project deployed on the same server, you don't need to deploy it again.
Here's some information on how to install a DLL into the GAC on the server machine, assuming gacutil is not installed there. Look at the accepted answer, not the question.
Drag and drop a DLL to the GAC ("assembly") in windows server 2008 .net 4.0
Copy gacutil.exe and gacutil.exe config from your machine to the server's C:\Windows\Microsoft.NET\Framework\v4.0.30319
Then run on the server:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\gacutil.exe" /i "PATH TO YOUR DLL"

error ASPPARSE: Could not load type error with msbuild on teamcity

I'm receiving error ASPPARSE: Could not load type error when building a project on team city.
The file it is failing on is a folder which is not referenced in the project but is just there for source control.
C:\TC\Agents\3\work\fd3ea8938fa12582>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler -v /DummyDeployWeb -p C:\TC\Agents\3\work\fd3ea8938fa12582\Project C:\TC\Agents\3\work\fd3ea8938fa12582\PreCompiled\Project-fixednames -u
ERROR
/DummyDeployWeb/common/files/somefilename.ascx(1): error ASPPARSE: Could not load type 'Project.somefilename'
How can I get the project to build and ignore these folders that arent referenced?
The ASP.NET compiler knows nothing about project files, it simply processes the entire contents of the folder you point it at.
There is no way to tell the compiler to exclude specific files and so if this is a requirement for you then one solution would be to move these files out of the folder before you run the compiler and then copy them into the deployment folder after the compilation is complete.

ASP.NET runtime error: An error occurred loading a configuration file

C:\Users\****\StorageFolder\WEB\MyPage\MyPage.aspx: ASP.NET runtime error: An error occurred loading a configuration file: Invalid file name for file monitoring: 'C:\Users\****\StorageFolder\WEB\web.config'. Common reasons for failure include:
- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory
- Access denied. (C:\Users\****\StorageFolder\WEB\web.config)
The error occurs on this line of the aspx file:
<%# Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Templates/Default.master" CodeFile="MyPage.aspx.vb" Inherits="MyPage" %>
This issue happens when I'm trying to open MyPage.aspx and MyPage.aspx.vb. This is NOT a website project or visual studio project in any way, just two individual files sitting in a folder.
For the path it is referring to, that web.config it references is a folder containing a web.config file.
There is no web project or visual studio project relating to these files. I am not editing this on a web server. VS2012 should have no interest at all in that web.config folder as far as I can tell, so why does it?
If I rename that web.config folder to something else, the error when opening the page files vanishes, but why is this happening at all?

Error while publish MVC3 project

Error 1 Copying file Content\themes\base\AdminHomeImages\GiftControl.jpg to obj\Debug\Package\PackageTmp\Content\themes\base\AdminHomeImages\GiftControl.jpg failed. Could not find file 'Content\themes\base\AdminHomeImages\GiftControl.jpg'. 0 0 ResturantManager
I get the above error while publishing MVC3 project.. What should i do to solve it.
When you choose to Publish the Project and Let's say your Publish Method is "File System" that means you are copying your necessary files from one location to another location. The Index of these files are mentioned in your project file. You have two options below
(a) Remove the Index of these files(Files causing Compilation Error) from your Project File and Publish
(b) It is must to keep the Project related Files to their exact location(Files that causing Compilation Error, Try keeping a fake file with same name and same Extension). This relative path is mentioned in your project file. Publish now
This Compilation Error will not be shown when you Rebuild/Build the application.

How To Run MSBuild scripts in .wixproj?

Im trying to learn to make a web installer using Windows Installer XML (WIX 3.5). I found this blog about using msbuild in .wixproj files to avoid the scenario where the installer ends up dropping the web project assemblies right in the root of the app instead of keeping them in the bin folder like they're supposed to be.
Here is the link to that:
<http://www.paraesthesia.com/archive/2010/07/30/how-to-consume-msdeploy-staged-web-site-output-in-a.aspx>
But after adding the MSBuild scripts in the .wixproj file, I don't know what to do anymore. According to the instruction after adding the MSBuild script:
"When that target runs, you'll see a .wxs file pop out in the .wixproj project folder. Add the generated .wxs to your .wixproj project so it knows to include it in the build."
I really don7t know what this means. How can I run the target? I tried to build it but there was no .wxs file generated in the .wixproj folder.
Am I missing something? Please help...
Assuming you have added the section from the tutorial:
<Target Name="BeforeBuild">
...
</Target>
The target will be run automatically when you build the project. The "BeforeBuild" target is one of the standard entry-points to add your own modifications to the build. The target will then generate a file (named [WebProjectName].wxs that is placed in the same directory as your wixproj file. Click on the show all files button in visual studio and right-click on the file and "Include in project" That will then include the wxs is your installer and when you next build it will have the correct folder/file structure.

Resources