Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7532563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:29:24+00:00 2026-05-30T05:29:24+00:00

Can someone point me to what am I doing wrong here? I’m trying to

  • 0

Can someone point me to what am I doing wrong here?

I’m trying to set up an ASP.NET web app project to compile with two versions of web.config file for Release and Debug builds. So for simplicity sake, here’s my web.config:

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <add name="WhyMicrosoftSucksSoMuch" connectionString="" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>

And then I do the following in web.debug.config:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <connectionStrings>
      <add name="WhyMicrosoftSucksSoMuch"
           connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename='C:\FilePath\Database1.mdf';User Instance=true"
           providerName="System.Data.SqlClient" 
           xdt:Transform="SetAttributes" xdt:Locator="Match(connectionString)" />
  </connectionStrings>
</configuration>

If I publish it under Debug configuration the resulting web.config looks good, but when I try to run my project from VS2010 also under Debug configuration I get an error when my logic attempts to access database:

The ConnectionString property has not been initialized.

So what’s the trick here?

PS. And please don’t point me to this document. I tried reading it several times but I get a headache from so much superfluous information. I guess MS doesn’t know what brief is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:29:25+00:00Added an answer on May 30, 2026 at 5:29 am

    When running it under debug mode it doesn’t apply any transformations.

    It only applies them during publishing. You can put your debug connection string in the main web.config, and add your production connection string to the web.release.config

    also, you probably will want to use

    xdt:Transform="Replace"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope someone can point out where I'm going wrong here. I'm trying to
Can someone please point out what I am doing wrong in the following code?
So maybe someone can point me in the right direction of what is causing
I'm struggling with a C issue and I can't figure what I'm doing wrong.
I cant seem to understand what i'm doing wrong here. To certain extend my
I cannot see what I am doing wrong here. Here is the code I
I'm pretty new to C#, I'm trying to complete a little side project I've
The goal: To create a .NET dll i can reference from inside SQL Server
I'm new to logrotate on linux machines... here's what I have set up in
I've stucked on this and can't find way out :/ I'm trying to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.