GenesysStack.com
RSS

Blog

How-to fix: Mvc Error CS0012 The type is definied in an assembly that is not referenced
After deploying a MVC project to the dev web server, a new partial view based on @model List<> began to throw the following exceptions: ·         Error    CS0012            The type 'DateTime' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. ·          Error   CS0012            The type 'List<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' The fix was to alter the following block in your Mvc project root web.config: From: To:                                
Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class?
Did You Know that you can use standard ISO 8601 Dates with the DataContractJsonSerializer class? By default, the DataContractJsonSerializer class expects dates in the format of Date(ticks). This is problematic, because ASP.NET Web API returns dates in ISO 8601 format. * Default date: "{\"BirthDate\":\\\/Date(248860800000-0800)\\/\ * ISO 8601 date: "{\"BirthDate\":\"1982-11-16T00:00:00-08:00\"}"
Did You Know that you can capture results from a Stored Procedure into a Table variable?
Did You Know that you can capture results from a Stored Procedure into a Table variable? -- Save Time Range in central stored procedure DECLARE @Result TABLE (ID INT) InsertInto @Result Exec [Entity].[TimeRangeSave]@BeginDate, @EndDate, @ActivityID Select @TimeRangeID = ID From @Result
Did You Know that you can clear MVC TextboxFor default values?
If you like strongly-typed Views...the trick is the Value Html attribute. Not “value”, “Value”. For example: @Html.TextBoxFor(m => m.BirthDate, "{0:MM/dd/yyyy}", new { @id = "txtBirthDate", @class = "form-control BirthDate", @Value = Model.BirthDate == "01/01/1900" ? "" : Model.BirthDate.ToString(), @placeholder = "MM/DD/YYYY" })
Powershell-Copy-Item-With-Folders
Recently, my Continuous Integration Powershell scripts began failing with the following error messages: [error]Copy-Item : Container cannot be copied onto existing leaf item. The fix: Get-ChildItem -Path $Source | Copy-Item -Destination $Destination -Recurse -Container
How-to: Use Visual Studio SQL Server Data Tools (SSDT)
This article describes the process of developing the entire Data Tier in Visual Studio SQL Server Data tools (SSDT.) Many Software Development Life Cycle (SDLC) processes use hand-coded SQL publish scripts when making changes to the data tier. This process is error prone, and is not able to be versioned as easily as C# code projects. SSDT is a technology that brings the data tier in-line with C# projects, and both can be developed, versioned and released in the same manner.
How-to: Upload a SSRS Report Developed in Visual Studio
This article describes how to upload your Visual Studio developed SQL Server Report Services (SSRS) RDL file from your local machine to a SSRS server. This procedure was developed for Visual Studio 2015 and SQL Server 2014, but also works with versions as old as 2010/2012.
How-to: Add ClickOnce Setup and Deployment to your App
ClickOnce will auto-manage everything about desktop-app deployment, updating and execution. You can start an app via Url, everything else is automatic. Running an exe Url like this will: http://www.domain.com/ProductSetupFolder/MajorVersion/Setup.exe •Verify OS, security, permissions requirements •Auto-install .Net Framework and all 3rd party dependencies •Auto-install the app •Auto-update the app when newer versions exist on the server •Auto-run the app
How-to fix: Attempt by security transparent method WebMatrix.WebData.PreApplicationStartCode.Start()

Visual Studio compile and runtime error: Attempt by security transparent method ‘WebMatrix.WebData.PreApplicationStartCode.Start()’ to access security critical method ‘System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)’ failed.

After upgrading Visual Studio to 2015, and projects from MVC 4.x to MVC 5.x, a few projects threw the following compile time and/or runtime error: Attempt by security transparent method ‘WebMatrix.WebData.PreApplicationStartCode.Start()’ to access security critical method ‘System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)’ failed.

To fix this initial error, upgrade WebHelpers via Nuget:

Install-Package Microsoft.AspNet.WebHelpers

Then it is likely you will receive this error after the nuget command: Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

To fix this new error, upgrade WebPages via Nuget:

Install-Package Microsoft.AspNet.WebPages.Data

Hope this helps!

SQL Server Data Tools Error: The script file could not be found

SQL Server Data Tools Error: The script file could not be found

SQL Server Data Tools Error: The script file could not be found

SSDT reported an error upoin trying to Publish my SQL Server Database project to a dev SQL Server: The script file could not be found

Blog-SSDTScriptFile

The fix ended up to be extremely simple: Delete the {Project Name}.dbmdl file in the project folder.

Hope this helps!