Why are aspx files with <script> ignoring CompilerOptions directive containing version - asp.net

I am manually specifying CompilerOptions in the aspx Page directive to point to an assemblyinfo.cs file so that the aspnet_compiler compiles the dll and sets the file version on the file per this site: http://msdn.microsoft.com/en-us/library/ms228042(v=vs.100).aspx
This works great on pages with no script tags in them, but if there is a script tag in the aspx page, the file version and product name is not set on the compiled file.
Looking at the aspnet_compiler cmdline output in Temporary ASPNET Files, I can see that if I include any tags in the aspx page the commandline is:
...(bunch of refs).../out:{filehere} /D:DEBUG /debug+ /optimize- /win32res:"{path}\Temporary ASP.NET Files\ _test\baa9b374\3a3079a4\55vmujzi.res" /w:4 /nowarn:1659;1699;1701 C:\MyFile\AssemblyInfo.cs /warnaserror- {filename.0.cs} {filename.1.cs}
If I look at the aspnet_compiler output without the script in the aspx page, the /win32res parameter is not present and everything works great.
What magic step do I need to perform to get the aspnet_compiler to include the scripts AND use the proper assemblyinfo.cs information to set file version?
I am using the .NET 4 aspnet_compiler.

Related

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

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

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?

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.

AspNetCompiler including files that are not in my project

I'm using msbuild to automatically build and package a website ready for deployment. When I compile and then Publish my project through Visual Studio 2008 everything works fine.
However when I use msbuild I'm getting errors because AspNetCompiler is trying to compile aspx and ascx files that are not included in my .csproj, but still exist in version control.
I know I can just remove them from version control, but can anyone tell me why these files are being compiled?
Here is my msbuild task.
<AspNetCompiler
TargetPath="$(PackageDir)\Web"
VirtualPath="/"
PhysicalPath="$(buildDirectory)\Web"
Force="true"
/>
Thanks!
The AspNetCompiler task, which wraps _aspnet_compiler.exe_, compiles all "compilable" files in the application, rather than compiling only those files in the .csproj.
The giveaway is that none of the command-line parameters for the executable take a .csproj as input, only paths. (I suppose one could argue that it would look for a .csproj in the directory, but that is unlikely as it would introduce its own set of issues, such as what to do if someone had put two project files in one directory.)

DotNetNuke module development with webservices

I need to deploy a webservice as part of a DotNetNuke 4.x module that I'm creating - but am not sure how I can do that and know that it'll always stay in the same place. How can I add an asmx file to my module project, and when I create my .DNN file specify where the webservice will end up? I want to reference the webservice from inside the ascx file in the module using the "~/webservices/webservice.asmx" format.
Does DotNetNuke have a way to specify in the .DNN file where the webservices will end up on the site? And if so, will I still be able to reference them with root anchored tags like ~/myservice.asmx?
You can include the ASMX file by including a element in the <files> section:
<files>
<file>
<name>YourWebService.asmx</name>
<path></path>
</file>
</files>
Generally, you don't need to specify a path.
Alternatively, you can include a Resources.zip file with your package which will include any files other than those that DNN needs to process during installation (e.g. Assemblies and SqlDataProvider files).
The benefit of this is maintainability. Using Resources.zip will keep you from having to edit the manifest file over and over...
The contents of the zip file will simply be unpacked into the root module directory (e.g. /DesktopModules/YourModule/*). If there is a file structure within your zip file it will be maintained.
You'll want to add TheNameOfYourFile.zip To your manifest file under the element.
[snip]
<folder>
<name>Your Module</name>
<friendlyname>Your Module</friendlyname>
<foldername>YourModule</foldername>
<modulename>YourModule</modulename>
<description>A module for DotNetNuke websites.</description>
<version>01.00.00</version>
<resourcefile>Resources.zip</resourcefile>
<businesscontrollerclass></businesscontrollerclass>
<modules>
<module>
[/snip]
As for referencing it in your module - I suggest using:
<%=ResolveUrl("~/DesktopModules/YourModule/Services.asmx")%>

Resources