C# web service recompile and update - c#

I was just handed a C# web service project and first time doing C# and ASP.NET. The web service and .cs, asmx, and asmx.cs files are located in wwwroot dir of the IIS server. I am writing a PHP SOAP client that calls those asmx files via SOAP. I would like to change some of the hard coded settings in those asmx.cs and .cs files. I have tried the aspnet_compiler and Visual Studio would not load the project. Is there any way to update the code/logic in those files without Visual Studio or recompiling. This project was compiled before. When using VS 2010 - it tries to open the project, converts it and nothing happens. If I have to us VS - any clues why it is not loading those files? It opens them if I open the .cs files individually but then I can't rebuild the project.
Any help/hints would be appreciated.
Thanks

It seems that your project file (.csproj) is interrupted. Refer to other correct project file and fix it manually.
ASP.NET website will auto compile cs and run when asmx first requested. Compiled code is put at bin folder, while cs code is put at app_code folder. Make sure asmx code behide puts to cs file in app_code.

Sorry but it turned out be a Windows profile issue. VS could not load those project files due to my profile being full. Hope it helps someone else in the future :)

Related

update a web project by changing single aspx.cs file

I have to fix a legacy web service project created in C# and asp.net. It is not possible to open the project in visual studio as source safe errors and other missing libraries cause too many compile errors. I am not that familiar with web applications in .NET.
Is it possible to update a single aspx.cs file in the website directory which has a connection string hard coded that needs to be updated. If so, how is this eventually compiled and updated in IIS?
After you've deployed to IIS, you cannot update the .cs file in ASP.net application as they are already compiled into .dll files in the bin folder. The files you can update are with extensions like .aspx .ascx and .config etc. You should modify the .cs file, compile and publish the dll into the bin folder.

External ".xsd" file not included in release folder

I am a WPF newbie. I have my first WPF project which is developed with C# and VS 2013. At the root of the project, there is an external XML schema file with ".xsd" extension that is used in my project codes. Inside VS 2013 environment, I code and run the project without seeing any issue.
Recently, I have built that project for Release. However, the built folder does not include that external ".xsd" file. As a result, on running that project outside VS 2013 environment, I get an exception that tells it could not find out that ".xsd" file. Please tell me how I solve that issue. Thank you in advance.
Make sure the file is set to be copied to output folder on compilation via the property window.

Is Visual Studio 10 expected to compile C# files that are not part of the solution?

Got a Visual studio 10 solution for ASP.NET web site, and VS seems to compile *.aspx.cs files that are in the web site folder, that used to be part of the solution but were excluded (I no longer see these files in the solution explorer). Is it expected? If not, how could I fix it? Rebuilding solution does not help.
Also, is it expected that I cannot find the binaries for *.aspx.cs files?
If your website is a Web site project as opposed to a Web application project (see Web Application Projects versus Web Site Projects in Visual Studio) then IIS will perform the compilation at runtime for you instead of Visual Studio - in this case the .csproj file is not used to determine what is and isn't compiled.
There is no project file (.csproj or .vbproj). All the files in a folder structure are automatically included in the site.
I'm not sure where the compiled binaries go, but I believe that it is a temporary folder somewhere, so you shouldn't necessarily expect to see those binaries in the web site folder structure.
If you want explicit control over what is compiled and when it is compiled then you may be better off converting your project to a web application project.
Short answer: No. It only compiles whatever is is included in the .csproj marked as 'compile' (in the file properties window).
Try to refresh the project, open the .csproj as a file text and check if those files are referenced there.
Lastly, it might be a dependent project that references those files.
If you can't find the solution, paste the exact error given by VS
For clarification, solutions files (.sln) contains project files (.csproj); .csproj files are the ones that contain references to the files to build.

Creating Sharepoint Web Part manifest file and dwp files

Could anyone please help me to understand the following for creating Sharepoint web part please?
Manifest.xml
a. What is the purpose of this file?
b. What happens if we specify the wrong *.wpd file as below?
<DwpFiles>
<DwpFile FileName="WebPart1.dwp"/>
c. How do I create file in Visual Studio as I can't see any template
*.wpd
What is the purpose of this file?
How does this loads the proper dll?
How do we create using Visual studio, any template exists?
If we have webpart project and it references to the dll on another project. Does another project's dll has to be signed?
What are the best mechanisms to deploy the Sharepoint Web Parts?
I use the WspBuilder Visual Studio templates. They are a little quirky but it makes creating the structure of SharePoint projects very simple.
It uses the convention of following the SharePoint folder layout for specifying file locations in the project. Take a look - it might help you get moving. Note there are two versions - one for Visual Studio 2008 and a beta for Visual Studio 2010.
To try to answer your specific questions:
If the file can't be found, no action is taken. It's an error but not one that will bring down SharePoint.
I thought WPD was the old package style. Maybe I'm wrong on this?
Should be same as WSP - a package containing files to be deployed.
Whatever DLL is contained in the package is deployed to the GAC if it's signed.
Take a look at previously mentioned WSP Builder project.
Anything that's loaded by SharePoint and leads to rendered content needs to be signed and possibly added to the SafeControls entry in the web.config (deploying WSPs created from WSPBuilder does this automatically)
"stsadm -o addsolution" then use Central Admin to deploy or continue with "stsadm -o deploysolution"

When do I have to compile asp.net 4.0 project?

When server knows when to compile project ? If I change aspx file it detects changes and compile it on request ? What about changes in cs file ? Thanks for any help
Basically, it depends on your project type.
Web Site projects are compiled on the fly and any code modification in the site folder will trigger recompilation on execution.
Web Application projects need to be manually compiled (you'll see a [your project assembly name].dll in the bin folder).
Also, check http://msdn.microsoft.com/en-us/library/dd547590.aspx for more information about the difference between the 2 project types (and how they are compiled).
Using VS 2010 you may create ASP.NET Web Application or ASP.NET MVC Application using .NET 2.0 - 4.0 of your choice.
The next details are applied for both ASP.NET Web Application and ASP.NET MVC Application:
aspx files most of the times contains only static HTML code and after you change it you don't need to recompile the whole project because server pickup your updated aspx file strait away. With cs files is different story, because in that case when you did any changes in cs file you need to compile it to produce new updated dll files which would contain your latest changes.
So if you did any changes in your cs files and did not recompile the project, your changes won't be available until you recompile the project.
Also using VS 2010 you may create ASP.NET Web Site application. In that case you don't need to recompile your project if you changing cs file. Your source code will compiled automatically by ASP.NET on the server after first request.
More about Summary of Differences between ASP.NET Web application projects and ASP.NET Web site projects you may find here: http://msdn.microsoft.com/en-us/library/dd547590.aspx
With all the project types that exist in Visual Studio 2010 you have to recompile your code every time you make any changes in your .cs files.
In VS 2005 and 2008 there was a project type named "Web site", with this project type you did not have to recompile if you made changes in a code behind file.
For more information check out the differences between CodeFile and CodeBehind.
/Viktor

Categories

Resources